QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#298004#6309. AqrePlentyOfPenalty#Compile Error//Python31.1kb2024-01-05 15:34:262024-01-05 15:34:27

Judging History

你现在查看的是最新测评结果

  • [2024-01-05 15:34:27]
  • 评测
  • [2024-01-05 15:34:26]
  • 提交

answer

#include<bits/stdc++.h>
#define all(x) begin(x),end(x)
using namespace std;
const int N=1e3+9;
int T,n,m,fl,ans,sx,px,py,prt[N][N];
int main(){
#ifndef ONLINE_JUDGE
	//freopen(".in","r",stdin);
#endif
	cin.tie(0)->sync_with_stdio(0);
	cin>>T;
	while(T--){
		cin>>n>>m;
		if(n<=3&&m<=3){
			cout<<n*m<<"\n";
			for(int i=1;i<=n;++i){
				for(int j=1;j<=m;++j)cout<<1;
				cout<<"\n";
			}
			continue;
		}
		if(n>m)swap(n,m),fl=1;
		else fl=0;
		ans=n*m;
		if(n==3){
			for(int i=0;i<n;++i)for(int j=0;j<m;++j){
				if(((i==0||i==2)&&(j&3)==3)||(i==1&&(j&3)==1))--ans,prt[i][j]=0;
				else prt[i][j]=1;
			}
		}else{
if(m%4==0)swap(n,m),fl^=1;
			if(n==2||(n&3)==1)sx=2;
			else if(!(n&3))sx=0;
			else sx=1;
			for(int i=0;i<n;++i)for(int j=0;j<m;++j){
				px=(i+sx&3),py=(j&3);
				if((px==0&&py==0)||(px==1&&py==2)||(px==2&&py==3)||(px==3&&py==1))--ans,prt[i][j]=0;
				else prt[i][j]=1;
			}
		}
		cout<<ans<<"\n";
		if(fl)for(int i=0;i<m;++i,cout<<"\n")for(int j=0;j<n;++j)cout<<prt[j][i];
		else for(int i=0;i<n;++i,cout<<"\n")for(int j=0;j<m;++j)cout<<prt[i][j];
	}
}
/*
9
2 2
3 4
3 8
4 3
8 3
5 5
5 6
6 6
7 6
*/

Details

  File "answer.code", line 3
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax