結果

問題 No.1594 Three Classes
ユーザー Ain48803949Ain48803949
提出日時 2021-07-09 21:48:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 1,071 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-04-28 00:08:06
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 366 ms
11,648 KB
testcase_01 AC 39 ms
11,392 KB
testcase_02 AC 38 ms
11,776 KB
testcase_03 AC 342 ms
11,648 KB
testcase_04 AC 362 ms
11,648 KB
testcase_05 AC 361 ms
11,648 KB
testcase_06 AC 337 ms
11,648 KB
testcase_07 AC 337 ms
11,648 KB
testcase_08 AC 372 ms
11,648 KB
testcase_09 AC 363 ms
11,648 KB
testcase_10 AC 369 ms
11,520 KB
testcase_11 AC 359 ms
11,648 KB
testcase_12 AC 369 ms
11,776 KB
testcase_13 AC 38 ms
11,520 KB
testcase_14 AC 363 ms
11,648 KB
testcase_15 AC 368 ms
11,648 KB
testcase_16 AC 149 ms
11,776 KB
testcase_17 AC 365 ms
11,392 KB
testcase_18 AC 37 ms
11,648 KB
testcase_19 AC 39 ms
11,648 KB
testcase_20 AC 50 ms
11,648 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