제출 #774658

#제출 시각아이디문제언어결과실행 시간메모리
774658vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
0 / 100
1795 ms1048576 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]]; auto itr = ++lower_bound(p->begin(), p->end(), i); if (itr != p->end()) results.emplace_back(*itr - i + 1, v[i]); i = *itr + 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...