結果
問題 | No.1594 Three Classes |
ユーザー |
![]() |
提出日時 | 2021-07-10 18:49:57 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,069 ms / 2,000 ms |
コード長 | 753 bytes |
コンパイル時間 | 157 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 77,852 KB |
最終ジャッジ日時 | 2024-11-16 08:27:51 |
合計ジャッジ時間 | 12,414 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
n = int(input()) e = list(map(int, input().split())) def Base_10_to_n(X, n): if (int(X/n)): return Base_10_to_n(int(X/n), n)+str(X%n) return str(X%n) for i in range(3 ** n): x = list(Base_10_to_n(i, 3)) a = [] b = [] c = [] for j, k in enumerate(x): if k == '0': a.append(e[j]) elif k == '1': b.append(e[j]) else: c.append(e[j]) for j in range(n - len(x)): a.append(e[-(j + 1)]) # check = [] # check.append(a) # check.append(b) # check.append(c) # print(check) if not a or not b or not c: continue else: if sum(a) == sum(b) and sum(b) == sum(c): print('Yes') exit() print('No')