제출 #774673

#제출 시각아이디문제언어결과실행 시간메모리
774673vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
248 ms26728 KiB
#include <bits/stdc++.h> using namespace std; int n; vector<int> v; map<int, vector<int>> indexes; vector<pair<int, int>> results; int main() { // freopen("inp.txt", "r", stdin); ios::sync_with_stdio(false); cin >> n; v.resize(n + 1); for (int i = 1; i <= n; i++) { cin >> v[i]; indexes[v[i]].push_back(i); } for (int i = 1; i <= n;) { auto p = &indexes[v[i]]; results.emplace_back(p->back() - i + 1, v[i]); i = p->back() + 1; } for (auto &result : results) for (int i = 0; i < result.first; i++) cout << result.second << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...