結果
問題 | No.1225 I hate I hate Matrix Construction |
ユーザー | brthyyjp |
提出日時 | 2020-09-11 21:47:52 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,480 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 71,296 KB |
最終ジャッジ日時 | 2024-06-08 09:26:03 |
合計ジャッジ時間 | 3,273 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
52,224 KB |
testcase_01 | AC | 38 ms
52,096 KB |
testcase_02 | AC | 40 ms
52,224 KB |
testcase_03 | RE | - |
testcase_04 | AC | 52 ms
63,488 KB |
testcase_05 | AC | 47 ms
61,056 KB |
testcase_06 | AC | 51 ms
62,592 KB |
testcase_07 | RE | - |
testcase_08 | AC | 48 ms
61,568 KB |
testcase_09 | AC | 52 ms
63,488 KB |
testcase_10 | AC | 50 ms
62,208 KB |
testcase_11 | AC | 52 ms
63,360 KB |
testcase_12 | AC | 53 ms
63,488 KB |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | AC | 53 ms
62,208 KB |
testcase_16 | AC | 50 ms
61,952 KB |
testcase_17 | AC | 53 ms
62,848 KB |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | AC | 49 ms
61,952 KB |
testcase_25 | AC | 50 ms
62,848 KB |
testcase_26 | AC | 50 ms
61,824 KB |
testcase_27 | AC | 43 ms
52,096 KB |
testcase_28 | AC | 53 ms
63,744 KB |
testcase_29 | AC | 57 ms
62,976 KB |
testcase_30 | AC | 59 ms
63,872 KB |
testcase_31 | AC | 55 ms
64,896 KB |
testcase_32 | AC | 58 ms
65,664 KB |
testcase_33 | AC | 52 ms
63,488 KB |
testcase_34 | AC | 60 ms
66,048 KB |
testcase_35 | AC | 60 ms
66,432 KB |
testcase_36 | AC | 53 ms
64,000 KB |
ソースコード
n = int(input()) S = list(map(int, input().split())) T = list(map(int, input().split())) ds = [set() for i in range(3)] dt = [set() for i in range(3)] for i, s in enumerate(S): ds[s].add(i) for i, t in enumerate(T): dt[t].add(i) A = [[0]*n for _ in range(n)] for i in ds[2]: for j in range(n): A[i][j] = 1 for j in dt[2]: for i in range(n): A[i][j] = 1 for i in ds[1]: cnt = 0 for j in range(n): if A[i][j] == 1: cnt += 1 if cnt == 0: for j in range(n): if j not in dt[0] and j in dt[1]: A[i][j] = 1 dt[1].remove(j) break else: for j in range(n): if j not in ds[0]: if A[i][j] == 0: A[i][j] = 1 break #ds[1].remove(i) for j in dt[1]: cnt = 0 for i in range(n): if A[i][j] == 1: cnt += 1 if cnt == 0: for i in range(n): #if i not in ds[0] and i in ds[1]: if i not in ds[0] and A[i][j] == 0: A[i][j] = 1 ds[1].remove(i) break else: for i in range(n): if i not in ds[0]: if A[i][j] == 0: A[i][j] = 1 break #dt[1].remove(j) #print(A) ans = 0 for i in range(n): for j in range(n): ans += A[i][j] print(ans)