제출 #774710

#제출 시각아이디문제언어결과실행 시간메모리
774710vjudge1Stone Arranging 2 (JOI23_ho_t1)C++14
100 / 100
146 ms12552 KiB
#include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> //#define int long long #define f first #define s second #define pii pair<int,int> #define piii pair<int,pair<int,int>> #define vii vector<vector<int>> #define vi vector<int> #define cd complex<double> #define endl '\n' //#define multipletest using namespace std; const int LIM=2e5; const string name="template"; int n,m,q; int a[LIM+5]; map<int,int> mp; int t[LIM+5]; int cnt[LIM+5]; void solve(){ //CODE GOES HERE cin>>n; for(int i=1;i<=n;++i){ cin>>a[i]; } for(int i=1;i<=n;++i){ mp[a[i]]=i; } int i=1; while(i<=n){ int j=i; int r=mp[a[i]]; while(j<=r){ a[j] = a[i]; j++; } i=j; } for(int i=1;i<=n;++i){ cout<<a[i]<<endl; } } signed main(){ // freopen((name+".inp").c_str(),"r",stdin); // freopen((name+".out").c_str(),"w",stdout); // ifstream cin(".txt"); // ofstream cout(".txt"); //ifstream cin((name +".inp")); //ofstream cout((name +".ans")); ios_base::sync_with_stdio(false); cin.tie(NULL); int test; test=1; #ifdef multipletest cin>>test; #endif while(test--){ solve(); #ifdef DEBUG cerr << "Runtime is: " << clock() * 1.0 / CLOCKS_PER_SEC << endl; #endif } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...