QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#26681#1242. Broken lineHakujitsuWA 71ms5640kbC++1.5kb2022-04-07 21:24:382022-04-29 04:13:06

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-29 04:13:06]
  • 评测
  • 测评结果:WA
  • 用时:71ms
  • 内存:5640kb
  • [2022-04-07 21:24:38]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

void debug_out() {cerr << endl;}
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
{
    cerr << " " << H;
    debug_out(T...);
}
#ifndef ONLINE_JUDGE
    #define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 42
#endif

using ll = long long;

int main(){
    ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
    string s;
    cin >> s;
    vector<vector<int> > cnt(16, vector<int>(16));
    vector<vector<int> > pos(16);
    for (int i = 0; s[i]; i += 1) {
        auto c = s[i];
        pos[c - 'a'].emplace_back(i);
    }
    for (int i = 0; i < 16; i += 1) {
        for (int j = 0; j < 16; j += 1) {
            if(i == j) continue;
            int ptr = 0;
            for (auto x : pos[i]) {
                while(ptr < pos[j].size() && pos[j][ptr] < x) {
                    ptr += 1;
                }
                cnt[i][j] += ptr;
            }
        }
    }
    ll res = 0;
    for (int i = 0; i < (1 << 16); i += 1) {
        ll sum = 0;
        for (int j = 0; j < 16; j += 1) {
            if(i >> j & 1) continue;
            for (int k = 0; k < 16; k += 1) {
                if(i >> k & 1) {
                    sum += cnt[j][k];
                }
            }
        }
        res = max(res, sum);
    }
    cout << res << "\n";
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 3716kb

input:

banan

output:

5

result:

ok answer is '5'

Test #2:

score: 0
Accepted
time: 15ms
memory: 3716kb

input:

abcdefghijklmnopaaaa

output:

90

result:

ok answer is '90'

Test #3:

score: 0
Accepted
time: 16ms
memory: 3644kb

input:

a

output:

0

result:

ok answer is '0'

Test #4:

score: 0
Accepted
time: 11ms
memory: 3508kb

input:

pp

output:

0

result:

ok answer is '0'

Test #5:

score: 0
Accepted
time: 11ms
memory: 3572kb

input:

pa

output:

1

result:

ok answer is '1'

Test #6:

score: 0
Accepted
time: 16ms
memory: 3648kb

input:

abc

output:

2

result:

ok answer is '2'

Test #7:

score: 0
Accepted
time: 15ms
memory: 3536kb

input:

ede

output:

1

result:

ok answer is '1'

Test #8:

score: 0
Accepted
time: 11ms
memory: 3712kb

input:

ooo

output:

0

result:

ok answer is '0'

Test #9:

score: 0
Accepted
time: 11ms
memory: 3644kb

input:

fnod

output:

4

result:

ok answer is '4'

Test #10:

score: 0
Accepted
time: 12ms
memory: 3708kb

input:

abbaa

output:

4

result:

ok answer is '4'

Test #11:

score: 0
Accepted
time: 11ms
memory: 3708kb

input:

baabbb

output:

6

result:

ok answer is '6'

Test #12:

score: 0
Accepted
time: 15ms
memory: 3508kb

input:

ccababa

output:

10

result:

ok answer is '10'

Test #13:

score: 0
Accepted
time: 15ms
memory: 3560kb

input:

bababbdaee

output:

20

result:

ok answer is '20'

Test #14:

score: 0
Accepted
time: 15ms
memory: 3616kb

input:

djbecjaiccfhdiihhjh

output:

76

result:

ok answer is '76'

Test #15:

score: 0
Accepted
time: 11ms
memory: 3532kb

input:

adaaaadddbcdadcdaddbcdccabbddcdbddabbbbb

output:

293

result:

ok answer is '293'

Test #16:

score: 0
Accepted
time: 12ms
memory: 3564kb

input:

blpeledhbcafdfeiecmcndheagipefkfconkjldniedkacllaknlpagklpemgfkmcjlfcdogkhnncooomefofhagndkccpmbcbj

output:

1679

result:

ok answer is '1679'

Test #17:

score: 0
Accepted
time: 11ms
memory: 3660kb

input:

bnnjcbgkebbmkagekignbbkifcnanekiocbngbnljnkciikjbobdcmmkpimbmgbjgkcbfbkkkoebhijemkgjecgenkaclpiliikamjkbjnpgmacejblkjkbbicicjiijmigkjpcjhkpkjicpbhekpkdijbbmpjjbkcmbojfapkcbcigijccfnbjibjjjjimkpinkccbjfjmikcmnceecnbkkcondmeikcbjnjmdiekdnokbhkkikmmjmimfbkicmbebcmcfkigbapbbcmbbiiickbkmgnbnilhihgkhpnbbc...

output:

139281

result:

ok answer is '139281'

Test #18:

score: 0
Accepted
time: 10ms
memory: 3680kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok answer is '0'

Test #19:

score: 0
Accepted
time: 16ms
memory: 3656kb

input:

dgffadaaegfdbgdfgdgcdeeddfedaabgbaadfcbddbfeacgdebdabebeccfcbcfdcbcaefeedgcbgcbdeefgccdeadabddgdadcfffbeefdgfdadfbgbcefgbgabggbgfefffabdgefaegdfcfdfecggaaagaceefaeefddbggcffedbccdcdcaeddcdcccagbcebgacfecbagbgdagaacfedcaafcgeebdcccecdfceaeagdafcccadegadfgaadfccgcfcfaeaafgebaeegebgfababfbefeefadaggcbd...

output:

8032403

result:

ok answer is '8032403'

Test #20:

score: 0
Accepted
time: 17ms
memory: 3692kb

input:

boaleaaebaoieafmmjkakeodmnaabkeebjeooenibaaainieniieiedeoobbeoomieaoebiipmbekoeljjeooeloomeneaaoaeaenedjlaemeebmoemaebeaeeejajmjameieanemoaleeaneaeeimaoeeebneapembkbomejmmamjeeooipbaaoemnbmoneeloenbademalebiapimnanbeemnoabeaeeemieemmeemooaaeoanefllbkleeeoenbeaiaoieimeeoeieoideemmmajeonoenebmedgmeeoe...

output:

32621356

result:

ok answer is '32621356'

Test #21:

score: 0
Accepted
time: 25ms
memory: 3712kb

input:

coanjdmbapdmpbjhfnefggihaogjplakkghhhnmmnikckhjbfjdbfhleebooecoaenicldncacejlhekbmllngcliakoaljboomadacbbnbjghbefmhddleojdpmclmkkbidjgfbpcdlkebnnbiplackhojeejojjpajkedfoipihbfipnclmdeamdgfbcmoclbdobmbofmjfdkagngajmcmgnkkfampkhkkclmmdcifppmgakkgcjhonfbblldpfncgompacnedkkfeiicnmggfpfbellepibnglpideflb...

output:

316580550

result:

ok answer is '316580550'

Test #22:

score: 0
Accepted
time: 36ms
memory: 4384kb

input:

fhnknckfgnlgdgnicnijankanoccldcfmkhojcflhdngndeccnekdjldcdadoeegdjnmkicccafomhkabbhohofiamoekagnkdkbmnhablbhchlmicfkaldmjdicdoacakdbkjmmcdfknneamannfbnjciihnkflkbmgefhngkceeegdlmifnhbfgnkiljdkelkgoeiljjhdgblladjljbfodmmiagagledbfamnjlehanjjenimloiildjndmkfgdkfndgnhcmdnaahcfbeaikiaiaackkmemekemofgkdm...

output:

1911314433

result:

ok answer is '1911314433'

Test #23:

score: 0
Accepted
time: 46ms
memory: 4576kb

input:

facdcdnicaffdknehggbcmkopemnmnfnbdeembmclfkmcihcimodhiocaaenpdpmgddlnjimojkflopabianljiaipbjainhknmdjgibkajpohkckggjlpdlfeamppepcdnokcobcifhknjdmebfchmpkhooofoanocnlcdpbampgkbjidnllacgkinaeofjikohcbabgfkffepfneijhajhmggoplpngcidoakfgodlahcnmofkienkloiajcmblgjcihbbfajpgacoomhpobhjopemckombmioplnaiijh...

output:

5029120463

result:

ok answer is '5029120463'

Test #24:

score: 0
Accepted
time: 62ms
memory: 5320kb

input:

mkdiekeijohfoieakdljedbbplpeenlhdiipknpfegpheibiofhbgnaklmknnhleofmmhieggchpmkjcbcbbjipbdlbbhfinchdmdepoaddaonnnlohpboaiaipbneppmjoblnophfjljbocfhlemnpjkmpcddcclicddhpplcommmnlmhonpnenacoppfjahfkkfdbjfaahnlkbhmjiojpfhldedjekemjadgmpfcpgoegndnnfppggaeagkhkcmoknajdajfhplheoipdfmancgpblcmpimbdicmdjmjfc...

output:

11314522779

result:

ok answer is '11314522779'

Test #25:

score: 0
Accepted
time: 69ms
memory: 5308kb

input:

nblbejjbepcebeandgolnejlplfpehhdcdomhgbiemljbeeekjfppmbelmmnomkiekfobfibcbbjjfnbjcikhkbbmeocfedojmbolnjpmmpnedgpmdlaldbfbpfopjedndpfhofpkgnladamndhapaomohdkndakmafnkkiflcnenaplopnolfnckfidmnenaomihhligcopoibpahbjnoejfmndkidfaogikbkaohjmghpiiaidimnoepngkfajpajllnpbdbiejbcplonbkkmfbpmmopbnkcnfhfoafaal...

output:

11319558496

result:

ok answer is '11319558496'

Test #26:

score: 0
Accepted
time: 71ms
memory: 5492kb

input:

oijhpjpichaldjeidapjggeiapogapfffadlifnpcfoeedcemknhpohahekjjppnpjlakgodpphnbnffbnmgefjfofaicjenfnlaoophlamgcmpfbidikdiicobiihgmkpdepeabadnhkanmkdjppgnmonikeipkfbajlbokmnfdackbkppofpdhjbigbnpdablaplajjdkcilgndnpbjlhkbmghnlccnceaknaidaegocbnoacdnibpnhmolakmcmleophgnbhldfbkmkacmifcpkpiepbnjidnniogmkgo...

output:

11326125099

result:

ok answer is '11326125099'

Test #27:

score: 0
Accepted
time: 62ms
memory: 5416kb

input:

bkchbnkbknlnmmdlkeignliofkpplhkajomloddcloaonmocecmdhinlokldgcoodohdkdlompifebdnjfmnobdnhbhbafbnnjoackhghgoiekaefmpbhmhalahpcfcoofloffhmcdccehfooebnehjjkpibiojmijideoplbadhjneghbbbgepdkeganhkifoepbohjejlnfahicjlhbepbmcfckkeemfhpjmoadgnempkkiakeledgoaceelmnnnidedkpcfnbkjhkphakcjmmjcgkmffedcddmpdeddeh...

output:

11323224455

result:

ok answer is '11323224455'

Test #28:

score: 0
Accepted
time: 62ms
memory: 5224kb

input:

jaloijhcgekiahdifidgbjnecfolobgledafgncjfmlmmgbenchenccihiceomlfchnbeelnjkeleohcdhifjooehohekmeemdfhdeiecnlchaacjaegagbhelmleghhleicnbdkgajikgcnmmhclmdoenfojecaaldoehlifggcklicmefdhjimcihhehdbhfkcmemnojlohkgmeinhfhjbggengehfkaddjajgacdgehbelmdohhohechelmcglcddhkjinmddjlclaccfnlnfbjnlagieokiihfdainnk...

output:

11264990424

result:

ok answer is '11264990424'

Test #29:

score: 0
Accepted
time: 65ms
memory: 5364kb

input:

bginfiikbcehakamkicnomkabonleibjjnagenmkicgkegcfihmlccmgejjbbamgjbnegclcmmmjbiabiocegcfnffmlgjnlekbhialcdalnbilmhcgcojoeghcknlblollcdgdnjfmoifjfadidhadmnlkdmjlflllhikbaiecomocefechjgconbnbdblokennfhhelgbinadmlmdbaicfabgelddhneeaaomecemiagdlekdmjlelglmbobfkgejcbaiochlllggiadandembgjnfehfbhdkimdooeacf...

output:

11266209262

result:

ok answer is '11266209262'

Test #30:

score: 0
Accepted
time: 22ms
memory: 5640kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0

result:

ok answer is '0'

Test #31:

score: -100
Wrong Answer
time: 20ms
memory: 4972kb

input:

baaaabbaaababaaabaabbbaabbaababbaabaabbbabbabbaabbaaabaabbabbabbbbaaabaabbaaabbbabbbaababaabaabbaabbabaabbbbbbaaabaabbaaabbabbbababbabbabbbaaaabbbbbababbabaabbaabbabbaaaabbabaabbaabbaaabbbabbbbaabbbaaaabbbbbbbbbbbabaabbabaabbbabbbabbbabaababaaaaabaaaaaabbbabaaabbbbbbbbbaabbbbabaaaabbaababbbbbabbaaab...

output:

0

result:

wrong answer expected '11283120735', found '0'