| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 940004 | vjudge1 | Global Warming (CEOI18_glo) | C++17 | 2063 ms | 10068 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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
#define int long long
#define ff first
#define ss second
const int INF = 1e9 + 7;
const int N = 1e6 + 1;
int LIS(vector<int> a){
set<int> dp;
for(int i = 0;i < (int)a.size(); i++){
int x = a[i];
if(dp.lower_bound(x) != dp.end()) dp.erase(dp.lower_bound(x));
dp.insert(x);
}
return (int)dp.size();
}
main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
int x; cin >> x;
vector<int> a(n);
for(int i = 0;i < n; i++){
cin >> a[i];
}
vector<int> A = a;
int ans = LIS(a);
if(x == 0){
cout << ans;
return 0;
}
for(int i = 0;i < n; i++){
a[i]+= -x;
ans = max(ans, LIS(a));
}
/*a = A;
for(int i = n-1; i >= 0; i--){
a[i]+= x;
ans = max(ans, LIS(a));
}*/
cout << ans;
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... | ||||
