Submission #920175

#TimeUsernameProblemLanguageResultExecution timeMemory
920175ting39Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
338 ms9412 KiB
#include<bits/stdc++.h> #define int long long #define pii pair<int,int> #define F first #define S second using namespace std; signed main(){ int n; cin>>n; vector<int> v(n); for(int &i:v) cin>>i; vector<int> num=v; sort(num.begin(),num.end()); num.resize(unique(num.begin(),num.end())-num.begin()); for(int &i:v) i=lower_bound(num.begin(),num.end(),i)-num.begin(); vector<int> cnt(n); for(int i:v) cnt[i]++; int pre=v[0]; for(int i=0;i<n;i++){ cnt[v[i]]--; if(cnt[pre]==0) pre=v[i]; cout<<num[pre]<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...