# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007262 | ASN49K | Stone Arranging 2 (JOI23_ho_t1) | C++14 | 120 ms | 12624 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.
//we always fill from the leftest position to the last positon with this value
#include <bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
using i64 =long long;
main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
map<int,int>last;
vector<int>a(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
last[a[i]]=i;
}
for(int i=0;i<n;)
{
int lst=last[a[i]],val=a[i];
while(i<=lst)
{
cout<<val<<'\n';
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... |