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;
const int mxN = (int)2e5+10;
int n, i, a[mxN];
map<int,int> mx;
int main() {
cin >> n;
for(i = 0; i < n; i++) cin >> a[i], mx[a[i]]=i;
i=0;
while(i<n){
int x = a[i];
while(i<n and mx[x]>=i) cout<<x<<"\n",i++;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |