結果

問題 No.607 開通777年記念
ユーザー ciel
提出日時 2017-12-10 01:34:02
言語 Ruby
(3.4.1)
結果
AC  
実行時間 620 ms / 2,000 ms
コード長 269 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,440 KB
最終ジャッジ日時 2024-11-30 06:02:59
合計ジャッジ時間 3,184 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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