Submission #581688

#TimeUsernameProblemLanguageResultExecution timeMemory
581688XJP12Cloud Computing (CEOI18_clo)C++14
0 / 100
1 ms300 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<int> vi; vi a; int lis(int n) { int INF = INT_MAX; vector<int> d(n+1, INF); d[0] = -INF; for (int i = 0; i < n; i++) { int j = upper_bound(d.begin(), d.end(), a[i]) - d.begin(); if (d[j-1] < a[i] && a[i] < d[j]) d[j] = a[i]; } int ans = 0; for (int i = 0; i <= n; i++) { if (d[i] < INT_MAX) ans = i; } return ans; } int main(){ int n; cin>>n; a.resize(n,0); for(int i=0; i<n; i++){ cin>>a[i]; } cout<<lis(n)<<endl; return 0; }
#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...