제출 #1311839

#제출 시각아이디문제언어결과실행 시간메모리
1311839vtnooStone Arranging 2 (JOI23_ho_t1)C++20
0 / 100
1 ms568 KiB
#include <bits/stdc++.h> #define L(i, j, k) for(int i = (j); i <= (k); i++) #define R(i, j, k) for(int i = (j); i >= (k); i--) #define ll long long #define sz(a) ((int) a.size()) #define all(a) a.begin(), a.end() #define vi vector<ll> #define pb emplace_back #define me(a, x) memset(a, x, sizeof(a)) #define fst first #define snd second #define ii pair<ll, ll> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n;cin>>n; vi a(n); L(i,0,n-1)cin>>a[i]; map<int,vi>id; //~ cout<<"PASS"<<endl; L(i,0,n-1){ //~ cout<<"PASS"<<endl; //~ cout<<i<<" "; if(sz(id[a[i]])>=1){ int idx=id[a[i]].back(); R(j,i-1,idx){ id[a[j]].pop_back(); a[j]=a[i]; } } id[a[i]].pb(i); } L(i,0,n-1)cout<<a[i]<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...