QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223487#6743. water235luanmenglei#WA 1ms3532kbC++171.1kb2023-10-22 10:17:432023-10-22 10:17:43

Judging History

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

  • [2023-10-22 10:17:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3532kb
  • [2023-10-22 10:17:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

void debug(const char *msg, ...) {
#ifdef CLESIP
    va_list arg;
    static char pbString[512];
    va_start(arg,msg);
    vsprintf(pbString,msg,arg);
    cerr << "[DEBUG] " << pbString << "\n";
    va_end(arg);
#endif    
}

#define PASSED debug("PASSED (%s) LINE #%s", __FUNCTION__, __LINE__)

using i64 = long long;
using i128 = __int128_t;
template <typename T, typename L> void chkmax(T &x, L y) { if (x < y) x = y; }
template <typename T, typename L> void chkmin(T &x, L y) { if (x > y) x = y; }

void solve() {
	int n, m; cin >> n >> m;
	vector<vector<int>> ans(n + 1, vector<int>(m + 1));

	ans[1][1] = 1;
	int cnt = 1;
	for (int i = (m % 2 + 2); i <= m; i += 2)
		ans[1][i] = 1, ++ cnt;	
	for (int i = (n % 2 + 2); i <= n; i += 2)
		ans[i][1] = 1, ++ cnt;
	
	cout << cnt << "\n";
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= m; j ++)
			cout << ans[i][j] << " \n"[j == m];
}

signed main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 1

output:

2
1
1

result:

ok The answer is correct.

Test #2:

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

input:

3 3

output:

3
1 0 1
0 0 0
1 0 0

result:

ok The answer is correct.

Test #3:

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

input:

1 4

output:

3
1 1 0 1

result:

ok The answer is correct.

Test #4:

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

input:

2 2

output:

3
1 1
1 0

result:

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