結果
問題 | No.1823 Tricolor Dango |
ユーザー | chineristAC |
提出日時 | 2022-01-28 23:17:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 209 ms / 2,000 ms |
コード長 | 1,686 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 87,064 KB |
実行使用メモリ | 115,796 KB |
最終ジャッジ日時 | 2023-08-28 21:53:29 |
合計ジャッジ時間 | 6,297 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
80,064 KB |
testcase_01 | AC | 190 ms
82,760 KB |
testcase_02 | AC | 195 ms
83,076 KB |
testcase_03 | AC | 192 ms
82,280 KB |
testcase_04 | AC | 165 ms
82,028 KB |
testcase_05 | AC | 166 ms
82,048 KB |
testcase_06 | AC | 164 ms
82,248 KB |
testcase_07 | AC | 151 ms
81,576 KB |
testcase_08 | AC | 151 ms
81,448 KB |
testcase_09 | AC | 153 ms
81,620 KB |
testcase_10 | AC | 153 ms
81,480 KB |
testcase_11 | AC | 152 ms
81,332 KB |
testcase_12 | AC | 149 ms
81,608 KB |
testcase_13 | AC | 155 ms
83,656 KB |
testcase_14 | AC | 153 ms
82,700 KB |
testcase_15 | AC | 150 ms
82,316 KB |
testcase_16 | AC | 141 ms
85,072 KB |
testcase_17 | AC | 142 ms
85,792 KB |
testcase_18 | AC | 164 ms
91,244 KB |
testcase_19 | AC | 209 ms
115,796 KB |
testcase_20 | AC | 159 ms
91,084 KB |
testcase_21 | AC | 180 ms
82,556 KB |
testcase_22 | AC | 193 ms
82,836 KB |
testcase_23 | AC | 178 ms
82,552 KB |
testcase_24 | AC | 180 ms
82,720 KB |
testcase_25 | AC | 195 ms
82,828 KB |
ソースコード
class SegmentTree: def __init__(self, init_val, segfunc, ide_ele): n = len(init_val) self.segfunc = segfunc self.ide_ele = ide_ele self.num = 1 << (n - 1).bit_length() self.tree = [ide_ele] * 2 * self.num self.size = n for i in range(n): self.tree[self.num + i] = init_val[i] for i in range(self.num - 1, 0, -1): self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1]) def update(self, k, x): k += self.num self.tree[k] = self.segfunc(self.tree[k],x) while k > 1: k >>= 1 self.tree[k] = self.segfunc(self.tree[2*k], self.tree[2*k+1]) def query(self, l, r): if r==self.size: r = self.num res = self.ide_ele l += self.num r += self.num right = [] while l < r: if l & 1: res = self.segfunc(res, self.tree[l]) l += 1 if r & 1: right.append(self.tree[r-1]) l >>= 1 r >>= 1 for e in right[::-1]: res = self.segfunc(res,e) return res from audioop import reverse import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import log,gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) for _ in range(int(input())): N = int(input()) A = li() A.sort(reverse=True) if sum(A)%3: print("No") continue print("Yes" if A[0] <= sum(A)//3 else "No")