結果
問題 | No.1594 Three Classes |
ユーザー | Ain48803949 |
提出日時 | 2021-07-09 21:48:48 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 373 ms / 2,000 ms |
コード長 | 1,071 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 11,776 KB |
最終ジャッジ日時 | 2024-11-16 07:40:36 |
合計ジャッジ時間 | 6,790 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
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])