# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
144168 | 2019-08-16T09:17:16 Z | Swan | Global Warming (CEOI18_glo) | C++14 | 51 ms | 5664 KB |
#include <bits/stdc++.h> #define stop system("pause") #define INP freopen("input.txt","r",stdin) #define OUTP freopen("solve1.txt","w",stdout) using namespace std; typedef long long ll; const int maxn = 200123; ll dp[maxn]; void clean(int mx){ dp[0] = -1e16; for(int i(1);i <=mx;i++)dp[i] = 1e16; } int get_lis(vector<ll>& v){ clean(v.size()); int ans = 0; for(int i(0); i < v.size();i++){ int mx = upper_bound(dp,dp+i+1,v[i])-dp; //cout << mx << ' ' << v[mx-2] << ' ' << v[i] << endl; if(mx!=1 && dp[mx-1] >= v[i])continue; dp[mx] = min(dp[mx],v[i]); ans = max(ans,mx); } return ans; } main() { ios_base::sync_with_stdio(0); ll n,x; cin >> n >> x; vector<ll> v; for(int i(0); i < n;i++){ int w; cin >> w; v.push_back(w); } cout << get_lis(v); return 0; } /* 6 2 1 2 1 3 2 1 1 0 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 51 ms | 3604 KB | Output is correct |
2 | Correct | 51 ms | 5476 KB | Output is correct |
3 | Correct | 51 ms | 5664 KB | Output is correct |
4 | Correct | 50 ms | 5480 KB | Output is correct |
5 | Correct | 34 ms | 4712 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 1268 KB | Output is correct |
2 | Correct | 14 ms | 1780 KB | Output is correct |
3 | Correct | 14 ms | 1780 KB | Output is correct |
4 | Incorrect | 10 ms | 1524 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 25 ms | 2000 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 380 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |