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;
int main(){
int n;
cin >> n;
vector<int> a(n), ans(n);
for (int i=0; i<n; i++)
cin >> a[i];
map<int, int> lst_idx;
for (int i=0; i<n; i++)
lst_idx[a[i]] = i;
int confirmed_nuke = -1;
for (int i=0; i<n; i++){
if (i == confirmed_nuke + 1)
confirmed_nuke = lst_idx[a[i]];
cout << a[confirmed_nuke] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |