Submission #1131535

#TimeUsernameProblemLanguageResultExecution timeMemory
1131535lopkusStone Arranging 2 (JOI23_ho_t1)C++20
60 / 100
2095 ms16504 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> a(n + 1); for(int i = 1; i <= n; i++) { cin >> a[i]; } map<int,int> M; M[a[1]] = 1; for(int i = 2; i <= n; i++) { if(M[a[i]]) { for(int j = M[a[i]] + 1; j < i; j++) { M[a[j]] = 0; a[j] = a[i]; } } M[a[i]] = i; } for(int i = 1; i <= n; i++) { cout << a[i] << " "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...