結果

問題 No.1594 Three Classes
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-07-09 21:31:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 544 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 87,292 KB
実行使用メモリ 77,724 KB
最終ジャッジ日時 2023-08-10 06:41:48
合計ジャッジ時間 7,381 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 537 ms
77,688 KB
testcase_01 AC 70 ms
71,172 KB
testcase_02 AC 70 ms
71,312 KB
testcase_03 AC 104 ms
77,460 KB
testcase_04 AC 538 ms
77,596 KB
testcase_05 AC 541 ms
77,500 KB
testcase_06 AC 81 ms
77,036 KB
testcase_07 AC 93 ms
77,572 KB
testcase_08 AC 524 ms
77,724 KB
testcase_09 AC 535 ms
77,520 KB
testcase_10 AC 540 ms
77,576 KB
testcase_11 AC 539 ms
77,528 KB
testcase_12 AC 544 ms
77,508 KB
testcase_13 AC 70 ms
71,312 KB
testcase_14 AC 146 ms
77,496 KB
testcase_15 AC 135 ms
77,524 KB
testcase_16 AC 112 ms
77,588 KB
testcase_17 AC 101 ms
77,652 KB
testcase_18 AC 68 ms
71,476 KB
testcase_19 AC 87 ms
77,064 KB
testcase_20 AC 88 ms
77,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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")

0