Submission #987315

#TimeUsernameProblemLanguageResultExecution timeMemory
987315lucriEditor (BOI15_edi)C++17
0 / 100
87 ms4692 KiB
#include <bits/stdc++.h> using namespace std; long long n,v[300010]; stack<int>s; int main() { cin>>n; for(int i=1;i<=n;++i) cin>>v[i]; for(int i=1;i<=n;++i) cout<<1<<'\n'; for(int i=n;i>=0;--i) { if(s.empty()&&v[i]>=0) { cout<<v[i]; return 0; } if(v[i]>=0) v[i]=0; if(!s.empty()&&v[i]>s.top()) s.pop(); else s.push(v[i]); } 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...