結果
| 問題 |
No.1594 Three Classes
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-07-09 21:29:12 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 79 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,376 KB |
| 最終ジャッジ日時 | 2024-07-01 15:14:56 |
| 合計ジャッジ時間 | 6,611 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 17 |
ソースコード
from itertools import permutations
N = int(input())
E = [int(i) for i in input().split()]
se = sum(E)
if se % 3 != 0:
print("No")
exit()
def possible(arr):
cur = 0
count = 0
for i in arr:
if i + cur < se // 3:
cur += i
elif i + cur == se // 3:
cur = 0
count += 1
elif i + cur > se//3:
return False
return count == 3 and cur == 0
for per in permutations(E, N):
if possible(per):
print("Yes")
exit()
print("No")