제출 #897155

#제출 시각아이디문제언어결과실행 시간메모리
897155belgianbotStone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
74 ms4748 KiB
#include <bits/stdc++.h> using namespace std; vector <int> ans; vector<int> t; struct stone{ int a, index; bool operator< (const stone &b) const{ return (a < b.a || (a == b.a && index < b.index)); } bool operator> (const stone &b) const{ return (a > b.a || (a == b.a && index >= b.index)); } }; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; t.resize(N); vector <stone> sorted(N); for (int i(0); i < N; i++) { cin >> t[i]; sorted[i] = {t[i], i}; } sort(sorted.begin(), sorted.end()); for (int i(0); i < N; i++) { stone b = {t[i], N}; int a = sorted[distance(sorted.begin(), upper_bound(sorted.begin(), sorted.end(), b)) - 1].index; for (; i <= a; i++) cout << t[a] << '\n'; i--; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...