Submission #918767

#TimeUsernameProblemLanguageResultExecution timeMemory
918767XXBabaProBerkayStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
262 ms27212 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second using ll = long long; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; vector<int> A(N + 1); map<int, vector<int>> mp; for (int i = 1; i <= N; i++) { cin >> A[i]; mp[A[i]].push_back(i); } for (int i = 1; i <= N; i++) { auto it = upper_bound(mp[A[i]].begin(), mp[A[i]].end(), i); if (it == mp[A[i]].end()) cout << A[i] << '\n'; else { for (int j = i; j < *it; j++) cout << A[i] << '\n'; i = *it - 1; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...