제출 #837964

#제출 시각아이디문제언어결과실행 시간메모리
837964gun_ganStone Arranging 2 (JOI23_ho_t1)C++17
35 / 100
19 ms1876 KiB
#include <bits/stdc++.h> using namespace std; const int MX = 2e5 + 5; int A[MX], cnt[MX]; int N; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> N; for(int i = 1; i <= N; i++) cin >> A[i]; for(int i = 1; i <= N; i++) { if(cnt[A[i]]) { int j = i - 1; while(j > 0 && A[j] != A[i]) { cnt[A[j]]--; A[j] = A[i]; cnt[A[j]]++; j--; } } cnt[A[i]]++; } for(int i = 1; i <= N; i++) cout << A[i] << " "; cout << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...