本题解是「QFOI R3」难度评分的官方题解。
按题意模拟即可。
用数组动态维护每道题目的难度。读入一个工单时,若状态为 Completed,就将该题目的难度进行相应修改。最后输出每道题的难度。
时间复杂度 。
//By: OIer rui_er
#include <bits/stdc++.h>
#define rep(x, y, z) for(int x = (y); x <= (z); ++x)
#define per(x, y, z) for(int x = (y); x >= (z); --x)
using namespace std;
const int N = 1e5 + 5;
int n, m, r[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n >> m;
rep(i, 1, n) cin >> r[i];
while(m--) {
int p, d; string s;
cin >> p >> d >> s;
if(s == "Completed") r[p] = d;
}
rep(i, 1, n) cout << r[i] << " \n"[i == n];
return 0;
}