QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#362762#6743. water235afyWA 1ms3760kbC++141.1kb2024-03-23 17:01:342024-03-23 17:01:36

Judging History

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

  • [2024-03-23 17:01:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3760kb
  • [2024-03-23 17:01:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
//# define int long long
#define ull unsigned long long
#define pii pair<int,int>

#define baoliu(x, y) cout << fixed << setprecision(y) << x
#define endl  "\n"
#define debug1(x) cerr<<x<<" "
#define  debug2(x) cerr<<x<<endl
const int N =1e3 + 10;
const int M = 1e6 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const double eps = 1e-8;
int n, m;


void solve(){
	cin>>n>>m;
	vector<vector<int>>a(n+1,vector<int>(m+1,0));
	int ans=min(n,m)+(n-m+1)/2;
	//最后是奇数列的话会导致必须还加一个水
	//构造:初始一个对角线,然后底部每两列放一个
	for(int i=1;i<=min(n,m);i++)a[i][i]=1;
	if(n<=m){
		for(int i=m;i>min(n,m);i-=2)a[n][i]=1;
	}
	else {
		for(int i=n;i>min(n,m);i-=2)a[i][m]=1;
	}
	cout<<ans<<endl;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
}
int main() {
    cin.tie(0);
    
    ios::sync_with_stdio(false);

    int t;
   //cin>>t;
     t=1;
    while (t--) {
solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3760kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

3 3

output:

3
1 0 0 
0 1 0 
0 0 1 

result:

ok The answer is correct.

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3608kb

input:

1 4

output:

0
1 1 0 1 

result:

wrong answer The answer is wrong: expected = 3, found = 0