Submission #848233

#TimeUsernameProblemLanguageResultExecution timeMemory
848233LinkedArrayStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
206 ms14540 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5; int a[MAXN]; map<int, int> lastPointer; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, i, color; cin >> n; for(i = 0; i < n; i++){ cin >> a[i]; lastPointer[ a[i] ] = i; } i = 0; while(i < n){ color = a[i]; while(i <= lastPointer[color]){ a[i++] = color; } } for(i = 0; i < n; i++){ cout << a[i] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...