結果

問題 No.1594 Three Classes
ユーザー Ain48803949Ain48803949
提出日時 2021-07-09 21:48:48
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 1,071 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 10,324 KB
最終ジャッジ日時 2023-08-10 06:50:03
合計ジャッジ時間 6,257 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 306 ms
10,224 KB
testcase_01 AC 33 ms
10,076 KB
testcase_02 AC 33 ms
10,124 KB
testcase_03 AC 289 ms
10,192 KB
testcase_04 AC 304 ms
10,284 KB
testcase_05 AC 303 ms
10,208 KB
testcase_06 AC 294 ms
10,272 KB
testcase_07 AC 289 ms
10,220 KB
testcase_08 AC 305 ms
10,288 KB
testcase_09 AC 303 ms
10,236 KB
testcase_10 AC 304 ms
10,124 KB
testcase_11 AC 306 ms
10,324 KB
testcase_12 AC 303 ms
10,124 KB
testcase_13 AC 33 ms
10,152 KB
testcase_14 AC 304 ms
10,268 KB
testcase_15 AC 306 ms
10,128 KB
testcase_16 AC 123 ms
10,184 KB
testcase_17 AC 306 ms
10,212 KB
testcase_18 AC 34 ms
10,264 KB
testcase_19 AC 34 ms
10,128 KB
testcase_20 AC 43 ms
10,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect,collections,copy,heapq,itertools,math,string,sys,queue,time,random
input = lambda: sys.stdin.readline().rstrip()
def I(): return input()
def IS(): return input().split()
def II(): return int(input())
def IIS(): return map(int,input().split())
def LIIS(): return list(map(int,input().split()))
def Base_n_to_10(X,n):
    out = 0
    for i in range(1,len(str(X))+1):
        out += int(X[-i])*(n**(i-1))
    return out#int out
def Base_10_to_n(X, n):
    if (X//n):
        return Base_10_to_n(X//n, n)+str(X%n)
    return str(X%n)
INF=10**18
MOD=10**9+7
sys.setrecursionlimit(10**8)
##############################################################################
n=II()
E=LIIS()
ans=0
def solve(nm,li):
    if nm==n:
        global ans
        if sum(li[0])==sum(li[1])==sum(li[2]):
            ans=1
        return
    li[0].append(E[nm])
    solve(nm+1,li)
    li[0].pop()
    li[1].append(E[nm])
    solve(nm+1,li)
    li[1].pop()
    li[2].append(E[nm])
    solve(nm+1,li)
    li[2].pop()
    return
solve(0,[[] for i in range(3)])
print("NYoe s"[ans::2])
0