結果

問題 No.607 開通777年記念
ユーザー 👑 horiesinitihoriesiniti
提出日時 2018-03-13 15:29:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 903 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 7,680 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-05-01 21:14:11
合計ジャッジ時間 4,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
12,288 KB
testcase_01 AC 91 ms
12,160 KB
testcase_02 AC 89 ms
12,160 KB
testcase_03 AC 95 ms
12,288 KB
testcase_04 AC 91 ms
12,160 KB
testcase_05 AC 92 ms
12,288 KB
testcase_06 AC 92 ms
12,160 KB
testcase_07 AC 278 ms
13,184 KB
testcase_08 AC 93 ms
12,288 KB
testcase_09 AC 104 ms
12,672 KB
testcase_10 AC 107 ms
12,544 KB
testcase_11 AC 903 ms
13,440 KB
testcase_12 AC 897 ms
13,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,m=gets.split.map{|e| e.to_i}
x=(n+1).times.map{0}
ans="NO"
m.times{
	
	sum=0
	y=gets.split.map{|e| e.to_i}
	z=(n+1).times.map{0}
	(1..n).each{|i|
		x[i]+=y[i-1]
		sum+=x[i]
		z[i]=sum
	}
	if sum<777
		next
	end
	p2=0
	(1..n).each{|i|
		while i>p2
			break if(z[i]-z[p2])<777
			if z[i]-z[p2+1]<777
				break	
			end
			p2+=1
		end
		ans="YES" if z[i]-z[p2]==777
	}
}
puts ans
0