Submission #1059467

#TimeUsernameProblemLanguageResultExecution timeMemory
1059467Roumak77Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
302 ms18432 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> #include <algorithm> #include <iostream> #include <vector> #include <limits> #include <cmath> #include <stack> #include <queue> #include <map> #include <math.h> using namespace std; using ll = long long; void solve(){ ll n; cin >> n; map<ll, ll> last_colors; vector<ll> list_n(n, 0); for(ll i = 0; i < n; i++){ cin >> list_n[i]; last_colors[list_n[i]] = i; } ll idx = 0; while (idx != n) { ll color = list_n[idx]; ll last = last_colors[color]; for(ll i = 0; i < last - idx + 1;i++){ cout << color << endl; } idx = last + 1; } } int main(){ ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0); ll t = 1 ; //cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...