Submission #537147

#TimeUsernameProblemLanguageResultExecution timeMemory
537147XiaoyangGlobal Warming (NOI13_gw)C++17
30 / 40
262 ms33248 KiB
//#pragma GCC optimize("O3,unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include<bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define endl "\n" #define pb push_back #define MP make_pair #define ll long long #define int long long #define inf 0x3f3f3f3f #define pii pair<int,int> #define pq priority_queue #define gcd(x,y) __gcd( x, y) #define ALL(x) x.begin(),x.end() #define pll pair<long long,long long> #define debug(x) cerr<<#x<<"="<<x<<endl #define rep(i,a,b) for (int i=a;i<(int)(b);i++) typedef tree<long long, null_type, less_equal<long long>,rb_tree_tag, tree_order_statistics_node_update>ordered_set; int lowbit(int x){return x&(-x);} long long expo(ll x,ll y,ll z){if(y==1)return (long long)x;ll m=expo(x,y/2,z)%z;if(y%2==0)return (long long)((m*m)%z);else return (long long)((((m*m)%z)*x)%z);} int fw[1000005];void update(int x,int c){while(x<=1000005){fw[x]=fw[x]+c;x+=lowbit(x);}}int query(int x){int ans=0;while(x>=1){ans+=fw[x];x-=lowbit(x);}return ans;} int blist[1000009]; signed main(){ ios::sync_with_stdio(false); cin.tie(0); int n,x=0,ans=0;cin>>n; vector<pii>alist; rep(i,0,n){ int a;cin>>a; alist.pb({a,i}); } sort(ALL(alist)); reverse(ALL(alist)); rep(i,0,n){ blist[alist[i].se]=1; if(alist[i].se>0)x-=blist[alist[i].se-1]; if(alist[i].se<n-1)x-=blist[alist[i].second+1]; x++; if(i!=n-1 and alist[i].fi>alist[i+1].fi)ans=max(ans, x); } cout<<ans; 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...