This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int n;
cin>>n;
int stones[n];
for(int i=0;i<n;++i){
cin>>stones[i];
}
map<int,int> last_o;
for(int i=0;i<n;++i){
last_o[stones[i]]=i;
}
for(int i=0;i<n;++i){
int nxt=last_o[stones[i]]+1;
for(int j=i;j<nxt;++j){
cout<<stones[i]<<'\n';
}
i=nxt-1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |