Submission #1007261

#TimeUsernameProblemLanguageResultExecution timeMemory
1007261ASN49KStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
141 ms14672 KiB
#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)

Main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...