Submission #469487

#TimeUsernameProblemLanguageResultExecution timeMemory
469487radalLIS (INOI20_lis)C++14
20 / 100
102 ms576 KiB
#include <bits/stdc++.h> #pragma GCC target ("avx,avx2,fma") #pragma GCC optimize ("O2") #pragma GCC optimize ("unroll-loops") #define X first #define Y second #define debug(x) cerr << #x << ": " << x << endl; #define endl '\n' #define pb push_back #define rep(i,l,r) for (int i=l; i<r; i++) #define repr(i,r,l) for (int i=r; i>=l; i--) using namespace std; typedef long long ll; typedef pair<int,int> pll; const long long int N = 2e3+20,mod = 1e9+7,inf=1e9+1; int lis[N],a[N],b[N]; int main(){ ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0); int q; cin >> q; rep(j,1,q+1){ memset(lis,63,sizeof lis); lis[0] = 0; int p,x; cin >> p >> x; rep(i,1,p) b[i] = a[i]; b[p] = x; rep(i,p+1,j+1) b[i] = a[i-1]; int ans = 0; rep(i,1,j+1){ a[i] = b[i]; int ind = lower_bound(lis,lis+j+1,a[i])-lis; lis[ind] = a[i]; ans = max(ans,ind); } cout << ans << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...