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 pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define pb push_back
int main() {
ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int n; cin>>n;
deque<int> v;
for(int i=0; i<n; i++) {
int x; cin >> x;
auto it = find(v.begin(), v.end(), x);
if (it != v.end()) {
for (int j=0; j<it-v.begin(); j++) {
v[j] = x;
}
}
v.push_front(x);
}
for(int i=n-1; i>=0; i--) cout << v[i] << "\n";
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... |