제출 #774681

#제출 시각아이디문제언어결과실행 시간메모리
774681vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define dbg(x) cout << (#x) << " = " << x << endl const ll maxn = 2e5 + 69; ll a[maxn],b[maxn],n; map<ll,ll> cnt; int main(){ cin >> n; for(int i = 1;i<=n;i++){ cin >> a[i]; cnt[a[i]]++; } ll pt = n; while(pt > 0){ //dbg(pt); //dbg(cnt[a[pt]]); if(cnt[a[pt]] >= 2){ b[pt] = a[pt]; ll temp = pt; pt--; while(a[pt] != a[temp]){ cnt[a[pt]]--; b[pt] = a[temp]; pt--; } b[pt] = a[temp]; pt--; }else if(cnt[a[pt]] == 1){ b[pt] = a[pt]; pt--; }else pt--; } cout << "bruh" << endl; for(int i = 1;i<=n;i++) cout << b[i] << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...