結果
問題 | No.2102 [Cherry Alpha *] Conditional Reflection |
ユーザー | Akijin_007 |
提出日時 | 2022-10-14 22:58:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,114 ms / 3,000 ms |
コード長 | 1,682 bytes |
コンパイル時間 | 560 ms |
コンパイル使用メモリ | 82,372 KB |
実行使用メモリ | 284,052 KB |
最終ジャッジ日時 | 2024-06-26 16:47:11 |
合計ジャッジ時間 | 53,085 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,096 KB |
testcase_01 | AC | 38 ms
52,352 KB |
testcase_02 | AC | 711 ms
166,184 KB |
testcase_03 | AC | 770 ms
194,524 KB |
testcase_04 | AC | 757 ms
167,364 KB |
testcase_05 | AC | 663 ms
132,032 KB |
testcase_06 | AC | 831 ms
175,380 KB |
testcase_07 | AC | 398 ms
172,576 KB |
testcase_08 | AC | 378 ms
97,316 KB |
testcase_09 | AC | 621 ms
187,240 KB |
testcase_10 | AC | 492 ms
113,716 KB |
testcase_11 | AC | 386 ms
119,932 KB |
testcase_12 | AC | 611 ms
157,564 KB |
testcase_13 | AC | 770 ms
212,744 KB |
testcase_14 | AC | 838 ms
151,580 KB |
testcase_15 | AC | 968 ms
183,572 KB |
testcase_16 | AC | 1,030 ms
235,992 KB |
testcase_17 | AC | 325 ms
141,016 KB |
testcase_18 | AC | 569 ms
192,592 KB |
testcase_19 | AC | 578 ms
131,752 KB |
testcase_20 | AC | 863 ms
226,460 KB |
testcase_21 | AC | 558 ms
115,004 KB |
testcase_22 | AC | 1,049 ms
254,912 KB |
testcase_23 | AC | 991 ms
253,492 KB |
testcase_24 | AC | 1,005 ms
253,012 KB |
testcase_25 | AC | 989 ms
255,632 KB |
testcase_26 | AC | 1,039 ms
253,944 KB |
testcase_27 | AC | 996 ms
255,380 KB |
testcase_28 | AC | 988 ms
254,840 KB |
testcase_29 | AC | 998 ms
254,896 KB |
testcase_30 | AC | 996 ms
254,892 KB |
testcase_31 | AC | 1,114 ms
255,308 KB |
testcase_32 | AC | 1,049 ms
252,304 KB |
testcase_33 | AC | 1,028 ms
252,560 KB |
testcase_34 | AC | 1,010 ms
253,840 KB |
testcase_35 | AC | 1,091 ms
254,748 KB |
testcase_36 | AC | 1,034 ms
255,124 KB |
testcase_37 | AC | 1,034 ms
252,752 KB |
testcase_38 | AC | 1,002 ms
253,300 KB |
testcase_39 | AC | 1,042 ms
254,816 KB |
testcase_40 | AC | 1,042 ms
252,928 KB |
testcase_41 | AC | 1,050 ms
252,940 KB |
testcase_42 | AC | 1,028 ms
117,768 KB |
testcase_43 | AC | 1,110 ms
118,404 KB |
testcase_44 | AC | 1,070 ms
118,532 KB |
testcase_45 | AC | 1,059 ms
118,096 KB |
testcase_46 | AC | 1,046 ms
118,352 KB |
testcase_47 | AC | 448 ms
188,256 KB |
testcase_48 | AC | 479 ms
188,900 KB |
testcase_49 | AC | 462 ms
187,096 KB |
testcase_50 | AC | 458 ms
186,988 KB |
testcase_51 | AC | 443 ms
188,508 KB |
testcase_52 | AC | 269 ms
168,996 KB |
testcase_53 | AC | 264 ms
170,052 KB |
testcase_54 | AC | 266 ms
169,636 KB |
testcase_55 | AC | 277 ms
148,736 KB |
testcase_56 | AC | 274 ms
148,660 KB |
testcase_57 | AC | 276 ms
149,120 KB |
testcase_58 | AC | 278 ms
161,636 KB |
testcase_59 | AC | 1,048 ms
284,052 KB |
testcase_60 | AC | 324 ms
94,732 KB |
testcase_61 | AC | 286 ms
148,620 KB |
testcase_62 | AC | 237 ms
79,620 KB |
testcase_63 | AC | 356 ms
85,896 KB |
testcase_64 | AC | 445 ms
86,780 KB |
testcase_65 | AC | 561 ms
87,824 KB |
testcase_66 | AC | 784 ms
120,708 KB |
testcase_67 | AC | 544 ms
97,268 KB |
testcase_68 | AC | 294 ms
98,420 KB |
testcase_69 | AC | 541 ms
111,480 KB |
ソースコード
#int(input()) #map(int, input().split()) #list(map(int, input().split())) N = int(input()) S = [0] * N for i in range(N): S[i] = input() d = dict() ans = [0] * N def check(x, y): if len(x) != len(y): return 0 dif = [] for i in range(len(x)): if x[i] != y[i]: dif.append(i) if len(dif) == 0: return 1 elif len(dif) == 2: u = dif[0] v = dif[1] if u + 1 == v and x[u] == y[v] and x[v] == y[u]: return 1 else: return 0 else: return 0 for i in range(N): a = [] u, v = divmod(len(S[i]), 2) u += v for j in range(u): s = S[i][2*j:2*j+2] if len(s) == 1: a.append(s) continue if s[0] < s[1]: a.append(s) else: a.append(s[1] + s[0]) t = tuple(a) if t not in d: d[t] = [i] else: for x in d[t]: if check(S[i], S[x]): ans[i] = 1 break d[t].append(i) d = dict() for i in range(N): a = [S[i][0]] u, v = divmod(len(S[i]), 2) for j in range(u): s = S[i][2*j+1:2*j+3] if len(s) == 1: a.append(s) continue if s[0] < s[1]: a.append(s) else: a.append(s[1] + s[0]) t = tuple(a) if t not in d: d[t] = [i] else: if ans[i] != 1: for x in d[t]: if check(S[i], S[x]): ans[i] = 1 break d[t].append(i) # print(d) for i in range(N): if ans[i] == 1: print("Yes") else: print("No")