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>
#define inf INT_MAX
#define longlonginf LONG_LONG_MAX
#define mod 1000000007
#define MAXN 200005
#define pii pair<ll,ll>
#define ll long long
#define deb(x) cerr<<"[ "<<#x<<" = "<<x<<" ]";
#define yes() cout<<"YES\n";
#define no() cout<<"NO\n";
using namespace std;
ll n,k,m,cur,q,z;
ll ans = 0;
string subtask;
string s;
string l,r;
void solve(){
cin>>n;
ll a[n+5];
for(int i = 1 ; i <= n ; i++){
cin>>a[i];
}
map<int,int> mp;
for(int i = 1 ; i <= n ; i++) mp[a[i]] = i;
for(int i = 1 ; i <= n ;){
int x = i;
int y = mp[a[x]];
for(; i <= y ; i++){
cout<<a[x]<<"\n";
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
//cin>>T;
for(int i = 0 ; i < T ; i++){
//cout<<"Case #"<<i+1<<": ";
solve();
}
return 0;
}
/*
misread -> missed subtask
you thought u declared it huh?
not i but x
logical operator
wrong example/proof
thoroughly
wrong variables
thinking it wrong
bruh just try some test case
capitals ;-;
wrong data structure lol
count memory usement
corner case
oversized array
orders
statements
size initializer
while con
map -> array
wrong digits??
swapped variables??
check if theres any variabled
that got declared twice
find some pattern
name collision
constraints??!
mod !!
resets
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |