# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
785389 | kebine | Global Warming (CEOI18_glo) | C++17 | 2060 ms | 3608 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define int long long
using namespace std;
int pre, n, x;
vector<int> a, b;
signed main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> x;
while(n--) {
int p; cin >> p;
vector<int> tempaa=a;
auto it=lower_bound(tempaa.begin(), tempaa.end(), p);
if(it==tempaa.end()) tempaa.push_back(p);
else *it=p;
vector<int> tempba=b;
it=lower_bound(tempba.begin(), tempba.end(), p);
if(it==tempba.end()) tempba.push_back(p);
else *it=p;
if(tempaa.size()>tempba.size()) a=tempaa;
else a=tempba; p-=x;
it=lower_bound(b.begin(), b.end(), p);
if(it==b.end()) b.push_back(p);
else *it=p;
}
cout << max(a.size(), b.size()) << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |