Submission #994112

#TimeUsernameProblemLanguageResultExecution timeMemory
994112zhehanStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
196 ms18420 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ int n; cin>>n; int stones[n]; for(int i=0;i<n;++i){ cin>>stones[i]; } map<int,int> last_o; for(int i=0;i<n;++i){ last_o[stones[i]]=i; } for(int i=0;i<n;++i){ int nxt=last_o[stones[i]]+1; for(int j=i;j<nxt;++j){ cout<<stones[i]<<'\n'; } i=nxt-1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...