結果
問題 | No.2692 How Many Times Reached? |
ユーザー | MM |
提出日時 | 2024-03-02 19:49:26 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 32 ms / 2,000 ms |
コード長 | 1,179 bytes |
コンパイル時間 | 264 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-09-29 16:26:14 |
合計ジャッジ時間 | 2,465 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
10,880 KB |
testcase_01 | AC | 25 ms
10,880 KB |
testcase_02 | AC | 26 ms
10,752 KB |
testcase_03 | AC | 26 ms
10,880 KB |
testcase_04 | AC | 26 ms
10,880 KB |
testcase_05 | AC | 25 ms
10,752 KB |
testcase_06 | AC | 25 ms
10,752 KB |
testcase_07 | AC | 25 ms
10,752 KB |
testcase_08 | AC | 25 ms
10,752 KB |
testcase_09 | AC | 25 ms
10,752 KB |
testcase_10 | AC | 25 ms
10,880 KB |
testcase_11 | AC | 25 ms
10,880 KB |
testcase_12 | AC | 25 ms
10,752 KB |
testcase_13 | AC | 25 ms
10,752 KB |
testcase_14 | AC | 25 ms
10,752 KB |
testcase_15 | AC | 25 ms
10,880 KB |
testcase_16 | AC | 25 ms
10,752 KB |
testcase_17 | AC | 25 ms
10,752 KB |
testcase_18 | AC | 24 ms
10,880 KB |
testcase_19 | AC | 25 ms
10,752 KB |
testcase_20 | AC | 25 ms
10,752 KB |
testcase_21 | AC | 24 ms
10,752 KB |
testcase_22 | AC | 25 ms
10,880 KB |
testcase_23 | AC | 24 ms
10,752 KB |
testcase_24 | AC | 24 ms
10,752 KB |
testcase_25 | AC | 26 ms
10,752 KB |
testcase_26 | AC | 25 ms
10,752 KB |
testcase_27 | AC | 25 ms
10,880 KB |
testcase_28 | AC | 26 ms
10,880 KB |
testcase_29 | AC | 26 ms
10,752 KB |
testcase_30 | AC | 27 ms
10,752 KB |
testcase_31 | AC | 24 ms
10,880 KB |
testcase_32 | AC | 25 ms
10,752 KB |
testcase_33 | AC | 26 ms
10,752 KB |
testcase_34 | AC | 30 ms
10,752 KB |
testcase_35 | AC | 26 ms
10,880 KB |
testcase_36 | AC | 27 ms
10,880 KB |
testcase_37 | AC | 30 ms
10,752 KB |
testcase_38 | AC | 31 ms
10,752 KB |
testcase_39 | AC | 32 ms
10,752 KB |
testcase_40 | AC | 28 ms
10,752 KB |
testcase_41 | AC | 29 ms
10,752 KB |
testcase_42 | AC | 31 ms
10,752 KB |
testcase_43 | AC | 30 ms
10,752 KB |
testcase_44 | AC | 30 ms
10,752 KB |
testcase_45 | AC | 25 ms
10,880 KB |
testcase_46 | AC | 31 ms
10,752 KB |
ソースコード
# Input N = int(input()) assert 2 <= N <= 100 v = [] for _ in range(N): s = input() assert len(s) == N v.append(s) assert len(v) == N # Solve ans = 0 a_num = b_num = 0 # Check rows + assert for i in range(N): a = b = 0 for j in range(N): if v[i][j] == 'A': a += 1 a_num += 1 elif v[i][j] == 'B': b += 1 b_num += 1 assert v[i][j] in ['A', 'B', '.'] if a == N-1 and b == 0: ans += 1 assert a < N assert b < N # Check columns for j in range(N): a = b = 0 for i in range(N): if v[i][j] == 'A': a += 1 elif v[i][j] == 'B': b += 1 if a == N-1 and b == 0: ans += 1 assert a < N assert b < N # Check diagonals a1 = a2 = b1 = b2 = 0 for i in range(N): if v[i][i] == 'A': a1 += 1 if v[i][i] == 'B': b1 += 1 if v[i][N-1-i] == 'A': a2 += 1 if v[i][N-1-i] == 'B': b2 += 1 if a1 == N-1 and b1 == 0: ans += 1 if a2 == N-1 and b2 == 0: ans += 1 # Asserts assert a1 < N and a2 < N and b1 < N and b2 < N assert a_num == b_num # Output assert ans > 0 print(ans)