Submission #785192

#TimeUsernameProblemLanguageResultExecution timeMemory
785192devariaotaGlobal Warming (CEOI18_glo)C++17
10 / 100
29 ms3468 KiB
#include <bits/stdc++.h> #define int long long #define fi first #define se second #define keish ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) using namespace std; int n, x; signed main(){ keish; cin >> n >> x; vector<int> a(n + 1); for(int i = 1; i <= n; i++) cin >> a[i]; vector<int> dp(n + 1, 1e18); dp[0] = -1e18; for(int i = 1; i <= n; i++){ int j = upper_bound(dp.begin(), dp.end(), a[i]) - dp.begin(); if(dp[j - 1] < a[i] && a[i] < dp[j]) dp[j] = a[i]; } int ans = 0; for(int i = n; i >= 1; i--){ if(dp[i] != 1e18){ ans = i; break; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...