제출 #1292291

#제출 시각아이디문제언어결과실행 시간메모리
1292291BuiDucManh123LIS (INOI20_lis)C++20
20 / 100
4086 ms916 KiB
#include <bits/stdc++.h> #define fi first #define se second #define ll long long #define pii pair<int, int> #define pb push_back #define taskname "" const int mod = 1e9+7; using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); int lis(vector<int>& arr){ int n = arr.size(); vector<int> ans; ans.pb(arr[0]); for(int i = 1; i < n; i++){ if (arr[i] > ans.back()){ ans.pb(arr[i]); } else{ int low = lower_bound(ans.begin(), ans.end(), arr[i]) - ans.begin(); ans[low] = arr[i]; } } return ans.size(); } void solve(){ int q; cin >> q; vector<int> a; while(q--){ int x, v; cin >> x >> v; a.insert(a.begin() + x - 1, v); cout << lis(a) << "\n"; } } signed main() { if (fopen(taskname".inp","r")) { freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout); } ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int test = 1; //cin >> test; while(test--){ solve(); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:41:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |         freopen(taskname".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:42:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |         freopen(taskname".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...