几乎是哥伦布集


20

您的任务是在Columbo情节标题中找到两个丢失的角色。

输入值

69个哥伦布剧集标题之一(如下所列),正好两个字符替换为*

范例

"Ran*om for a *ead Man"

输出量

您可以返回完整的情节标题,也可以仅以任何合理的格式返回两个缺失的字符,前提是字符的顺序是明确的。

一些有效的输出

"Ransom for a Dead Man"
"sD"
["s", "D"]

集数

点击此链接以获取未格式化的列表。

Prescription: Murder        Swan Song                             Murder, Smoke and Shadows
Ransom for a Dead Man       A Friend in Deed                      Sex and the Married Detective
Murder by the Book          An Exercise in Fatality               Grand Deceptions
Death Lends a Hand          Negative Reaction                     Murder: A Self Portrait
Dead Weight                 By Dawn's Early Light                 Columbo Cries Wolf
Suitable for Framing        Troubled Waters                       Agenda for Murder
Lady in Waiting             Playback                              Rest in Peace, Mrs. Columbo
Short Fuse                  A Deadly State of Mind                Uneasy Lies the Crown
Blueprint for Murder        Forgotten Lady                        Murder in Malibu
Etude in Black              A Case of Immunity                    Columbo Goes to College
The Greenhouse Jungle       Identity Crisis                       Caution: Murder Can Be Hazardous to Your Health
The Most Crucial Game       A Matter of Honor                     Columbo and the Murder of a Rock Star
Dagger of the Mind          Now You See Him...                    Death Hits the Jackpot
Requiem for a Falling Star  Last Salute to the Commodore          No Time to Die
A Stitch in Crime           Fade in to Murder                     A Bird in the Hand...
The Most Dangerous Match    Old Fashioned Murder                  It's All in the Game
Double Shock                The Bye-Bye Sky High IQ Murder Case   Butterfly in Shades of Grey
Lovely But Lethal           Try and Catch Me                      Undercover
Any Old Port in a Storm     Murder Under Glass                    Strange Bedfellows
Candidate for Crime         Make Me a Perfect Murder              A Trace of Murder
Double Exposure             How to Dial a Murder                  Ashes to Ashes
Publish or Perish           The Conspirators                      Murder With Too Many Notes
Mind Over Mayhem            Columbo Goes to the Guillotine        Columbo Likes the Nightlife

澄清和规则

  • 存储情节列表(或存储足够的信息以猜测丢失的角色)是挑战的一部分。换句话说,您不会“免费”获得列表。如果使用外部文件,则必须将其长度添加到字节数中。
  • 您的程序/功能必须完全支持上面列出的标题:
    • 每个字母的大小写必须完全匹配。
    • 标点符号也必须完全匹配。
    • 等等...
  • 标题中的所有字符都可以替换为*,而不仅仅是字母。它们可能是连续的。
  • 您可能期望使用另一个“空白”字符代替*,只要该字符不出现在任何标题中的任何位置。(如果是这样,请在您的答案中提及它。)

啊,还有一件事。我差点忘了...

测试集

这是所有14252个可能输入的链接


1
是的,在05AB1E中使用levienstien距离的原因。
魔术章鱼缸

(原始)标题压缩(约2k个字符)是挑战的一部分吗?还是我们可以将其作为输入接收/假设它在一个变量/堆栈中,等等?
Rod

@Rod这是挑战的一部分。我添加了error-correction我认为适合的标签。
Arnauld

不幸的是,有两个Aa中存在的唯一字符串列表。
魔术章鱼缸

