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 ll long long
#define dbg(x) cout << (#x) << " = " << x << endl
const ll maxn = 2e5 + 69;
ll a[maxn],b[maxn],n;
map<ll,ll> cnt;
int main(){
cin >> n;
for(int i = 1;i<=n;i++){
cin >> a[i];
b[i] = a[i];
if(cnt[a[i]] == 0){
cnt[a[i]] = i;
}else{
//dbg(a[i]);
for(int j = cnt[a[i]];j<=i;j++){
b[j] = a[i];
cnt[a[j]] = 0;
}
cnt[a[i]] = i;
}
}
for(int i = 1;i<=n;i++) cout << b[i] << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |