Submission #774722

#TimeUsernameProblemLanguageResultExecution timeMemory
774722vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
60 / 100
2087 ms12528 KiB
#include<bits/stdc++.h> using namespace std; map<int, int> last; int a[200005]; int n; int main() { cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i]; } cout << a[1] << endl; last[a[1]] = 1; for(int i = 2; i <= n; i++) { if(last[a[i]]) { int j = last[a[i]]; for(int k = j; k <= i; k++) { last[a[k]] = 0; a[k] = a[i]; } } last[a[i]] = i; } for(int i = 2; i <= n; i++) { cout << a[i] << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...