結果

問題 No.1823 Tricolor Dango
ユーザー MasKoaTSMasKoaTS
提出日時 2022-01-28 21:33:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 368 ms / 2,000 ms
コード長 887 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 114,080 KB
最終ジャッジ日時 2023-08-28 19:16:40
合計ジャッジ時間 10,852 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
82,784 KB
testcase_01 AC 337 ms
85,664 KB
testcase_02 AC 333 ms
85,528 KB
testcase_03 AC 335 ms
86,468 KB
testcase_04 AC 297 ms
85,324 KB
testcase_05 AC 293 ms
84,776 KB
testcase_06 AC 293 ms
84,788 KB
testcase_07 AC 272 ms
84,752 KB
testcase_08 AC 271 ms
84,452 KB
testcase_09 AC 280 ms
85,028 KB
testcase_10 AC 284 ms
84,724 KB
testcase_11 AC 285 ms
84,568 KB
testcase_12 AC 291 ms
84,796 KB
testcase_13 AC 283 ms
85,080 KB
testcase_14 AC 290 ms
85,072 KB
testcase_15 AC 270 ms
84,480 KB
testcase_16 AC 246 ms
88,552 KB
testcase_17 AC 247 ms
88,188 KB
testcase_18 AC 273 ms
96,028 KB
testcase_19 AC 368 ms
114,080 KB
testcase_20 AC 278 ms
96,108 KB
testcase_21 AC 351 ms
85,872 KB
testcase_22 AC 349 ms
85,796 KB
testcase_23 AC 316 ms
85,204 KB
testcase_24 AC 333 ms
85,092 KB
testcase_25 AC 335 ms
85,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from copy import deepcopy as dcopy
import math
import sys
sys.setrecursionlimit(10**6)
def input():
    return sys.stdin.readline().rstrip()
def getN():
	return int(sys.stdin.readline())
def getNs():
	return map(int,sys.stdin.readline().split())
def getList():
	return list(map(int,sys.stdin.readline().split()))
def strinps(n):
	return [sys.stdin.readline().rstrip() for _ in range(n)]
pi = 3.141592653589793
mod = 10**9+7
MOD = 998244353
INF = math.inf
dx = [1,0,-1,0];	dy = [0,1,0,-1]


"""
Main Code
"""

for _ in [0] * getN():
	n = getN()
	a = getList()
	ok = 1
	ng = sum(a)+1
	while(ng - ok > 1):
		k = (ok + ng) // 2
		s = sum(min(i,k) for i in a)
		if(k * 3 <= s):
			ok = k
		else:
			ng = k
	if(ok * 3 == sum(a)):
		print("Yes")
	else:
		print("No")
0