# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1097164 | papi | Global Warming (CEOI18_glo) | C++14 | 22 ms | 2904 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 fi first
#define se second
#define I2 pair <int, int>
#define L2 pair <long long, long long>
#define IL pair <int, long long>
#define LI pair <long long, int>
using namespace std;
const int MAXN = 1e6 + 7, MOD = 1e9 + 7, base = 31;
const long long oo = 1e18;
int DX[] = {0, -1, 0, 1}, DY[] = {-1, 0, 1, 0};
int n, ans;
int lis[MAXN], a[MAXN];
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
if (fopen("TEXT.INP", "r")){
freopen("TEXT.INP", "r", stdin);
freopen("TEXT.OUT", "w", stdout);
}
cin >> n;
for (int i = 1; i <= n; i++){
cin >> a[i];
}
ans = 1;
lis[1] = a[1];
for (int i = 2; i <= n; i++){
int k = lower_bound(lis + 1, lis + ans + 1, a[i]) - lis;
lis[k] = a[i];
ans = max(ans, k);
}
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... |