| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 774724 | vjudge1 | Stone Arranging 2 (JOI23_ho_t1) | C++14 | 2061 ms | 13892 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.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define ii pair<int,int>
const ll maxn=2e5+2;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin>>n;
int a[n];
unordered_map <int,int> mp;
stack<int> st;
int x;
for (int i=0;i<n;++i){
cin>>x;
if (!mp[x]){
st.push(x);
}else{
int cnt=1;
while (st.top()!=x){
++cnt;
--mp[st.top()];
st.pop();
}
while (cnt--){
st.push(x);
++mp[x];
}
--mp[x];
}
++mp[x];
}
vector<int> v;
while (!st.empty()){
v.push_back(st.top());
st.pop();
}
reverse(v.begin(),v.end());
for (int i: v) cout<<i<<" ";
}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... | ||||
