結果

問題 No.273 回文分解
ユーザー angel_p_57angel_p_57
提出日時 2016-07-24 21:34:40
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 379 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 11,328 KB
実行使用メモリ 20,180 KB
最終ジャッジ日時 2023-08-25 01:32:55
合計ジャッジ時間 6,651 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,048 KB
testcase_01 AC 81 ms
15,168 KB
testcase_02 AC 82 ms
15,060 KB
testcase_03 AC 81 ms
15,144 KB
testcase_04 AC 81 ms
15,092 KB
testcase_05 AC 85 ms
15,152 KB
testcase_06 AC 81 ms
15,108 KB
testcase_07 AC 81 ms
15,088 KB
testcase_08 AC 83 ms
15,112 KB
testcase_09 AC 81 ms
15,108 KB
testcase_10 AC 81 ms
15,168 KB
testcase_11 AC 81 ms
15,324 KB
testcase_12 AC 82 ms
15,100 KB
testcase_13 AC 82 ms
15,172 KB
testcase_14 AC 119 ms
15,416 KB
testcase_15 AC 81 ms
15,120 KB
testcase_16 AC 81 ms
15,048 KB
testcase_17 AC 81 ms
15,260 KB
testcase_18 AC 81 ms
15,168 KB
testcase_19 AC 84 ms
15,164 KB
testcase_20 AC 84 ms
15,196 KB
testcase_21 AC 83 ms
15,000 KB
testcase_22 AC 80 ms
15,152 KB
testcase_23 AC 81 ms
15,256 KB
testcase_24 AC 80 ms
15,108 KB
testcase_25 AC 80 ms
15,172 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

f,g,h=
  ->s,m,d{
    n=s.size
    (n-(d ? 1:0)).downto(1).reduce(0){|r,i|
      i<=r&&n-i<=r&&m<=r and break r
      h[s[0,i]] or next r
      n-i<=i||n-i<=m ?
        g[s[i..-1]] ? [i,m].max : r :
        [r,f[s[i..-1],[i,m].max,false]].max
    }
  },
  ->s{
    s.size<2||s.size.downto(1).any?{|i|h[s[0,i]]&&g[s[i..-1]]}
  },
  ->s{
    s==s.reverse
  }
p f[gets.chomp,0,true]
0