# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
935726 | anton | Stone Arranging 2 (JOI23_ho_t1) | C++17 | 419 ms | 23956 KiB |
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 int long long
#define pii pair<int, int>
signed main(){
int n;
cin>>n;
vector<pii> st;
map<int, int> oc;
for(int i = 0; i<n; i++){
int a;
cin>>a;
if(oc[a] == 0){
st.push_back({a, i});
oc[st.back().first]++;
}
else{
while(st.size()>0 && st.back().first !=a){
oc[st.back().first]--;
st.pop_back();
}
st.back().second = i;
}
}
vector<int> res;
for(auto e: st){
while(res.size()<=e.second){
res.push_back(e.first);
}
}
for(int i = 0; i<n; i++){
cout<<res[i]<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |