Submission #798831

#TimeUsernameProblemLanguageResultExecution timeMemory
798831vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
241 ms12896 KiB
#include <bits/stdc++.h> #define fi first #define se second const int N = 200200; const int mod = 1e9 + 7; using namespace std; int main() { #ifdef zxc freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n; cin >> n; vector<int> a(n); map<int, int> last; for (int i = 0; i < n; i++) { cin >> a[i]; last[a[i]] = i; } for (int i = 0; i < n; i++) { for (int j = i; j <= last[a[i]]; j++) { a[j] = a[i]; } i = last[a[i]]; } for (int x : a) { cout << x << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...