제출 #468233

#제출 시각아이디문제언어결과실행 시간메모리
468233wdjpngGlobal Warming (CEOI18_glo)C++17
0 / 100
126 ms4964 KiB
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) using namespace std; signed main() { int n, x; cin >> n >> x; vector<int>t(n); rep(i,n) cin>>t[i]; vector<int>c; vector<int>right(n); for(int i = n-1; i >=0; i--) { int r = 1e10 - t[i]; if(!c.size()||r>c[c.size()-1]) c.push_back(r); else *(lower_bound(c.begin(), c.end(), r)) = r; right[i] = c.size(); } c = vector<int>(n, 1e17); int maxx = 0; rep(i,n) { auto it = lower_bound(c.begin(), c.end(), t[i] - x); int off = it - c.begin(); maxx=max(maxx, right[i] + (lower_bound(c.begin(), c.end(), t[i] - x) - c.begin())); *(lower_bound(c.begin(), c.end(), t[i]-x)) = t[i] - x; } cout<<maxx<<"\n"; }

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

glo.cpp: In function 'int main()':
glo.cpp:30:13: warning: unused variable 'off' [-Wunused-variable]
   30 |         int off = it - c.begin();
      |             ^~~
#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...