結果

問題 No.607 開通777年記念
ユーザー letrangerjpletrangerjp
提出日時 2017-12-07 22:36:03
言語 Ruby
(3.3.0)
結果
AC  
実行時間 730 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 47 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,568 KB
最終ジャッジ日時 2024-05-06 19:36:55
合計ジャッジ時間 3,176 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
12,160 KB
testcase_01 AC 82 ms
12,288 KB
testcase_02 AC 84 ms
12,288 KB
testcase_03 AC 82 ms
12,288 KB
testcase_04 AC 78 ms
12,288 KB
testcase_05 AC 85 ms
12,160 KB
testcase_06 AC 82 ms
12,160 KB
testcase_07 AC 128 ms
12,800 KB
testcase_08 AC 84 ms
12,160 KB
testcase_09 AC 92 ms
12,544 KB
testcase_10 AC 79 ms
12,160 KB
testcase_11 AC 667 ms
13,568 KB
testcase_12 AC 730 ms
13,440 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