結果

問題 No.1823 Tricolor Dango
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-07-04 09:25:11
言語 Ruby
(3.3.0)
結果
AC  
実行時間 211 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 11,384 KB
実行使用メモリ 31,548 KB
最終ジャッジ日時 2023-09-25 07:03:18
合計ジャッジ時間 5,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
15,168 KB
testcase_01 AC 158 ms
15,524 KB
testcase_02 AC 153 ms
15,368 KB
testcase_03 AC 150 ms
15,564 KB
testcase_04 AC 128 ms
15,704 KB
testcase_05 AC 132 ms
15,776 KB
testcase_06 AC 129 ms
15,560 KB
testcase_07 AC 128 ms
15,696 KB
testcase_08 AC 128 ms
15,504 KB
testcase_09 AC 131 ms
15,776 KB
testcase_10 AC 127 ms
15,644 KB
testcase_11 AC 125 ms
15,828 KB
testcase_12 AC 120 ms
15,732 KB
testcase_13 AC 133 ms
17,092 KB
testcase_14 AC 120 ms
17,556 KB
testcase_15 AC 118 ms
17,284 KB
testcase_16 AC 99 ms
18,116 KB
testcase_17 AC 102 ms
17,944 KB
testcase_18 AC 137 ms
22,328 KB
testcase_19 AC 211 ms
31,548 KB
testcase_20 AC 136 ms
22,240 KB
testcase_21 AC 133 ms
15,656 KB
testcase_22 AC 148 ms
15,628 KB
testcase_23 AC 129 ms
15,884 KB
testcase_24 AC 133 ms
15,684 KB
testcase_25 AC 143 ms
15,420 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

def f()
n=gets.to_i
xs=gets.split(" ").map{|e| e.to_i}.sort.reverse
s3=xs.sum
return "No" if s3%3!=0
s2=s3/3*2
s1=s3/3
sum1=0

xs.each{|x|
	m1=s1
	if sum1>=s2 then
		m1=s3-sum1
	end
	return "No" if m1<x
	sum1+=x
}
return "Yes"
end
t=gets.to_i
t.times{
	puts f()
}
0