QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#112459#6309. AqreFHQYWA 2ms3380kbC++201.5kb2023-06-11 20:38:482023-06-11 20:38:50

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-11 20:38:50]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3380kb
  • [2023-06-11 20:38:48]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define FOR(i,begin,end,delta) for(int i=begin;i<=end;i+=delta)
#define For(i,x) for(auto i:x)
#define fastios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define endl '\n'
#define rd(x) scanf("%lld",&x)
#define wc(x) putchar(x)
#define ws(x) printf("%s",x)
#define el puts("")
#define udm unordered_map<int,int>
#define inf 0x3f3f3f3f
#define set_inf(a) memset(&a,0x3f,sizeof(a))
#define set_0(a) memset(&a,0,sizeof(a))
#define set_unint(a) memset(&a,-1,sizeof(a))
using namespace std;
//define_var
const int M=2e5+9;
int mp[1009][1009];
//define_var
//function_begin
int read()
{
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
void write(int x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>9) write(x/10);
	putchar(x%10+'0');
}
//function_end
//solve_begin
void solve()
{
	int n,m;
	cin>>n>>m;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			mp[i][j]=0;
		}
	}
	for(int i=1;i<=n;i++)
	{
		int cnt=0;
		for(int j=i;j<i+m;j++)
		{
			int now=(j-1)%m+1;
			if(cnt==3)
				cnt=0;
			else
			{
				cnt++;
				mp[i][now]=1;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cout<<mp[i][j];
			if(j!=m)
				cout<<" ";
		}
		cout<<endl;
	}
}
//solve_end
//main_begin
signed main()
{
	fastios
	int T=1;
	cin>>T;
	while(T--)
		solve();
}
//main_end

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3380kb

input:

3
2 2
3 4
3 8

output:

4
1 1
1 1
9
1 1 1 0
0 1 1 1
1 0 1 1
18
1 1 1 0 1 1 1 0
0 1 1 1 0 1 1 1
1 0 1 1 1 0 1 1

result:

wrong answer Length must be equal to m (test case 1)