結果
問題 |
No.607 開通777年記念
|
ユーザー |
|
提出日時 | 2017-12-08 01:42:50 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 436 bytes |
コンパイル時間 | 171 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2024-11-29 05:35:36 |
合計ジャッジ時間 | 3,002 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 WA * 3 |
コンパイルメッセージ
Syntax OK
ソースコード
n, m = gets.chomp.split.map(&:to_i) a = [0] * n m.times do xs = gets.chomp.split.map(&:to_i) n.times do |i| a[i] += xs[i] end s = a[0] i = 0 j = 1 ok = false while i < j while s < 777 and j < n s += a[j] j += 1 end if s == 777 ok = true break end if s > 777 s -= a[i] i += 1 end break if j >= n end if ok puts :YES exit end end puts :NO