Submission #786373

#TimeUsernameProblemLanguageResultExecution timeMemory
786373stefanneaguStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
279 ms13508 KiB
#include <iostream> #include <map> using namespace std; const int nmax = 2e5 + 7; map<int, int> ult; int v[nmax]; int main() { int n; cin >> n; for(int i = 1; i <= n; i ++) { cin >> v[i]; ult[v[i]] = i; } int i = 1; while(i <= n) { int val = v[i]; while(i <= ult[val]) { v[i] = val; i ++; } } for(int i = 1; i <= n; i ++) { cout << v[i] << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...