Submission #1003966

#TimeUsernameProblemLanguageResultExecution timeMemory
1003966vjudge1Paint (COI20_paint)C++17
9 / 100
90 ms8016 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define pii pair<int,int> #define ff first #define ss second const int maxn = 1e3+5; int main(){ int n,m; cin >> n >> m; vector<int> a(m+1); for(int i=1; i<=m; i++) cin >> a[i]; set<int> st; vector<int> cor(m+1); for(int i=1; i<=m; i++) if(a[i]!=a[i-1]) st.insert(i), cor[i]=a[i]; int q; cin >> q; while(q--){ int fds,id,c; cin >> fds >> id >> c; auto ptr = prev(st.upper_bound(id)); cor[*ptr]=c; if(ptr!=st.begin() && cor[*prev(ptr)]==c) st.erase(ptr); auto ub = st.upper_bound(id); if(ub!=st.end() && cor[*ub]==c) st.erase(ub); } vector<int> ans(m+1,0); for(int x : st) ans[x]=cor[x]; for(int i=1; i<=m; i++){ if(!ans[i]) ans[i]=ans[i-1]; cout << ans[i] << " "; } cout << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...