Submission #1205027

#TimeUsernameProblemLanguageResultExecution timeMemory
1205027namhhStone Arranging 2 (JOI23_ho_t1)C++20
100 / 100
57 ms13200 KiB
#include<bits/stdc++.h> using namespace std; const int N = 2e5+1; int n,a[N],ans[N],pre[N]; unordered_map<int,int>mp; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int i = 1; i <= n; i++) mp[a[i]] = i; int x = 1; while(x <= n){ int cc = mp[a[x]]; for(int i = x; i <= cc; i++) ans[i] = a[x]; x = cc+1; } for(int i = 1; i <= n; i++) cout << ans[i] << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...