제출 #774639

#제출 시각아이디문제언어결과실행 시간메모리
774639giaminh2211Financial Report (JOI21_financial)C++14
0 / 100
25 ms13888 KiB
#include<bits/stdc++.h> #define fn(n) for(int i=1; i<=n; i++) using namespace std; using ll=long long; int n; int a[200002]; vector<int> pos[200002]; void nhap(){ cin >> n; for(int i=1; i<=n; i++){ cin >> a[i]; } } void solve(){ for(int i=1; i<=n; i++){ if(pos[a[i]].size()!=0){ for(int j=i-1; j>pos[a[i]].back(); j--){ a[j]=a[i]; if(pos[j].size() && j==pos[j].back()){ pos[j].pop_back(); } } } pos[a[i]].push_back(i); } for(int i=1; i<=n; i++){ cout << a[i] << ' '; } cout << '\n'; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); nhap(); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...