結果

問題 No.607 開通777年記念
ユーザー cielciel
提出日時 2017-12-10 01:34:02
言語 Ruby
(3.3.0)
結果
AC  
実行時間 575 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-05-07 13:08:09
合計ジャッジ時間 2,805 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
12,288 KB
testcase_01 AC 76 ms
12,288 KB
testcase_02 AC 77 ms
12,416 KB
testcase_03 AC 75 ms
12,160 KB
testcase_04 AC 78 ms
12,160 KB
testcase_05 AC 78 ms
12,288 KB
testcase_06 AC 80 ms
12,160 KB
testcase_07 AC 115 ms
12,800 KB
testcase_08 AC 79 ms
12,160 KB
testcase_09 AC 85 ms
12,544 KB
testcase_10 AC 76 ms
12,160 KB
testcase_11 AC 505 ms
13,440 KB
testcase_12 AC 575 ms
13,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T=777
n,m=gets.split.map &:to_i
a=[0]*n
m.times{
	b=gets.split.map &:to_i
	n.times{|i|a[i]+=b[i]}
	h=t=x=0
	while h<n
		while h<n&&x<T
			x+=a[h]
			h+=1
		end
		break if x<T
		while t<n&&x>T
			x-=a[t]
			t+=1
		end
		if x==T
			puts :YES
			exit
		end
	end
}
puts :NO
0