# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984502 | Acanikolic | Global Warming (CEOI18_glo) | C++14 | 2050 ms | 5336 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
#define pb push_back
#define F first
#define S second
const int N = 500 + 10;
const int inf = 2e9;
const int mod = 998244353;
using namespace std;
int lis(vector<int>v) {
vector<int>ans;
for(int i = 0; i < v.size(); i++) {
if(ans.empty() || ans.back() < v[i]) {
ans.pb(v[i]);
}else {
int lb = lower_bound(ans.begin(),ans.end(),v[i]) - ans.begin();
ans[lb] = v[i];
}
}
return (int)ans.size();
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,x,res = 0;
cin >> n >> x;
vector<int>a(n);
for(int i = 0; i < n; i++) cin >> a[i];
res = lis(a);
for(int i = 0; i < n; i++) {
a[i] -= x;
res = max(res,lis(a));
}
cout << res;
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... |