제출 #897149

#제출 시각아이디문제언어결과실행 시간메모리
897149NonozeStone Arranging 2 (JOI23_ho_t1)C++17
100 / 100
376 ms21188 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define sz(x) (int)(x.size()) int n, k, m; vector<int> a; void solve() { cin >> n; a.clear(); a.resize(n); map<int, int> vaut; for (auto &u: a) cin >> u; vector<int> temp=a; vector<int> ancien=a; sort(temp.begin(), temp.end()); vaut[temp[0]]=0; int vv=0; for (int i=1; i<n; i++) { if (temp[i]!=temp[i-1]) vv++; vaut[temp[i]]=vv; } vector<int> apparition(n+1, -1); for (int i=0; i<n; i++) { a[i]=vaut[a[i]]; apparition[a[i]]=i; } for (int i=0; i<n; i++) { int ct=ancien[i]; int temp=apparition[a[i]]; for (; i<temp; i++) { cout << ct << endl; } cout << ct << endl; } return; } signed main() { ios::sync_with_stdio(0); cin.tie(0); solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...