結果

問題 No.607 開通777年記念
ユーザー ikdikd
提出日時 2017-12-11 01:07:00
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,773 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 11,456 KB
実行使用メモリ 20,108 KB
最終ジャッジ日時 2023-08-20 10:02:39
合計ジャッジ時間 6,179 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,084 KB
testcase_01 AC 83 ms
15,052 KB
testcase_02 AC 82 ms
15,080 KB
testcase_03 AC 83 ms
15,132 KB
testcase_04 AC 83 ms
15,048 KB
testcase_05 AC 82 ms
15,256 KB
testcase_06 AC 83 ms
15,016 KB
testcase_07 AC 1,773 ms
15,488 KB
testcase_08 AC 83 ms
15,236 KB
testcase_09 AC 92 ms
15,344 KB
testcase_10 AC 85 ms
15,212 KB
testcase_11 AC 855 ms
19,720 KB
testcase_12 AC 924 ms
20,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n, m=gets.split.map(&:to_i)
a=Array.new(n){0}
m.times do
  diff=gets.split.map(&:to_i)
  a=a.zip(diff).map{|cur, d| cur+d}
  n.times do |i|
    s=0
    (i...n).each do |j|
      if (s+=a[j])==777
        puts 'YES'; exit 0
      elsif s>777
        break
      end
    end
  end
end

puts 'NO'
0