제출 #774655

#제출 시각아이디문제언어결과실행 시간메모리
774655vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
276 ms14796 KiB
#include<bits/stdc++.h> using namespace std; long long n, a[200001], ans[200001]; map<int, int> pre; int main() { cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i]; pre[a[i]] = 0; } for(int i = n; i >= 1; --i) { if(!pre[a[i]]) pre[a[i]] = i; } for(int i = 1; i <= n; i = pre[a[i]] + 1) { for(int j = i; j <= pre[a[i]]; ++j) { ans[j] = a[i]; } } for(int i = 1; i <= n; ++i) cout << ans[i] << " "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...