結果
問題 | No.2112 All 2x2 are Equal |
ユーザー |
![]() |
提出日時 | 2022-10-28 21:52:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 100 ms / 2,000 ms |
コード長 | 650 bytes |
コンパイル時間 | 2,066 ms |
コンパイル使用メモリ | 192,084 KB |
最終ジャッジ日時 | 2025-02-08 14:23:23 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d", &N, &M); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>int N, M;int A[1010][1010];int main() {scanf("%d%d", &N, &M);int low = 1, high = N * M;for (int i = 0; i < N; ++i) {for (int j = 0; j < M; ++j) {if (i + j & 1) A[i][j] = low++;else A[i][j] = high--;}}for (int i = 0; i < N - 1; ++i)for (int j = 0; j < M - 1; ++j)if (A[i][j] + A[i + 1][j] + A[i][j + 1] + A[i + 1][j + 1] != A[0][0] + A[0][1] + A[1][0] + A[1][1]) {puts("Boom");}puts("Yes");for (int i = 0; i < N; ++i) for (int j = 0; j < M; ++j) printf("%d%c", A[i][j], " \n"[j + 1 == M]);}