求助,45分,5个点TLE6个RE,有没有大佬知道怎么优化的?
查看原帖
求助,45分,5个点TLE6个RE,有没有大佬知道怎么优化的?
608869
wnc0123456789楼主2023/6/30 13:30

代码在这里:

#include<bits/stdc++.h>
using namespace std;
const int N=10010;
int t,n,m,q,x,c;
bool opt;
int a[N][N];
int main(){
    cin>>t;
    while(t--){
        memset(a,0,sizeof(a));
        cin>>n>>m>>q;
        while(q--){
            cin>>opt>>x>>c;
            for(int i=1;i<=n;i++){
                for(int j=1;j<=m;j++){
                    if(opt==0){
                        a[x][j]=c;
                    }
                    if(opt==1){
                        a[i][x]=c;
                    }
                }
            }
        }
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                cout<<a[i][j]<<" ";
            }
            cout<<endl;
        }
    }
    return 0;
}
2023/6/30 13:30
加载中...