95分,#6超时没过。其余居然在我希望拿部分分的情况下过了?!
因我本来就菜,这种比赛只希望拿部分分。希望大佬理解。
放代码:
#include <bits/stdc++.h>
using namespace std;
int T,n,m,q,i,opt,x,c,j,temp[1001][2001];
void clean(int n,int m){
int i,j;
for(i=1;i<=n;i++)
for(j=1;j<=m;j++)
temp[i][j]=0;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);//输入输出加速
cin>>T;//输入数据组数
while(T--){
cin>>n>>m>>q;
for(i=1;i<=q;i++){//q次操作
cin>>opt>>x>>c;
if(opt==0)
for(j=1;j<=m;j++) temp[x][j]=c;//如果opt=0,当前行涂色
else
for(j=1;j<=n;j++) temp[j][x]=c;//如果opt=1,当前列涂色
}
for(i=1;i<=n;i++){//输出
for(j=1;j<=m;j++)
cout<<temp[i][j]<<" ";
cout<<"\n";
}
clean(n,m);//数据千万条,清空第一条。
}
}