結果

問題 No.607 開通777年記念
ユーザー letrangerjpletrangerjp
提出日時 2017-12-07 22:36:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 763 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 11,216 KB
実行使用メモリ 17,108 KB
最終ジャッジ日時 2023-08-19 12:29:02
合計ジャッジ時間 4,175 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,124 KB
testcase_01 AC 82 ms
15,312 KB
testcase_02 AC 84 ms
15,244 KB
testcase_03 AC 84 ms
15,180 KB
testcase_04 AC 82 ms
15,088 KB
testcase_05 AC 82 ms
15,236 KB
testcase_06 AC 84 ms
15,164 KB
testcase_07 AC 128 ms
15,628 KB
testcase_08 AC 83 ms
15,040 KB
testcase_09 AC 91 ms
15,408 KB
testcase_10 AC 84 ms
15,124 KB
testcase_11 AC 689 ms
16,968 KB
testcase_12 AC 763 ms
17,108 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

C = 777
N, M = gets.split.map &:to_i
a = [0] * N
$<.map{|s|
  b = s.split.map &:to_i
  a = a.zip(b).map{|x,y|x+y}
  cusum = [sum = 0] + a.map{|x|sum+=x}
  l = r = 0
  while r <= N
    sum = cusum[r] - cusum[l]
    case sum <=> C
    when -1; r += 1
    when 0
      puts :YES
      exit
    when 1; l += 1
    end
  end
}
puts :NO
0