結果

問題 No.1605 Matrix Shape
ユーザー 👑 ygussanyygussany
提出日時 2021-07-16 21:29:52
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 540 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 28,820 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-20 13:03:33
合計ジャッジ時間 2,900 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 50 ms
4,376 KB
testcase_20 AC 41 ms
4,376 KB
testcase_21 AC 40 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 48 ms
4,376 KB
testcase_24 AC 47 ms
4,376 KB
testcase_25 AC 33 ms
4,380 KB
testcase_26 AC 34 ms
4,376 KB
testcase_27 AC 33 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 34 ms
4,376 KB
testcase_30 AC 41 ms
4,380 KB
testcase_31 AC 41 ms
4,376 KB
testcase_32 AC 39 ms
4,380 KB
testcase_33 WA -
testcase_34 AC 37 ms
4,376 KB
testcase_35 AC 37 ms
4,376 KB
testcase_36 AC 22 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, N, H, W, num[2][200001] = {}, ans = 0, count = 0;
	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		scanf("%d %d", &H, &W);
		num[0][H]++;
		num[1][W]++;
	}
	for (i = 1; i <= 200000; i++) {
		if (num[0][i] == num[1][i]) {
			if (num[0][i] > 0) count++;
			continue;
		} else if (abs(num[0][i] - num[1][i]) == 1) ans++;
		else {
			ans = -1;
			break;
		}
	}
	if (ans == 0) printf("%d\n", count);
	else if (ans == 2) printf("1\n");
	else printf("0\n");
	fflush(stdout);
	return 0;
}
0