結果

問題 No.165 四角で囲え!
ユーザー 👑 hos.lyrichos.lyric
提出日時 2019-01-30 21:09:08
言語 Crystal
(1.11.2)
結果
AC  
実行時間 1,270 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 18,734 ms
コンパイル使用メモリ 258,956 KB
実行使用メモリ 5,276 KB
最終ジャッジ日時 2023-09-13 10:04:22
合計ジャッジ時間 33,566 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 554 ms
5,120 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 AC 2 ms
4,436 KB
testcase_04 AC 3 ms
4,424 KB
testcase_05 AC 755 ms
5,192 KB
testcase_06 AC 159 ms
5,144 KB
testcase_07 AC 3 ms
4,412 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 3 ms
4,392 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 749 ms
5,012 KB
testcase_12 AC 1,023 ms
5,168 KB
testcase_13 AC 1,021 ms
5,120 KB
testcase_14 AC 1,070 ms
5,124 KB
testcase_15 AC 1,018 ms
5,076 KB
testcase_16 AC 1,101 ms
5,160 KB
testcase_17 AC 991 ms
5,156 KB
testcase_18 AC 1,270 ms
5,276 KB
testcase_19 AC 1,046 ms
5,156 KB
testcase_20 AC 1,006 ms
5,208 KB
testcase_21 AC 1,000 ms
5,264 KB
testcase_22 AC 998 ms
5,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,b=gets.not_nil!.split.map &.to_i
a=(1..n).map{gets.not_nil!.split.map &.to_i}
x=a.map{|c|c[0]}.sort.uniq
a.map{|c|c[0]=x.index(c[0]).not_nil!}
z=0
n.times{|i|n.times{|j|s=t=l=0
f=[0]*n
g=[0]*n
a.map{|c|a[i][1]>c[1]||c[1]>a[j][1]||(f[d=c[0]]+=1;g[d]+=c[2])}
n.times{|k|s+=f[k];t+=g[k];while t>b;s-=f[l];t-=g[l];l+=1 end;z=s if z<s}}}
p z
0