2
如果对任何人有帮助,这是标题中使用的字符的列表:(',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz<space>,当然)。
粗野的

Answers:


12

Stax,294 字节

ê(·▲[*▬è0↑u■<pá{∞♫┼¢]$Fò╦7τ}αzoN≡ù÷♥R♪♪éé#Ä↑♂¼y>Φp←E├Tì·æ≈ßÿOÄ╩%▼Åp}∞½É÷_~ï♦♪s○╨5╓ok½♪◄}§3vimεå╩p"G4ƒs┬]K╡àbá•Ä◄E°µte\τ╚¥∞LH¥êoc▐I/♥∞íJ{σ↓⌠╢§♥]8<µ6ε∩╠ån¥←A↨⌡↨▼♠áiåcTε╛ëJv⌡♂'┬û▒╟_E2↑☺│╚ê£-vç╘▬╒ì)#Φ¼∟æ∟q⌐▀☻7w_ì~Δc'Ω∙j≡┼Γó2"äV√n◘j≤╦╓ΘiL.,▲♂▌▼∞ccñó╘î←iaΩï)NCøAP┼b_ε☺Cam╥~αDM↕Aä<₧¿é■N/╞τQ╠Γù>b^S>◘á↑

运行并调试

方法如下:

  • 考虑将星号替换为每个可能的字符。我使用的是大写和小写字母,以及少数标点符号。
  • 将每个候选项解释为以91为底的整数。为什么是91?它涵盖了输入中可能字符的范围,它是质数,并且是2位数字。好像很好 我不知道这是否是最佳选择。
  • 模数由精心选择的分母组成。(359473561)然后检查结果在嵌入式哈希数组中是否存在。如果匹配,那是正确的替代。

为了验证不会产生不正确的结果,我使用了C#程序来验证所有可能输入的输出。它不是很便携,并且运行时间很长。到目前为止,我已经让它搜索了超过24小时的候选分母,因此它并不真正适合TIO。我在LINQPad中运行它。

const string AllChars = " ',-.:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
const int Base = 91;
const int InputCount = 14252;

void Main() {
    string filename = Path.Combine(Path.GetDirectoryName(Util.CurrentQueryPath), "titles.txt");
    var titles = File.ReadAllLines(filename);
    Console.WriteLine("Original titles: {0}", titles.Length);
    Console.WriteLine("All characters: {0}", AllChars.Length);

    var originalHashes = titles.Select(Hash).ToArray().Dump("Original hashes");

    BigInteger candidateMod = 359473561; //BigInteger.One * InputCount * AllChars.Length * AllChars.Length * titles.Length;
    BigInteger? bestMod = null;
    BigInteger failJump = 1;

    var candidateContainer = new DumpContainer(candidateMod).Dump("Candidate");
    var bestContainer = new DumpContainer(bestMod).Dump("Best");
    var rateContainer = new DumpContainer().Dump("Candidates / s");

    int tested = 0;
    var sw = Stopwatch.StartNew();

    while (true) {
        bool success = TestCandidateMod(candidateMod, titles, originalHashes);
        if (success) {
            bestContainer.Content = bestMod = BigInteger.Min(bestMod ?? candidateMod, candidateMod);
            candidateMod = candidateMod * 99 / 100; // reduce by 1%;
        }
        rateContainer.Content = ++tested * 1e3 / sw.ElapsedMilliseconds;
        candidateContainer.Content = --candidateMod;
    }
}

bool TestCandidateMod(BigInteger candidateMod, string[] titles, BigInteger[] originalHashes) {
    var moddedHashes = new HashSet<BigInteger>(originalHashes.Select(h => h % candidateMod));

    bool TitleIsOk(string title) {
        BigInteger originalHash = Hash(title);
        for (int i1 = 0; i1 < title.Length - 1; i1++) {
            BigInteger placeValue1 = BigInteger.Pow(Base, title.Length - i1 - 1);
            foreach (var c1 in AllChars) {
                int offset1 = c1 - title[i1];
                BigInteger hash1 = originalHash + placeValue1 * offset1;
                for (int i2 = i1 + 1; i2 < title.Length; i2++) {
                    BigInteger placeValue2 = BigInteger.Pow(Base, title.Length - i2 - 1);
                    foreach (var c2 in AllChars) {
                        int offset2 = c2 - title[i2];
                        if (offset1 == 0 && offset2 == 0) continue;

                        BigInteger hash2 = hash1 + placeValue2 * offset2;
                        if (moddedHashes.Contains(hash2 % candidateMod)) {
                            return false;
                        }
                    }
                }
            }
        }
        return true;
    }

    return titles.AsParallel().AsUnordered().All(TitleIsOk);
}

BigInteger Hash(string title) => title.Aggregate(BigInteger.Zero, (a, b) => a * Base + b);

关于程序中嵌入式哈希值存储的另一条说明。哈希在嵌入数组之前先进行排序。我正在使用一种称为“填充整数数组”的stax功能,该功能可以有效地表示整数数组。如果更有效,此表示法可以存储元素之间的差异,因此对值进行预排序可以节省一些字节。

这是带有一些最少注释的解压缩表示形式。

Vl" ',-.:"+:2   all pairs of replacement characters
f   filter
 ;'*/s\$1T  do replacement
 91|E   base-91 digits
 359473561% mod by denominator
 ">m\zR^ehBT}/!P*Nv:0N?s}FGN\:M.RT0r2VVm560$k;!yP<I*&R0_&q6wEcg8)&DsZ_!}&}Y&:Ngv&B::n!g6y &&eej...Z-&J..7!Rso36>y89:*iA*eNHGBmZ5!kiZ5*D(};*Xgkvwqn^(g?!kJib&g$ep!aDaA!Xw$_!w,2E.6NFG6DPat&(u4?28BIRu<bBL\S!ugPf!Ry;&T0\/^y\S{gu;!\0spo!^3!}X0l!i$L5&Z8@|!X4}p.LyU:X2M&PR6Y!k*,[F(&v&(ZJ5Jo0d!RN!hsDFvV.kI*{u@_!a<oGoqsG2}XhJ:2,"!
 #  count occurrences in crammed array

1
太宏伟了。

8

Python 2,862字节

00000000: 2363 6f64 696e 673a 3433 370a 696d 706f  #coding:437.impo
00000010: 7274 2072 652c 7a6c 6962 0a6c 616d 6264  rt re,zlib.lambd
00000020: 6120 733a 7265 2e66 696e 6461 6c6c 2873  a s:re.findall(s
00000030: 2e72 6570 6c61 6365 282a 222a 2e22 292c  .replace(*"*."),
00000040: 7a6c 6962 2e64 6563 6f6d 7072 6573 7328  zlib.decompress(
00000050: 2222 2278 da65 54cb 96da 3810 fd95 da65  """x.eT...8....e
00000060: 93e9 0fc8 ce40 80ce 810e c13d a74f 9605  .....@.....=.O..
00000070: 2eb0 4ecb 2a46 8f10 cfd7 e796 0c9d d702  ..N.*F..........
00000080: b08d 54f7 2937 a997 4459 a9a9 179f 7d47  ..T.)7..DY....}G
00000090: 4b4e bdd3 201d 6d4b ec24 d2ce f378 e0e3  KN.. .mK.$...x..
000000a0: 2b3d f742 730d e9e2 2267 8de9 bee0 df60  +=.Bs..."g.....`
000000b0: df2b cf29 d15e 5226 1768 277c 94f7 b48d  .+.).^R&.h'|....
000000c0: e901 7b7c 190e 4a6b bd1a d4c2 b127 be6f  ..{|..Jk.....'.o
000000d0: 5ef0 f98c 1f3d 51c6 f8ad 0b60 a0f1 ac39  ^....=Q....`...9
000000e0: 4ba0 0d77 23cd 7c91 4b74 21d3 49e3 7d9b  K..w#.|.Kt!.I.}.
000000f0: 71d9 2ab0 e6b1 1c6d e08a 073c e157 7c09  q.*....m...<.W|.
00000100: a6ef 249e e498 df96 472d 070f 4d2f 9c05  ..$.....G-..M/..
00000110: cc1b 9a73 1243 7d1c 8612 5c5c 1ee9 b193  ...s.C}...\\....
00000120: 90ed 621e 5d72 893e e6d2 8949 9979 13bf  ..b.]r.>...I.y..
00000130: e4e9 0e02 7ea1 301b e51f 7ca8 7d1d 69ed  ....~.0...|.}.i.
00000140: ce3d 3d7e b9ff 5d01 7651 d231 ba4b 86a3  .==~..].vQ.1.K..
00000150: 1f7e f3eb a8df eaa5 701a 69e3 2c05 b337  .~......p.i.,..7
00000160: ea35 5013 e8e3 772c 71a9 422e 39b3 3766  .5P...w,q.B.9.7f
00000170: 0db5 6078 eced 2158 42f0 a2ca c2ea 8ba6  ..`x..!XB.......
00000180: 12e5 cdea 8d7b bd4d 7c02 abec dd09 6b85  .....{.M|.....k.
00000190: 730f 9679 fae3 1354 5d34 4302 32b8 8677  s..y...T]4C.2..w
000001a0: 50cc d11b 176c f8e9 ef82 03f2 d182 b4d9  P....l..........
000001b0: a077 5c30 74a9 2744 018f ed6a 9abb 91d0  .w\0t.'D...j....
000001c0: 2518 bf66 2488 47b0 5aea a406 e6a3 0be6  %..f$.G.Z.......
000001d0: f54d 7f0d f9b3 c9df f2d8 cb40 ad7c 27db  .M.........@.|'.
000001e0: 561b c031 3ab1 1119 f9b9 6f82 0140 ce53  V..1:.....o..@.S
000001f0: 47d6 1ad4 ac2d bf19 3a67 a424 80fe 9f63  G....-..:g.$...c
00000200: 6754 11d2 572d 91d6 c21e dc56 7122 7594  gT..W-.....Vq"u.
00000210: 1a44 7ab3 e90d 749a 035c 30a6 bd22 ed36  .Dz...t..\0..".6
00000220: 73a4 27a5 6733 b976 f6a7 b72b 9d8e 0cee  s.'.g3.v...+....
00000230: bd9c 851e 33bc 6bbc afed c0b0 dac4 0de2  ....3.k.........
00000240: 8599 b392 e14c ee51 d01b c68b 03a1 6745  .....L.Q......gE
00000250: 8b38 8c80 c818 f684 8301 bef0 0122 dcf0  .8..........."..
00000260: f0f0 40cd 197e f29f 8d5f 4591 d043 21e2  ..@..~..._E..C!.
00000270: 2be1 8ce4 dbe2 325b 056c e532 f2e0 c219  +.....2[.l.2....
00000280: eca3 a506 4fba 9378 af57 2bfc ccc5 ee4e  ....O..x.W+....N
00000290: d142 3294 0d23 e196 7dc9 5565 6da0 0e83  .B2..#..}.Uem...
000002a0: 76fa 4b97 d034 707c 517f 4292 63f5 6c5e  v.K..4p|Q.B.c.l^
000002b0: ab80 8356 0f28 86be b0cb 86dc d4e8 211c  ...V.(........!.
000002c0: 06e6 2973 0bfb 56d3 b637 6f6f 7ab0 6b8b  ..)s..V..7ooz.k.
000002d0: 5a1f ca5f c656 138b 0371 cc14 f310 e99f  Z.._.V...q......
000002e0: 7c05 6a7b 9cc3 6483 e1c5 789f 7518 eba6  |.j{..d...x.u...
000002f0: 99ea 7dfc 073b 2c02 ca3b 8d70 c365 da73  ..}..;,..;.p.e.s
00000300: 483a 549f 782a 2812 304a 31d3 d21c 6daf  H:T.x*(.0J1...m.
00000310: 76af 50b1 97ff 8a93 fbda 257b 3fb9 6a9d  v.P.......%{?.j.
00000320: 9033 d756 eef1 82b3 3259 f93a d799 5a5b  .3.V....2Y.:..Z[
00000330: 3e1d cb06 d1da bbd4 c08d 3563 b3c6 e1c6  >.........5c....
00000340: ed3d b583 e245 654e 9a9e 299f 256c 0e35  .=...EeN..).%l.5
00000350: a185 48f7 0304 28f2 1d22 2222 2929       ..H...(.."""))

是一个bash脚本,用于汇编该程序并演示其执行。

说明

这是一个相当简单的解决方案:我寻找由空格连接的标题的最可压缩排列。该程序只需将*输入替换为.,然后在字符串中查找该正则表达式的匹配项。

字符串解压缩为:

How to Dial a Murder Forgotten Lady No Time to Die Old Fashioned Murder Suitable for Framing Fade in to Murder Agenda for Murder The Conspirators Requiem for a Falling Star A Case of Immunity Candidate for Crime Any Old Port in a Storm Troubled Waters Rest in Peace, Mrs. Columbo Short Fuse Try and Catch Me Death Lends a Hand Double Exposure Strange Bedfellows Lady in Waiting Now You See Him... Prescription: Murder Grand Deceptions Columbo and the Murder of a Rock Star Etude in Black Dagger of the Mind Undercover A Friend in Deed Caution: Murder Can Be Hazardous to Your Health The Greenhouse Jungle Blueprint for Murder The Bye-Bye Sky High IQ Murder Case Columbo Goes to College Ransom for a Dead Man Publish or Perish Lovely But Lethal Playback Ashes to Ashes A Trace of Murder By Dawn's Early Light A Deadly State of Mind Sex and the Married Detective Murder Under Glass Columbo Likes the Nightlife Uneasy Lies the Crown Death Hits the Jackpot Mind Over Mayhem Columbo Goes to the Guillotine Murder by the Book A Bird in the Hand... It's All in the Game Negative Reaction Double Shock Make Me a Perfect Murder The Most Crucial Game Butterfly in Shades of Grey An Exercise in Fatality Last Salute to the Commodore A Stitch in Crime Swan Song Murder in Malibu Murder, Smoke and Shadows Murder With Too Many Notes A Matter of Honor The Most Dangerous Match Dead Weight Identity Crisis Columbo Cries Wolf Murder: A Self Portrait

6

JavaScript(ES6),634字节

该提交本应保持隐藏状态,直到发布小于500字节的答案为止。现在已经完成了

s=>[..." ',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz"].some((x,_,a)=>!a.every(y=>'kmpyjzlu83giljc0o4nvjfsic25kyom2obemwt8b1434qdrd9tuyqjk6lqyhbwi8rpv6aiw91v5s50psxbs7fb5zx3j8e09lscyct7assemgy9rqg15jqv3ulcg76mhtd57dlcoalt99155ot34at8towx1stbymusf5l0lqubd75ri8edrftn1dfkvfwxmc1akftcluh9z58vo8apk79wr6f1lwbvi4nebpuy0n8ducjbzg9osmujjn3rvvkoqw6jp4zn2tcaawx8r0johdvm650uk0ju97rvl806y7bfaf8m0i8h4jk3xetxe2m0r4slgwuoabjmvvoq81koc00m0bd7q32qlwpne04odf6uxaw9nvo3i8x18904y5d56r98j39rc18vkqfkhe4z5gjzht0lgj8y'.indexOf((1e5+[...S=s.replace(/\*/g,_=>i++?y:x,i=0)].reduce((h,c)=>(h*123+c.charCodeAt())>>>0,0).toString(36)).slice(-6))%6))&&S

在线尝试!(每集一个随机测试用例)

怎么样?

我们定义chr,即剧集标题中使用的字符列表。

chr = " ',-.:ABCDEFGHIJLMNOPQRSTUWYabcdefghiklmnopqrstuvwxyz"

我们定义hash,一个包含所有未混淆标题的哈希值的字符串。每个哈希由以36为底的6位数字组成。

hash =
  'kmpyjzlu83giljc0o4nvjfsic25kyom2obemwt8b1434qdrd9tuyqjk6lqyhbwi8rpv6a' +
  'iw91v5s50psxbs7fb5zx3j8e09lscyct7assemgy9rqg15jqv3ulcg76mhtd57dlcoalt' +
  '99155ot34at8towx1stbymusf5l0lqubd75ri8edrftn1dfkvfwxmc1akftcluh9z58vo' +
  '8apk79wr6f1lwbvi4nebpuy0n8ducjbzg9osmujjn3rvvkoqw6jp4zn2tcaawx8r0johd' +
  'vm650uk0ju97rvl806y7bfaf8m0i8h4jk3xetxe2m0r4slgwuoabjmvvoq81koc00m0bd' +
  '7q32qlwpne04odf6uxaw9nvo3i8x18904y5d56r98j39rc18vkqfkhe4z5gjzht0lgj8y'

我们定义H(),这是一个简单的哈希函数。

H = s => (                      // given s
  1e5 +                         // prepend '100000' to make sure we have enough leading 0's
  [...s].reduce((h, c) =>       // for each character c in s:
    (h * 123 + c.charCodeAt())  //   update h to h * 123 + ASCII code of c
    >>> 0,                      //   force an unsigned 32-bit integer
    0                           //   start with h = 0
  ).toString(36)                // encode the result in base-36
).slice(-6)                     // and keep only the last 6 digits

这给出了log 2(36 6)〜= 31位熵。通过将其舍入为4个字节并加上chr的大小,有效负载数据的总大小为:4 * 69 + 53 = 329个字节

现在,主要功能为:

s =>                          // given an obfuscated title s
  [...chr].some((x, _, a) =>  // for each character x in chr:
    !a.every(y =>             //   for each character y in chr:
      hash.indexOf(           //     look for the position in the hash string
        H(S = s.replace(      //       of the hash value of the string S
          /\*/g,              //         obtained by replacing in s the two '*'
          _ => i++ ? y : x,   //         with x and y
          i = 0               //         i = counter
        ))                    //       end of call to H()
      ) % 6                   //     apply modulo 6 -> forces every() to fail when it's 0
    )                         //   end of every() -> forces some() to succeed when it fails
  ) && S                      // end of some(); return S

(已针对所有可能的输入进行了详尽的测试。)


我感觉有更好的方法可以做到这一点。设定了目标...
递归

显然,您击败了Jelly的字符串压缩技术,我认为Jelly的另一种方法无法击败它。辉煌。
暴民埃里克

@EriktheOutgolfer好,谢谢!但是我这里没有压缩任何东西,因此这些方法无法真正比​​较。
Arnauld

3

Wolfram语言1383 1226字节

EditDistance查找字符串之间的Levenshtein距离

f@i_:=Sort[{i~EditDistance~#,#}&/@StringSplit[Uncompress@"1:eJxtVU1vGzcQzam/Y3rqJTHaHnPThyU5kBxFq8Ao0MtIO9olzOWoJNfK5tfnkVzZStCDjSU55Lw3783o94PuKvnt3butl3D05hyNuo+06X0t/t8///p7xy5oRyf1xDQXrmnDLh2UEDoMFFuhqepz2kVEbGktrg6IX7Grx92ansQ0bUzLqjeRD1byqwvPnXFN2l9zPZBx9MQmjltVqz7Sog+SVlPby9kbF/PNN5D3sa8l3ZxaPmYce2BaehHXKu7Sp941Vq4HGw2RZr4/Gra05C4fzLlpwEdPmc/GFOQ7+a83cuW/YGsBjKrIOe8EXyYe25R65k33c4Y5O7yI/CgZgnIS7RNvsCow1/oidqBpH1Gz2LLNr7qBPtuatok6XmZkUd+loxkKamqOpXSvKcdn77+dNfQ+b22xY0JLCNuKx1fWDKzo8wtobnhoJT9ZXdhRpaXcE8hhIF5KOxepCxw8LP5oQi7xgiNbE4d09CgNR/MitBM+JudkkQYwv7g/At2zB7n1Vfa9zzDhBBDwIaO0PBxGySbZXriA6oIghLiKsFDfaIziKDmkxM445JiHruvdCOehFgc9hlSYYEIJRO1j0XWlTrNsj3qhf7SnSoRWpru7uyvug2YV2x7Jo2YXzLTrtNZS0QUXj+HszXlJpwWHFtxB7G0/mWA6yAf8UfU8IE3T0sOXMSKjLyUZCJJinVy0kZvG+urS/6XlkIls+Bm2EpgBcp7kGG+SrcAHqObJzvwLiJm6cDae4aD8zkxt3x2UlirhSnPZG2sVLXeT/z1VnSJlQle1XOslX6/kW97KPcIeZqkhWwQe2CAFLH06nstR8igJby9+JLSL2FP2tUeL38KBYsDzpPaUVWvgQf6lyXcScjts4TV5Txsf7mi8no6/OuGQ3JZ4JeJeL7eDCjc3MO6h/78qYG2lkdJi/e0MhDQYK/AJf2dfp2ZGOMzjaSVsY3v72mthyk1YjmmHTn+dF2U6rkwsED/B+WeNxZK0RzMXGaU4d2p8bsQUmibp6NOHiNaaWHs9ug4wDBEY/WTzCE2SgRogYAoOpT7AdMS8yUgqKIDpBGb1SSD+ZeyWvUdxc++91n0S2lKk/HFT0ScDMnvV9Isw0KNG+clha/M8SvGYJoA1J/kBVHorKg==",{"\n"}]][[1,2]]

f["Ran*om for a *ead Man"]

"Ransom for a Dead Man"

2

果冻,752字节

“¬pẋEĠṬɓV;_÷¡×KḌƤ0m®Ạ-^jSƁhṙ#4¶µ.zbọẒṂhʋhe]ÇjỴėṖ=½%ẓ>ẆḃḥḞ-€VœØsỊv^ḅṇŒ#ċyṂkḅṄɠmS3HṬ`ØỵṆ(ṆƇṀßI(ċɓẊ^Ʋs#ç⁺&ð⁸³Iṙ}ṃỌ¤zhṡ¥ẉeE/WḌĊEd⁸ġƝẈµ9raẒ[ḳėŒnÞ*ƒṭɓ>>^ƓdeɦlCḥƘ-=Ʋẓ"÷:V}Ṅ⁼ƭbÇḤƁẊ21ẋṄŻėḢ⁴GG⁷ñ,ụƥṭ6ʂ¥ƊsØĖż]ṗŀṙĠ⁷ṀĿt$²ỵÞ(ŻṙS¥pḥƝ|þœ¹fX{bbð*ṾẹḢGẊmʠḲḤFẎṘṣʋ¡f⁺}4Sọ(Ẉḅ¿ọṿỌŒ0mo@ƒ⁻ıƲỊḢ#ẹ⁵ŀạƭėµdƙæṀ|ḷ2¶TḲẈżḣƁ/ṃạHṠVf¿2ỊþfnṪðF:=WẒXȷḂ5ȧẓ®ƥƤḃ0¿ṬỌḥg4Ụ3Ḅ(ⱮƬZƒẈİu<Ð6ImṖƇṁgḊƘBƤṡ⁾ȯ=ƓẆ{œƙYṅb÷ėÞṬSȷƁḌɱyƒþwỊK¬6t=ėṡ⁽Ṡƥġ-ẒḞOṙOṾ.Eḣḋqṣ,¢¬ƒṗ3ṾỌƓ¤þṗñỤṫ#Ḷġ*żėṣĖƈ1)zḄ×l⁻ñ:ẊẎY®ɠ4ƭ⁹ṪqạƬẒẆO_jṃgẓ¶ɓẎṆ⁼Ẹ⁴9%*'ọḌṅṅþḷḄ*Þ9ɓ&ȯ'~æ:⁷ịẒ⁸t)!ẸƙȥṫỴỵṢ ẏxƓ}ɠ+£¡Ṃ¦ṗẏÞæẊA²Ʋ#ẹƊ!£Æụ½:eUỌƒṾịụ&ḋȤ#lṖ*M¤fçȮṫo]ṗXṚ'+8ỊEẋ8{{Sṇ85⁺VɦrF¢c,[£Nȯœ/ʋñṄṬƑỤsṗxṿŒ¿€Ỵ¥ƬƭṂṂỤẋogṠṡḢÆṭzƘȯ:Ẓ¹ḥṃṄạėPȦ4ṗḋĊ⁵Ḣẋṛ⁷oNHAnṃ÷°5ṿ¿Ṗ,%ßĠṠ⁷ṂÐrEʋėỌẊƲXœ>*þƒƲẇÐĠṪṀ$:İƥøs²ṗ)}ṇ5⁻g¦eLʠCı32ṾŻƲƘ¹$²ƘsĿÇḳPṬẒƘẎlṂṫ8ɦɓ4ẸþCẈạOỌẏŻḲⱮʠÑ<ʠĊṣßỌK7Ø5],⁸ƒjḂƥ⁷»Ỵ©=ċ€0i2ị®

在线尝试!

来压缩列表。

假设没有一部电影的字符与另一部电影的字符完全不同,这已在此处证明(输出1)。


2

红宝石1185 1165字节

->s{t="Pr@c2p#:[Trac}of[F2)X>6ed_Ag)d14~_Bluepr`0f^[6(lVSt?}3M`d_F(}>&[C%}3Immun;y_OlXF%hi7ed[M?tK 3H7^_UndKcovK_A9t;c/>C2mZMak}M}1PKfect[BirX`jH]d<Sho8jGuillot`ZHow & Di5 1~=Mos0Cruci5 GamZ~,9mok}]XSh(ow+It's All `jGamZ*W;/Too M]VNot@_C]did?}4C2mZ~: A9elf P^tra;_Su;abl}4Fram`g_*>M5ibu_Sw]97g_*UndK Gl%+L(V>Wa;`g_*byjBook{C2@ Wolf_Playback{]dj*31Rock9tar_Etud}>Bla8 CollegZNow Y$9e}Him<Exposure{Lik@jN!lifZ6?/L)ds 1H]d=Mos0D]gK$s M?ch_DaggK ofjM`d=Bye-By}SkVHig/IQ *C%ZR]som 416aXM]_Sex ]djMar2eX6tectivZAn ExKcis}>F?5;y_Gr]X6cep#+Neg?iv}Reac#_6aXWe!_BVDawn's EarlVL!_Tr$bleXW?K+R@0>Peace, Mrs. Columbo_Sh^0FusZUne%VLi@jCrown_F^gott) L(y=Gre)h$s}JunglZId)t;VC2si+Cau#: *C] B}Hazard$s & Y$r He5th_6?/H;sjJackpot_Requiem 41F5l`g9tar_L%t95ut}&jCommod^ZNo Tim}& DiZButtKflV>Sh(@ 3Grey_LovelVBu0Leth5_TrV]XC?c/MZAnVOlXP^0>a9t^m_Str]g}Bedfellow+Ash@ & Ash@_Publis/^ PKish=C7spir?^+M`XOvK Mayhem"
"!ight|#ti7|$ou|%as|&to|(ad|)en|*~ |+s_|/h |0t |1a |2ri|3of |4f^ |5al|6De|7on|8ck{Go@ to|9 S|;it|<..._Doubl}|=_Th}|>` |?at|@es|Ker|Vy |Xd |Ze_|[ ~_A |]an|^or|`in|j th}|{_Columbo |}e |~Murder".scan(/[^|]+/){|u|t.gsub!u[0],u[1..-1]}
t.split(?_).find{|u|u.match?s.gsub(?*,?.)}}

在线尝试!

Lambda接受一个字符串并返回一个字符串。使用一些自制字符串扩展。在如何从扩展列表中选择标题以及如何正确压缩列表中,可能都存在打高尔夫球的空间。

-20个字节:(手动)重新排列列表的顺序以增加子字符串的重复

取消高尔夫:

->s{
  t="Pr@c2p#:..."            # t will expand to an underscore-delimited list of titles
  "!ight|#ti7|$ou|..."       # This is a pipe-delimited list of substitutions
    .scan(/[^|]+/){|u|       # For each substring consisting of non-pipe characters:
      t.gsub! u[0], u[1..-1] #   Each substitution's first character is the key
    }
  t.split(?_)                # Split t into individual titles
    .find{|u|                # Find the first title where:
      u.match? s.gsub(?*,?.) #   Treating the input as a regex yields a match
    }
  }

这是我用来生成此代码的贪婪替换选择算法的片段。我已经省略了一些细节,因此它不能按原样工作,但是应该能够提供要点。

chars = (0..127)
  .map(&:chr)
  .select{|c| c.inspect.size == 3 && !titles.include?(c)}

substitutions = []

while !chars.empty?
  most_valuable_substring = Hash
    .new{ |hash,key| hash[key] = 0 }
    .tap{ |reps| titles.substrings.each{ |sb| reps[sb] += 1 } }
    .select{ |sb,count| count > 1 && sb.size*count > 4 }
    .sort_by{ |sb,count| sb.size*count }
    .last
    .first

  c = chars.pop
  substitutions << c + most_valuable_substring
  titles.gsub! most_valuable_substring, c
end

p titles
p substitions.reverse.join "|"

2

Java 10、1426 1405 1381 1315 1313 1298字节

s->{var i=new java.util.zip.Inflater(0<1);i.setInput(java.util.Base64.getDecoder().decode("ZVTLjts6DP0VAlp00zsf0F0ek2SKeJo7TjHokrEZW4gs5UpyM75f30Pl0QJdGDBE6vDw8FC7KKmJ9pxt8F+oGmMr0dQX9lQH35nrwWeqh3ASYt9S3XMbLsm8sU9hoGOIxLQUbqlib2a0ilaQZj0OpTW1fJRruRckRARbBLI02f6UGzwdphKfh3AyM0/PHxIbm0RBVpzZ2TyZdVSYpTRSuCaDmrmnLYolMNggal6lY8WlN+FGs24FvtCManFH2oWYI9tsCuF3sV2fzXyiJV/8p0TPHN1E23K6CG4cDoEWoJzoPbijqUeb+eCkNL2KPFgotI9hxBnQOEtMZtaBEZeUm5pbbidt5R2F9cbO8XTg5mTeJGUN7MBWPlMV0xPdypq6B1VajUmgqbIFsTqjBIUjVRbNfvfCSdmCnqq3iOHizdyNco7W5z8ZrELsQs7iSbncVUflCtoeRvOcx7aoPXfKa0YLTqXQyzCMXtW/q7EOWi0oTSedmD0Kr6OI7wOo0tfRd07MSys+45qKl2wyCx7/9BfgUUows/85trioiD/CGGkj7HJfUKsAcRZxbCw7WvOgOlSMJqIS2wQf4oPVw2BXeMSZ3kJzUsWiWXLXXU9Ljmr3Gi5aEKYACzs8PT3d7LSx+armVwhxDhkz+m+0cvf5ip3DCK+4WwbDmt2IoaCBMoMwDKENUVCB9nYogaVV7jUEaXoVGaKgmxVfJUfCbUozmttYNkeh1NDK66HFkj3aULUgQ9Obb64Fn9RDWLjvhvGSYeOZc3eUItyyOBSbC0kK3nySf/BRfZrQcdfTy7+/RwPHzUfV+eiKbXXhMXTIh0FPZht+CgJIwe7lnh02YCoTWCgtqgTOBFKDPPTkJ1KiungKxtAhxOFuwZJJa8cpmRqbiQ5hjPYozukbA5+0tlXTq/xX3SrGQ1ThLcLaxCPekd/y7SP2qOzH9eTW9/PHOaQRM9lg6mUecBQ/rqX+aunyY3a4YlNPqAd8/BXBFnhwzjYyuKc793cLv+xD0HdvoteQcVvNRd/QOA6nXoa/9qbMZLRoD0+BPMJbe7pt8as+Ps4e5Rc="));var b=new byte[1433];i.inflate(b);i.end();for(var t:new String(b).split("#"))if(t.matches(s.replace("*",".")))System.out.print(t);}

@OlivierGrégoire通过编码字符串,得到-66字节。

说明:

在线尝试。

这是编码器的代码。

s->{                        // Method with String parameter and no return-type
  var i=new java.util.zip.Inflater(0<1);
                            //  Create the decoder
  i.setInput(java.util.Base64.getDecoder().decode(
                            //  Put the following encoded String in the decoder
     "ZVTLjts6DP0VAlp00zsf0F0ek2SKeJo7TjHokrEZW4gs5UpyM75f30Pl0QJdGDBE6vDw8FC7KKmJ9pxt8F+oGmMr0dQX9lQH35nrwWeqh3ASYt9S3XMbLsm8sU9hoGOIxLQUbqlib2a0ilaQZj0OpTW1fJRruRckRARbBLI02f6UGzwdphKfh3AyM0/PHxIbm0RBVpzZ2TyZdVSYpTRSuCaDmrmnLYolMNggal6lY8WlN+FGs24FvtCManFH2oWYI9tsCuF3sV2fzXyiJV/8p0TPHN1E23K6CG4cDoEWoJzoPbijqUeb+eCkNL2KPFgotI9hxBnQOEtMZtaBEZeUm5pbbidt5R2F9cbO8XTg5mTeJGUN7MBWPlMV0xPdypq6B1VajUmgqbIFsTqjBIUjVRbNfvfCSdmCnqq3iOHizdyNco7W5z8ZrELsQs7iSbncVUflCtoeRvOcx7aoPXfKa0YLTqXQyzCMXtW/q7EOWi0oTSedmD0Kr6OI7wOo0tfRd07MSys+45qKl2wyCx7/9BfgUUows/85trioiD/CGGkj7HJfUKsAcRZxbCw7WvOgOlSMJqIS2wQf4oPVw2BXeMSZ3kJzUsWiWXLXXU9Ljmr3Gi5aEKYACzs8PT3d7LSx+armVwhxDhkz+m+0cvf5ip3DCK+4WwbDmt2IoaCBMoMwDKENUVCB9nYogaVV7jUEaXoVGaKgmxVfJUfCbUozmttYNkeh1NDK66HFkj3aULUgQ9Obb64Fn9RDWLjvhvGSYeOZc3eUItyyOBSbC0kK3nySf/BRfZrQcdfTy7+/RwPHzUfV+eiKbXXhMXTIh0FPZht+CgJIwe7lnh02YCoTWCgtqgTOBFKDPPTkJ1KiungKxtAhxOFuwZJJa8cpmRqbiQ5hjPYozukbA5+0tlXTq/xX3SrGQ1ThLcLaxCPekd/y7SP2qOzH9eTW9/PHOaQRM9lg6mUecBQ/rqX+aunyY3a4YlNPqAd8/BXBFnhwzjYyuKc793cLv+xD0HdvoteQcVvNRd/QOA6nXoa/9qbMZLRoD0+BPMJbe7pt8as+Ps4e5Rc="));
  var b=new byte[1433];     //  Create a byte-array to contain the decoded bytes
  i.inflate(b);             //  Decode it
  i.end();                  //  Let the decoder know we're done
  for(var t:new String(b)   //  Convert the byte-array with decoded bytes to a decoded String
            .split("#"))    //  And loop over the titles
    if(t.matches(           //   If a title matches
        s.replace("*",".")))//   the input with all "*" replaced with a regex-wildcard "."
      System.out.print(t);} //    Print this title


进一步的提示:将Defdefed字节数组保留在文件中。然后用阅读java.nio.Files.readAllBytes(java.nio.Paths.get("a"))。这样,不需要bas64。
奥利维尔·格雷戈尔

@OlivierGrégoire谢谢。我决定不实施第二条评论,因为我更喜欢在TIO上运行它,而且无论如何,它与其他答案没有竞争力。关于编码器/解码器的一个问题:796和是如何1397确定的?
凯文·克鲁伊森

好的,这是您的电话:-) nuber是处理后的缩小/膨胀数组的大小。它们由d.deflate(b)和替换i.inflate(b)System.out.println(d.deflate(b))System.out.println(i.inflate(b))。如果您打高尔夫球的文本,您应该更新数组的大小。
奥利维尔·格雷戈尔

1
首先运行:var bytes = new byte[9999],然后输出数字。第二次运行:将替换为9999输出值,然后删除System.out.println()。如果您不这样做,则字符串很可能会使用错误的大小,并且输出会被弄乱,这可能就是1290高尔夫所发生的情况。该API应该与缓冲区一起使用,但在本例中,我们想打高尔夫球,因此我们必须预先计算这些值。如果不这样做,我们将丢失字节。
奥利维尔·格雷戈尔(OlivierGrégoire),

2

Python 2,621字节

C='6PX2OHRR3M431R8RODFNHWX44MRFXJFPZ3FH5D9920XJ6DQRBGY02VNRZETRUTVB0TH9V3T0C0VKA5NLPVQ6T9IUVNSSHXMDQORLA842O8MJQEM46Y6BKW9IQWXOL02MTRLM5L1APZFUXO1EY880ECSXKW0GO1YJPTW7P56X0B6ZSMJBUDS2FZIQ4XPAS5PHQL6HEICDMJQKQZXGISSQ4F0KBLG0ODLEJXYUVNUP5IS27GIMC5FBZFAK6PU5WOEFBOJZHXBGBJYMB8Z0GQH5VFJW6JQ0BVJAQAW7KJ56R0DF35U5IGBO2U22VQPWMBIP8IAH0Y1TU9VGRWDHR59G4HELD8491GJECIQNH9ERA2IRMOBM2DMYSN87Z1NBLEBMEYI4AV40ZPP2MC4DPQRMOT16IUAACE'
H=[int(C[i::69],36)for i in range(69)]
P="acbedgfihkjmlonqpsrutwvyxz";P+=P.upper()+" '-,.:"
f=lambda s:[t for h,t in[(hash('B'+s.replace('*','%s')%(i,j))%(36**6),i+j)for i in P for j in P]if h in H][0]

在线尝试!

注意:当!刚刚看到这与Arnauds解决方案基本相同...

尚未完全打高尔夫球...

这里的基本思想是:创建标题哈希表,模数为36 ^ 6(每个标题需要6个字节;加上一些开销)。

现在,给定标题有两个缺失字符,用蛮力替换两个可能的字母,然后检查结果字符串的哈希是否在列表中。

通过在标题前加上“ B”并使用Python的hash函数,我们得到一个列表,该列表在该任务中永远不会发生冲突。因此,将始终只有一个并且只有一个可能的答案。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.