結果

問題 No.607 開通777年記念
ユーザー nebukuro09nebukuro09
提出日時 2017-12-13 13:41:56
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 385 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 11,352 KB
実行使用メモリ 19,644 KB
最終ジャッジ日時 2023-08-21 02:12:35
合計ジャッジ時間 5,265 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,304 KB
testcase_01 AC 81 ms
15,156 KB
testcase_02 AC 81 ms
15,044 KB
testcase_03 AC 82 ms
15,296 KB
testcase_04 AC 81 ms
15,312 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:4: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

N, M = gets.split.map(&:to_i)
a = Array.new(N, 0)

for i in 0...M do
    b = gets.split.map(&:to_i)
    for j in 0...N do
        a[j] += b[j]
    end

    s = 0
    l = 0
    
    for r in 0...N do
        s += a[r]
        while l < r && s > 777 do
            s -= a[l]
        end
        if s == 777 then
            puts "YES"
            exit
        end
    end
end

puts "NO"
0