結果

問題 No.1148 土偶Ⅲ
ユーザー 👑 hos.lyrichos.lyric
提出日時 2020-09-09 01:51:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 11,192 KB
実行使用メモリ 20,748 KB
最終ジャッジ日時 2023-08-20 14:52:19
合計ジャッジ時間 6,863 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,140 KB
testcase_01 AC 82 ms
15,096 KB
testcase_02 AC 81 ms
14,976 KB
testcase_03 AC 81 ms
15,088 KB
testcase_04 AC 82 ms
15,184 KB
testcase_05 AC 105 ms
16,652 KB
testcase_06 AC 147 ms
20,548 KB
testcase_07 AC 125 ms
18,140 KB
testcase_08 AC 150 ms
20,468 KB
testcase_09 AC 147 ms
20,748 KB
testcase_10 AC 112 ms
16,524 KB
testcase_11 AC 146 ms
20,704 KB
testcase_12 AC 91 ms
15,388 KB
testcase_13 AC 98 ms
15,768 KB
testcase_14 AC 94 ms
15,432 KB
testcase_15 AC 121 ms
17,948 KB
testcase_16 AC 95 ms
16,404 KB
testcase_17 AC 142 ms
20,608 KB
testcase_18 AC 83 ms
15,284 KB
testcase_19 AC 105 ms
17,780 KB
testcase_20 AC 114 ms
17,864 KB
testcase_21 AC 103 ms
16,528 KB
testcase_22 AC 91 ms
15,468 KB
testcase_23 AC 99 ms
15,336 KB
testcase_24 AC 106 ms
15,336 KB
testcase_25 AC 104 ms
15,400 KB
testcase_26 AC 165 ms
16,076 KB
testcase_27 AC 102 ms
15,328 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n,w=gets.split.map &:to_i
a=$<.map &:to_i
z=j=s=0
p={}
n.times{|i|
  s+=a[i];
  while s>w||p[a[i]]&&j<=p[a[i]]do s-=a[j];j+=1end
  z<i+1-j&&z=i+1-j
  p[a[i]]=i
}
p z
0