Submission #262342

#TimeUsernameProblemLanguageResultExecution timeMemory
262342FidiskSeparator (CEOI19_separator)C++14
100 / 100
239 ms33288 KiB
#include <bits/stdc++.h> using namespace std; #define oo 1e18 #define fi first #define se second #define sp(iiii) setprecision(iiii) #define IO ios_base::sync_with_stdio(false); cin.tie(0) #define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa)) #define cntbit(xxxx) __builtin_popcount(xxxx) #define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1) #define _cos(xxxx) cos(xxxx*acos(-1)/180) #define _sin(xxxx) sin(xxxx*acos(-1)/180) #define _tan(xxxx) tan(xxxx*acos(-1)/180) #define PE cout<<fixed typedef long double ld; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<pair<int,int>,int> piii; typedef pair<long long,long long> pll; typedef pair<pair<long long,long long>,long long> plll; const ld pi=acos(-1); const ll mod=1e9; ll lmax,n,i,a[5000009],last; stack<ll> st; int main(){ IO; cin>>n; last=0; lmax=-1; for (i=1;i<=n;i++) { cin>>a[i]; a[i]=(a[i]+last)%mod; while ((!st.empty())&&(a[i]<=st.top())) { st.pop(); } if (lmax<a[i]) { st.push(a[i]); } lmax=max(a[i],lmax); last=st.size(); cout<<st.size()<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...