제출 #774698

#제출 시각아이디문제언어결과실행 시간메모리
774698vjudge1Stone Arranging 2 (JOI23_ho_t1)C++17
25 / 100
1 ms468 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long int a[2001], b[2001]; map<int,int> mp; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=1; i<=n; i++){ cin>>a[i]; mp[a[i]]++; } for(int i=1; i<=n; i++){ b[i]=a[i]; if(mp[a[i]]>=2){ int j=i; i++; while(a[i]!=a[j]){ b[i]=a[j]; mp[a[i]]--; i++; } b[i]=a[i]; i--; mp[a[j]]-=1; } } for(int i=1; i<=n; i++){ cout<<b[i]<<" "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...