Submission #798792

#TimeUsernameProblemLanguageResultExecution timeMemory
798792vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
60 / 100
2083 ms259832 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n; cin >> n; map<int, vector<int>> st; int a[n]; for(int i = 0; i < n; i++) { cin >> a[i]; if(st[a[i]].empty()) st[a[i]].push_back(i); else { int lst = st[a[i]].back(); for(int j = i - 1; j > lst; j--) st[a[j]].pop_back(); while(lst < i) { a[++lst] = a[i]; st[a[lst]].push_back(lst); } } } for(int i = 0; i < n; i++) cout << a[i] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...