제출 #835307

#제출 시각아이디문제언어결과실행 시간메모리
835307enerelt14Global Warming (CEOI18_glo)C++14
10 / 100
53 ms3156 KiB
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <chrono> #include <climits> #include <cmath> #include <complex> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <vector> using namespace std; const int MX = 2e5 + 5; int n, x, t[MX]; vector<int> lis[2]; int find(int id, int l, int r, int val) { if(l == r) { if(lis[id][l] < val) return l; else return l - 1; } int mid = (l + r) / 2; if(lis[id][mid] < val) return find(id, mid + 1, r, val); else return find(id, l, mid, val); } void show() { for(int id = 0; id < 2; id++) { for(int i = 0; i < (int)lis[id].size(); i++) cout << lis[id][i] << " "; cout << "\n"; } cout << "---------------\n"; } int main() { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> x; for(int i = 0; i < n; i++) { cin >> t[i]; if(!i) { lis[0].push_back(t[0]); lis[1].push_back(t[0]); continue; } int a = find(0, 0, (int)lis[0].size() - 1, t[i]); int b = find(1, 0, (int)lis[1].size() - 1, t[i]); int c = find(0, 0, (int)lis[0].size() - 1, t[i] + x); for(int i = max(a, b); i < c ; i++) { lis[1][i + 1] = min(lis[1][i + 1], t[i]); } if(c == lis[1].size() - 1) lis[1].push_back(t[i]); else lis[1][c + 1] = min(lis[1][c + 1], t[i]); if(a == (int)lis[0].size() - 1) lis[0].push_back(t[i]); else lis[0][a + 1] = t[i]; if(b == (int)lis[1].size() - 1) lis[1].push_back(t[i]); else lis[1][b + 1] = t[i]; //show(); } cout << (int)lis[1].size(); }

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

glo.cpp: In function 'int main()':
glo.cpp:60:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |   if(c == lis[1].size() - 1) lis[1].push_back(t[i]);
      |      ~~^~~~~~~~~~~~~~~~~~~~
#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...