제출 #887628

#제출 시각아이디문제언어결과실행 시간메모리
887628GordonRemzi007Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
231 ms14528 KiB
#include <iostream> #include <vector> #include <map> using namespace std; int main() { int n, skip = -1; cin >> n; vector<int> a(n); map<int,int> last; for(int i = 0; i < n; i++) { cin >> a[i]; last[a[i]] = max(last[a[i]], i); } for(int i = 0; i < n; i++) { if(skip == -1) { if(last[a[i]] != i) skip = last[a[i]]; cout << a[i] << "\n"; } else cout << a[skip] << "\n"; if(skip == i) skip = -1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...