제출 #785195

#제출 시각아이디문제언어결과실행 시간메모리
785195devariaotaGlobal Warming (CEOI18_glo)C++17
0 / 100
125 ms15852 KiB
#include <bits/stdc++.h> using namespace std; #define v vector #define int long long #define all(a) (a).begin(), (a).end() #define pb push_back #define mk make_pair #define pii pair<int, int> #define ff first #define ss second #define inp_v(vec) for (auto &i : vec) cin >> i; #define prt_v(vec) for (auto i : vec) cout << i << endl; #define MS(x) memset(x, 0, sizeof(x)) #define gcd(a,b) __gcd(a, b); #define lcm(a,b) (a*(b/gcd(a,b))) #define lb lower_bound bool chmin(int &a, int b){return b<a?a=b, true:false;} bool chmax(int &a, int b){return b>a?a=b, true:false;} const int maxn=2e5+5; int dp[maxn], A[maxn]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int N, x;cin>>N>>x; for(int i=1;i<=N;i++)cin>>A[i]; multiset<pair<int, int>>st; dp[N]=1; st.insert({A[N], N}); int ans=0; for(int i=N-1;i>=1;i--){ auto it=st.upper_bound({A[i], 1e9}); if(it==st.end())dp[i]=1; else{ dp[i]=dp[(*it).second]+1; } ans=max(ans, dp[i]); st.insert({A[i], i}); } cout<<ans<<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...
#Verdict Execution timeMemoryGrader output
Fetching results...