제출 #652173

#제출 시각아이디문제언어결과실행 시간메모리
652173pauloamedGlobal Warming (CEOI18_glo)C++14
27 / 100
46 ms1752 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 200010; int N, X; int v[MAXN]; int main(){ cin.tie(NULL)->sync_with_stdio(false); cin >> N >> X; for(int i = 0; i < N; ++i) cin >> v[i]; vector<int> lis; int size_0 = 0; for(int i = 0; i < N; ++i){ { auto it = lower_bound(lis.begin(), lis.end(), v[i]+X); if(it == lis.end()) lis.push_back(v[i]+X); else *it = v[i]+X; } { auto it = lower_bound(lis.begin(), lis.end(), v[i]); assert(it != lis.end()); *it = v[i]; // auto pos = min((int)(it - lis.begin()), size_0); // lis[pos] = min(v[i], lis[pos]); // size_0 = max(size_0, pos + 1); } // for(int j = 0; j < lis.size(); ++j){ // cout << lis[j] << " "; // } // cout << "\n"; } cout << lis.size() << "\n"; }

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

glo.cpp: In function 'int main()':
glo.cpp:15:7: warning: unused variable 'size_0' [-Wunused-variable]
   15 |   int size_0 = 0;
      |       ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...