結果
問題 | No.1605 Matrix Shape |
ユーザー | trineutron |
提出日時 | 2021-07-16 21:44:01 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 674 bytes |
コンパイル時間 | 185 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 15,616 KB |
最終ジャッジ日時 | 2024-07-06 08:44:46 |
合計ジャッジ時間 | 18,700 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 160 ms
15,488 KB |
testcase_01 | AC | 155 ms
15,488 KB |
testcase_02 | AC | 157 ms
15,488 KB |
testcase_03 | AC | 155 ms
15,360 KB |
testcase_04 | WA | - |
testcase_05 | AC | 156 ms
15,488 KB |
testcase_06 | AC | 159 ms
15,360 KB |
testcase_07 | AC | 155 ms
15,488 KB |
testcase_08 | AC | 160 ms
15,360 KB |
testcase_09 | AC | 173 ms
15,360 KB |
testcase_10 | AC | 153 ms
15,360 KB |
testcase_11 | AC | 36 ms
15,488 KB |
testcase_12 | AC | 157 ms
15,488 KB |
testcase_13 | AC | 154 ms
15,360 KB |
testcase_14 | AC | 157 ms
15,488 KB |
testcase_15 | AC | 158 ms
15,360 KB |
testcase_16 | AC | 154 ms
15,488 KB |
testcase_17 | AC | 37 ms
15,360 KB |
testcase_18 | AC | 37 ms
15,360 KB |
testcase_19 | AC | 860 ms
15,488 KB |
testcase_20 | AC | 859 ms
15,360 KB |
testcase_21 | AC | 826 ms
15,360 KB |
testcase_22 | WA | - |
testcase_23 | AC | 859 ms
15,488 KB |
testcase_24 | AC | 850 ms
15,360 KB |
testcase_25 | AC | 845 ms
15,488 KB |
testcase_26 | AC | 831 ms
15,488 KB |
testcase_27 | AC | 836 ms
15,360 KB |
testcase_28 | AC | 713 ms
15,360 KB |
testcase_29 | AC | 833 ms
15,360 KB |
testcase_30 | AC | 862 ms
15,488 KB |
testcase_31 | AC | 840 ms
15,488 KB |
testcase_32 | AC | 824 ms
15,360 KB |
testcase_33 | WA | - |
testcase_34 | AC | 792 ms
15,360 KB |
testcase_35 | AC | 728 ms
15,488 KB |
testcase_36 | AC | 389 ms
15,488 KB |
ソースコード
n = int(input()) count_h = [0] * 200000 count_w = [0] * 200000 loop = [0] * 200000 for i in range(n): h, w = map(int, input().split()) h -= 1 w -= 1 if h == w: loop[h] += 1 else: count_h[h] += 1 count_w[w] += 1 ans = 0 diff = [] for i in range(200000): if abs(count_h[i] - count_w[i]) > 1: print(0) exit() elif count_h[i] == 0 and count_w[i] == 0 and loop[i] != 0 and loop[i] != n: print(0) exit() elif count_h[i] != count_w[i]: diff.append(i) elif count_h[i] or loop[i]: ans += 1 if len(diff) > 2: print(0) exit() if diff: print(1) else: print(ans)