제출 #1007262

#제출 시각아이디문제언어결과실행 시간메모리
1007262ASN49KStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
120 ms12624 KiB
//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++; } } }

컴파일 시 표준 에러 (stderr) 메시지

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