QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#140956#6743. water235cciafrino#WA 1ms3512kbC++20707b2023-08-17 01:18:222023-08-17 01:18:23

Judging History

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

  • [2023-08-17 01:18:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3512kb
  • [2023-08-17 01:18:22]
  • 提交

answer

#include<bits/stdc++.h>

int main() {
	using namespace std;
	cin.tie(nullptr)->sync_with_stdio(false);
	int N, M; cin >> N >> M;

	vector<vector<int>> A(N, vector<int>(M));

	if (N < M) {
		A[0][M-1] = 1;
		for (int i = 0; i < N; ++i) A[i][i] = 1;
		for (int i = 0; i < M-N-1; ++i) A[0][i+N+1] = (i % 2 == 0);
	} else {
		A[N-1][0] = (N > M);
		for (int i = 0; i < M; ++i) A[i][i] = 1;
		for (int i = 0; i < N-M-1; ++i) A[i+M+1][0] = (i % 2 == 0);
	}

	int S = 0;
	for (int i = 0; i < N; ++i) S += accumulate(A[i].begin(), A[i].end(), 0);

	cout << S << '\n';
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			cout << A[i][j] << ' ';
		}
		cout << '\n';
	}
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3484kb

input:

2 1

output:

2
1 
1 

result:

ok The answer is correct.

Test #2:

score: 0
Accepted
time: 0ms
memory: 3512kb

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: 3420kb

input:

1 4

output:

2
1 0 1 0 

result:

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