結果

問題 No.1594 Three Classes
ユーザー stngstng
提出日時 2021-07-18 11:59:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 485 ms / 2,000 ms
コード長 406 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 82,564 KB
実行使用メモリ 76,772 KB
最終ジャッジ日時 2024-04-28 00:40:35
合計ジャッジ時間 6,020 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 485 ms
76,544 KB
testcase_01 AC 35 ms
51,968 KB
testcase_02 AC 34 ms
51,840 KB
testcase_03 AC 88 ms
76,416 KB
testcase_04 AC 477 ms
76,712 KB
testcase_05 AC 467 ms
76,772 KB
testcase_06 AC 46 ms
62,848 KB
testcase_07 AC 82 ms
76,720 KB
testcase_08 AC 470 ms
76,640 KB
testcase_09 AC 467 ms
76,636 KB
testcase_10 AC 477 ms
76,488 KB
testcase_11 AC 461 ms
76,640 KB
testcase_12 AC 469 ms
76,508 KB
testcase_13 AC 36 ms
52,096 KB
testcase_14 AC 120 ms
76,416 KB
testcase_15 AC 120 ms
76,544 KB
testcase_16 AC 94 ms
76,288 KB
testcase_17 AC 96 ms
76,416 KB
testcase_18 AC 35 ms
51,840 KB
testcase_19 AC 64 ms
71,168 KB
testcase_20 AC 83 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
e = [int(i) for i in input().split()]

def base10to(n, b):
    if (int(n/b)):
        return base10to(int(n/b), b) + str(n%b)
    return str(n%b)

num = 3**n

for i in range(num):
    tmp = str(base10to(i,3)).zfill(n)
    p = [0]*3
    for j in range(n):
        p[int(tmp[j])] += e[j]
    #print(p,tmp)
    if p[0] == p[1] == p[2]:
        print("Yes")
        exit()
        
print("No")
0