题解:P14913 「QFOI R3」难度评分
思路
根据题意直接模拟即可。
来一个公单:
- 已完成:直接把难度换成 。
- 已关闭:直接
continue。
代码
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;
int n,m;
int a[N];//每道题的难度
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
}
//根据题意模拟
while(m--){
int p,d;
string c;
cin>>p>>d>>c;
if(c=="Closed"){
continue;//被关了就跳过
}else{
a[p]=d;//否则就输出
}
}
for(int i=1;i<=n;i++){
cout<<a[i]<<" ";
}
return 0;
}