#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define F first
#define pii pair<int,int>
#define all(a) a.begin(),a.end()
#define S second
#define sz(a) (int)a.size()
#define rep(i , a , b) for(int i = (a) ; i <= (b) ; i++)
#define per(i , a , b) for(int i = (a) ; i >= (b) ; i--)
#define ld long double
#define int long long
using namespace std ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int maxn = 1e6+20 , maxm = 2e4 + 220, sq = 500 , inf = 1e18+10 , mod =998244353 ;
int a[maxn] ;
signed main(){
ios_base::sync_with_stdio(false) ; cin.tie(0) ;
int n;cin >> n ;
map <int,int> mp ;
rep(i ,1, n){
cin >> a[i] ;
mp[a[i]] = i ;
}
int x = 1;
rep(i ,1, n){
cout << a[x] << "\n";
if(i == x){
if(mp[a[i]] == i){
x = i+1;
}
continue ;
}
if(a[i] == a[x]){
if(mp[a[i]] == i){
x = i+1 ;
}else{
x = i ;
}
continue ;
}
}
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |