제출 #990258

#제출 시각아이디문제언어결과실행 시간메모리
990258thelegendary08Stone Arranging 2 (JOI23_ho_t1)C++14
60 / 100
25 ms5208 KiB
#include<bits/stdc++.h> #define pb push_back #define ll long long int #define vi vector<int> #define vvi vector<vector<int>> #define vll vector<long long int> #define vvll vector<vector<long long int>> #define pii pair<int, int> #define vpii vector<pair<int, int>> #define vc vector<char> #define vvc vector<vector<char>> #define vb vector<bool> #define mii map<int,int> #define mll map<long long int, long long int> #define mivi map<int,vector<int>> #define f0r(i,n) for(int i=0;i<n;i++) #define FOR(i,k,n) for(int i=k;i<n;i++) using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); //ifstream cin(".in"); //ofstream cout(".out"); int n; cin>>n; vi v(n); f0r(i,n){ cin>>v[i]; } if(n > 2000){ int l = -1; for(int i = n-1;i>=0;i--){ if(v[i] == v[0]){ l =i; break; } } if(l == -1){ f0r(i,n)cout<<v[i]<<'\n'; } else{ f0r(i, l)cout<<v[0]<<'\n'; FOR(i, l, n)cout<<v[i]<<'\n'; } } else{ vi ans(n); f0r(i,n){ ans[i] = v[i]; f0r(j, i){ if(ans[j] == ans[i]){ for(int k = j; k<i;k++)ans[k] = ans[i]; break; } } } f0r(i,n)cout<<ans[i]<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...