제출 #885101

#제출 시각아이디문제언어결과실행 시간메모리
885101juliany2Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
159 ms15344 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; #define all(x) (x).begin(), (x).end() int main() { cin.tie(0)->sync_with_stdio(false); int n; cin >> n; map<int, int> cnt; vector<array<int, 2>> a; for (int i = 1; i <= n; i++) { int x; cin >> x; int cur = 1; if (cnt[x]) { while (a.back()[0] != x) { cur += a.back()[1]; cnt[a.back()[0]]--; a.pop_back(); } } cnt[x]++; a.push_back({x, cur}); } for (auto &[x, c] : a) while (c--) cout << x << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...