結果

問題 No.1594 Three Classes
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-07-09 21:31:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-04-28 00:00:18
合計ジャッジ時間 5,368 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 425 ms
76,416 KB
testcase_01 AC 33 ms
51,840 KB
testcase_02 AC 33 ms
51,968 KB
testcase_03 AC 74 ms
76,160 KB
testcase_04 AC 416 ms
75,904 KB
testcase_05 AC 435 ms
76,160 KB
testcase_06 AC 48 ms
63,232 KB
testcase_07 AC 66 ms
76,032 KB
testcase_08 AC 412 ms
76,160 KB
testcase_09 AC 425 ms
76,160 KB
testcase_10 AC 420 ms
76,288 KB
testcase_11 AC 423 ms
75,904 KB
testcase_12 AC 418 ms
75,904 KB
testcase_13 AC 35 ms
51,968 KB
testcase_14 AC 107 ms
75,904 KB
testcase_15 AC 101 ms
76,032 KB
testcase_16 AC 82 ms
76,032 KB
testcase_17 AC 72 ms
75,904 KB
testcase_18 AC 34 ms
51,840 KB
testcase_19 AC 54 ms
69,504 KB
testcase_20 AC 63 ms
75,776 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