結果
| 問題 | No.1594 Three Classes | 
| コンテスト | |
| ユーザー |  aqua_tenhou | 
| 提出日時 | 2021-07-09 21:31:54 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 537 ms / 2,000 ms | 
| コード長 | 470 bytes | 
| コンパイル時間 | 204 ms | 
| コンパイル使用メモリ | 82,312 KB | 
| 実行使用メモリ | 76,288 KB | 
| 最終ジャッジ日時 | 2024-11-16 07:31:45 | 
| 合計ジャッジ時間 | 6,574 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 | 
ソースコード
n = int(input())
a = list(map(int,input().split()))
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
for i in range(3**n):
    c = [0]*n
    k = Base_10_to_n(i, 3)
    if len(k) < n:
        k = (n-len(k))*"0" + k
    
    abc = [0]*3
    for j in range(n):
        abc[int(k[j])] += a[j]
    if max(abc) == min(abc):
        print("Yes")
        exit()
print("No")
            
            
            
        