QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356309#8176. Next TTPC 3willowWA 1231ms240908kbC++144.8kb2024-03-17 17:28:532024-03-17 17:28:54

Judging History

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

  • [2024-03-17 17:28:54]
  • 评测
  • 测评结果:WA
  • 用时:1231ms
  • 内存:240908kb
  • [2024-03-17 17:28:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
const int N = 1005;
const int MAXN = (1 << 21) + 5;
const LD PI = acosl(-1.0);

char s[4][N];
int n, m[N], ok1[MAXN], ok2[MAXN], cnt[MAXN];
LL sx[MAXN], sy[MAXN];

struct comp {
    LD r, i;
    comp() {}
    comp(LD _r, LD _i): r(_r), i(_i) {}
    friend comp operator + (comp a, comp b) {
        return comp(a.r + b.r, a.i + b.i);
    }
    friend comp operator - (comp a, comp b) {
        return comp(a.r - b.r, a.i - b.i);
    }
    friend comp operator * (comp a, comp b) {
        return comp(a.r * b.r - a.i * b.i, a.r * b.i + a.i * b.r);
    }
    friend comp operator / (comp a, LD b) {
        return comp(a.r / b, a.i / b);
    }
};

int len, rev[MAXN];
comp w[MAXN], F[MAXN], G[MAXN];

void FFT_init(int m) {
    int bit = -1;
    for (len = 1; len < m; len <<= 1) ++bit;
    for (int i = 0; i < len; ++i) {
        rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << bit);
    }
    for (int i = 1; i < len; i <<= 1) {
        comp wn(cos(PI / i), sin(PI / i)), wnk(1, 0);
        for (int k = 0; k < i; ++k) {
            w[i + k] = wnk;
            wnk = wnk * wn;
        }
    }
}

void DFT(comp *a) {
    for (int i = 0; i < len; ++i) {
        if (i < rev[i]) {
            swap(a[i], a[rev[i]]);
        }
    }
    for (int i = 1; i < len; i <<= 1) {
        for (int j = 0; j < len; j += (i << 1)) {
            for (int k = 0; k < i; ++k) {
                comp x = a[j + k], y = w[i + k] * a[j + k + i];
                a[j + k] = x + y;
                a[j + k + i] = x - y;
            }
        }
    }
}

void IDFT(comp *a) {
    DFT(a);
    reverse(a + 1, a + len);
    for (int i = 0; i < len; ++i) {
        a[i] = a[i] / len;
    }
}

void Exgcd(LL a, LL b, LL &x, LL &y) {
    if (b == 0) {
        x = 1; y = 0;
        return;
    }
    Exgcd(b, a % b, y, x);
    y -= (a / b) * x;
}

inline LL Findl(LL L, LL x, LL d) { //find smallest i s.t. x + i*d >= L
    if (L - x >= 0) {
        return (L - x + d - 1) / d;
    } else {
        return -(x - L) / d;
    }
}

inline LL Findr(LL R, LL x, LL d) { //find largest i s.t. x + i*d <= R
    if (R - x >= 0) {
        return (R - x) / d;
    } else {
        return -(x - R + d - 1) / d;
    }
}

void solve() {
    scanf("%d", &n);
    for (int i = 0; i < 4; ++i) {
        scanf("%s", s[i]);
        m[i] = strlen(s[i]);
    }
    int lcm1 = m[0] * m[1] / __gcd(m[0], m[1]);
    for (int i = 0; i < lcm1; ++i) {
        int i0 = i % m[0], i1 = i % m[1];
        ok1[i] = (s[0][i0] == 'T' && s[1][i1] == 'T');
    }
    int lcm2 = m[2] * m[3] / __gcd(m[2], m[3]);
    for (int i = 0; i < lcm2; ++i) {
        int i2 = i % m[2], i3 = i % m[3];
        ok2[i] = (s[2][i2] == 'P' && s[3][i3] == 'C');
    }
    LL d = __gcd(lcm1, lcm2);
    LL lcm = 1LL * lcm1 * lcm2 / __gcd(lcm1, lcm2);

    FFT_init(lcm1 + lcm2);
    for (int i = 0; i < lcm1; ++i) {
        F[lcm1 - i] = comp(ok1[i], 0);
    }
    for (int i = 0; i < lcm2; ++i) {
        G[i] = comp(ok2[i], 0);
    }
    DFT(F); DFT(G);
    for (int i = 0; i < len; ++i) {
        F[i] = F[i] * G[i];
    }
    IDFT(F);

    LL tot = 0, x, y;
    LL dif1 = lcm2 / d, dif2 = lcm1 / d;
    Exgcd(lcm1, lcm2, x, y);
    for (int i = 0; i < len; ++i) {
        cnt[i] = (int)(F[i].r + .5);
        if (!cnt[i]) continue;
        if ((i - lcm1) % d) continue;
        sx[i] = x * (i - lcm1) / d;
        sy[i] = y * (lcm1 - i) / d;
        LL xl = Findl(0, sx[i], dif1), xr = Findr(lcm / lcm1 - 1, sx[i], dif1);
        LL yl = Findl(0, sy[i], dif2), yr = Findr(lcm / lcm2 - 1, sy[i], dif2);
        tot += max(0LL, min(xr, yr) - max(xl, yl) + 1) * cnt[i];
    }
//cerr << lcm << ' ' << tot << endl;
    if (tot == 0) {
        puts("-1");
        return;
    }
    LL ans = 0;
    if (n > tot) {
        ans = (n - 1) / tot * lcm;
        n -= (n - 1) / tot * tot;
    }
    LL L = 0, R = lcm - 1, P = 0;
    while (L <= R) {
        LL M = (L + R) >> 1;
        LL ret = 0;
        LL lim1 = (M + 1) / lcm1, lim2 = (M + 1) / lcm2;
        for (int i = 0; i < len; ++i) {
            if (!cnt[i]) continue;
            if ((i - lcm1) % d) continue;
            LL xl = Findl(0, sx[i], dif1), xr = Findr(lim1 - 1, sx[i], dif1);
            LL yl = Findl(0, sy[i], dif2), yr = Findr(lim2 - 1, sy[i], dif2);
            ret += max(0LL, min(xr, yr) - max(xl, yl) + 1) * cnt[i];
        }
        for (int i = min(lim1 * lcm1, lim2 * lcm2); i <= M; ++i) {
            ret += (ok1[i % lcm1] && ok2[i % lcm2]);
        }

        if (ret >= n) {
            P = M;
            R = M - 1;
        } else {
            L = M + 1;
        }
    }
    printf("%lld\n", ans + P + 1);
}

int main() {
    solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3932kb

input:

3
TTPC
TLE
P
AC

output:

34

result:

ok "34"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

670055
TF
OITFKONTO
GFPPNPWTZP
CCZFB

output:

-1

result:

ok "-1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

910359
TOKYO
TECH
PROGRAMMING
CONTEST

output:

1401951321

result:

ok "1401951321"

Test #4:

score: 0
Accepted
time: 53ms
memory: 18900kb

input:

518530
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

518530

result:

ok "518530"

Test #5:

score: 0
Accepted
time: 256ms
memory: 65808kb

input:

252288
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

252288

result:

ok "252288"

Test #6:

score: 0
Accepted
time: 198ms
memory: 58660kb

input:

1000000
TTJLTTPNTTQNTTBJTTHZTTJSTTRUTTVWTTJXTTMGTTZHTTRWTTNHTTDWTTMGTTIDTTSYTTPPTTGQTTXYTTOETTYMTTZATTAOTTJNTTHHTTYLTTJBTTLLTTNNTTCITTCBTTDOTTNGTTPZTTUETTFHTTODTTCETTKXTTGUTTZSTTECTTFSTTHOTTESTTNQTTHJTTDPTTFKTTCMTTNMTTGRTTYPTTKQTTYCTTUITTYCTTWWTTZDTTCPTTRSTTLFTTPKTTEXTTUPTTXWTTDATTVUTTLCTTEGTTOLTTRI...

output:

-1

result:

ok "-1"

Test #7:

score: 0
Accepted
time: 186ms
memory: 58548kb

input:

359869
TTXTTTYTTTITTTHTTTRTTTOTTTETTTKTTTZTTTYTTTBTTTUTTTBTTTJTTTDTTTYTTTJTTTKTTTYTTTLTTTATTTLTTTITTTHTTTUTTTMTTTDTTTITTTPTTTITTTCTTTCTTTRTTTZTTTVTTTETTTGTTTNTTTUTTTGTTTYTTTJTTTKTTTQTTTSTTTPTTTWTTTPTTTZTTTETTTJTTTVTTTGTTTUTTTBTTTCTTTCTTTXTTTWTTTETTTFTTTGTTTDTTTATTTCTTTITTTWTTTWTTTITTTSTTTRTTTYTTTETT...

output:

-1

result:

ok "-1"

Test #8:

score: 0
Accepted
time: 186ms
memory: 58440kb

input:

856943
QNTJMTFRTNDTXOTJRTNNTCXTZNTQMTSBTMRTDMTMOTEATOXTHWTOJTQQTLITKRTNSTNITSMTRVTLLTKBTSATYVTHXTEZTRXTPNTEQTQDTVZTMOTJVTESTRQTBBTAXTMNTUBTULTFPTXQTIBTCMTXXTMZTOWTYVTPVTDSTMWTZDTGQTVMTRFTKDTQITKSTCQTOPTSRTJWTFCTEFTCKTISTELTWGTHOTODTQHTLETRCTSHTJITQGTSUTFDTFZTFYTBJTKNTMHTHWTOZTARTZGTQETRITMSTXVTZATKJ...

output:

-1

result:

ok "-1"

Test #9:

score: 0
Accepted
time: 191ms
memory: 58440kb

input:

12
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

-1

result:

ok "-1"

Test #10:

score: 0
Accepted
time: 189ms
memory: 58480kb

input:

1000000
WTTTNTTTLTTTZTTTWTTTKTTTDTTTATTTNTTTMTTTZTTTHTTTVTTTVTTTITTTSTTTNTTTSTTTPTTTVTTTWTTTJTTTRTTTQTTTFTTTQTTTMTTTMTTTYTTTWTTTLTTTMTTTNTTTCTTTWTTTSTTTVTTTDTTTUTTTLTTTCTTTCTTTZTTTQTTTQTTTWTTTDTTTQTTTZTTTUTTTQTTTITTTYTTTATTTATTTGTTTITTTWTTTYTTTYTTTFTTTHTTTPTTTDTTTWTTTRTTTLTTTNTTTFTTTNTTTNTTTCTTTBTTT...

output:

-1

result:

ok "-1"

Test #11:

score: 0
Accepted
time: 204ms
memory: 58472kb

input:

506084
TPTGTATITNTJTPTBTZTDTRTVTJTVTSTFTWTNTATYTKTJTCTBTPTPTJTSTQTGTPTKTYTBTMTXTVTMTUTFTPTRTYTVTFTATCTLTITVTUTNTATCTJTYTOTOTMTKTBTMTMTKTQTWTBTHTITATUTYTNTETRTYTWTDTLTCTPTGTKTMTETGTCTWTMTNTKTMTATDTQTWTWTPTMTRTYTQTMTJTCTGTXTDTUTSTBTYTFTKTGTYTHTNTOTOTXTQTITITSTGTUTMTNTPTETJTDTJTRTBTKTXTCTSTRTZTSTWTUTJT...

output:

-1

result:

ok "-1"

Test #12:

score: 0
Accepted
time: 286ms
memory: 64552kb

input:

95378
JTTGTTYTTMTTFTTSTTUTTBTTNTTSTTVTTKTTYTTUTTITTFTTYTTKTTSTTSTTATTMTTQTTMTTLTTRTTWTTQTTLTTWTTPTTYTTGTTPTTNTTUTTRTTKTTWTTHTTVTTGTTMTTQTTUTTXTTCTTZTTUTTBTTDTTPTTJTTETTZTTNTTOTTKTTITTOTTGTTSTTQTTVTTZTTATTBTTATTOTTYTTZTTZTTZTTDTTPTTHTTMTTDTTLTTNTTNTTITTETTRTTYTTOTTWTTZTTGTTGTTRTTXTTKTTGTTVTTDTTSTTWTT...

output:

27097032

result:

ok "27097032"

Test #13:

score: 0
Accepted
time: 291ms
memory: 65716kb

input:

12
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

10636

result:

ok "10636"

Test #14:

score: 0
Accepted
time: 298ms
memory: 65712kb

input:

1000000
LTTTWTTTLTTTWTTTITTTQTTTWTTTKTTTSTTTGTTTLTTTHTTTXTTTFTTTYTTTPTTTBTTTFTTTYTTTBTTTZTTTYTTTHTTTNTTTVTTTKTTTMTTTITTTQTTTYTTTYTTTZTTTGTTTBTTTLTTTMTTTJTTTYTTTVTTTITTTYTTTRTTTCTTTHTTTRTTTUTTTWTTTQTTTITTTVTTTWTTTMTTTRTTTFTTTITTTYTTTETTTFTTTHTTTOTTTYTTTOTTTXTTTFTTTLTTTRTTTFTTTGTTTETTTBTTTVTTTETTTWTTT...

output:

907999396

result:

ok "907999396"

Test #15:

score: 0
Accepted
time: 305ms
memory: 64588kb

input:

713716
BTTCTTOTTZTTWTTOTTHTTITTITTITTWTTGTTFTTJTTMTTWTTRTTGTTFTTLTTJTTDTTWTTITTRTTMTTQTTDTTJTTWTTHTTKTTRTTQTTSTTETTKTTYTTRTTSTTGTTQTTYTTOTTCTTLTTSTTOTTETTUTTRTTETTLTTQTTYTTYTTITTUTTXTTZTTXTTJTTQTTWTTWTTMTTRTTATTNTTSTTJTTKTTGTTHTTVTTSTTRTTXTTMTTUTTNTTPTTQTTHTTJTTHTTETTQTTGTTGTTATTITTATTBTTQTTWTTHTTWT...

output:

563121569

result:

ok "563121569"

Test #16:

score: 0
Accepted
time: 297ms
memory: 65380kb

input:

11522
TXTTTHTTTVTTTOTTTFTTTZTTTKTTTZTTTJTTTDTTTPTTTRTTTHTTTOTTTXTTTCTTTWTTTNTTTDTTTSTTTWTTTCTTTHTTTXTTTFTTTSTTTOTTTHTTTCTTTWTTTUTTTXTTTSTTTZTTTXTTTLTTTETTTKTTTLTTTXTTTLTTTVTTTATTTLTTTHTTTDTTTITTTQTTTLTTTKTTTETTTATTTHTTTYTTTOTTTDTTTSTTTCTTTVTTTRTTTITTTITTTMTTTPTTTNTTTJTTTXTTTKTTTXTTTGTTTCTTTUTTTCTTTW...

output:

11152921

result:

ok "11152921"

Test #17:

score: 0
Accepted
time: 195ms
memory: 58676kb

input:

1000000
YHTTKJTTFNTTMITTNWTTOETTWJTTCFTTIRTTVJTTJMTTHOTTBITTLXTTRLTTVLTTOFTTMYTTOGTTAYTTVLTTCRTTENTTLKTTKETTXPTTSFTTCZTTGLTTJZTTGFTTOYTTSFTTLHTTNMTTANTTSGTTKKTTXETTABTTSBTTLLTTQOTTNDTTWATTERTTAUTTMWTTISTTASTTZJTTPXTTONTTVGTTEATTVBTTXGTTSITTPNTTLITTLQTTHVTTKOTTQGTTVLTTDQTTLHTTJETTWFTTDFTTIQTTIETTKHTT...

output:

-1

result:

ok "-1"

Test #18:

score: 0
Accepted
time: 211ms
memory: 58488kb

input:

1000000
TTXZTTYMTTVYTTASTTUPTTABTTLRTTEPTTQPTTMKTTCOTTPKTTPGTTSITTDRTTQSTTCPTTXWTTXBTTJDTTZNTTIPTTIOTTKJTTQITTEJTTJRTTAQTTIBTTAETTUOTTUETTDRTTNFTTPZTTYHTTMZTTQDTTCDTTVDTTHNTTXKTTUPTTFPTTYFTTIUTTUBTTJATTYFTTJWTTGUTTPXTTIPTTHSTTVATTHWTTWZTTMSTTJRTTYWTTSRTTUPTTDQTTKJTTIUTTVBTTNOTTBGTTINTTAMTTRNTTAXTTDW...

output:

-1

result:

ok "-1"

Test #19:

score: 0
Accepted
time: 193ms
memory: 58748kb

input:

367325
TSITTGUTTPJTTVDTTSSTTIJTTZATTKGTTPATTCKTTBWTTYKTTRUTTMOTTUQTTEDTTFLTTYOTTRITTYVTTGXTTVJTTWPTTVDTTAFTTSOTTJZTTDKTTBUTTSPTTFSTTHXTTKDTTVJTTCUTTALTTRHTTAJTTZHTTZDTTAOTTJVTTLKTTSXTTFITTDPTTGSTTXRTTEITTOQTTEPTTVCTTSITTJUTTPXTTZWTTPKTTUZTTLWTTYBTTFETTJYTTLDTTGSTTIITTKFTTKHTTUGTTVPTTXNTTFCTTLZTTYXTT...

output:

-1

result:

ok "-1"

Test #20:

score: 0
Accepted
time: 186ms
memory: 58992kb

input:

1000000
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...

output:

-1

result:

ok "-1"

Test #21:

score: 0
Accepted
time: 195ms
memory: 58956kb

input:

1000000
NTTNWTTJFTTLMTTSATTRWTTEXTTBETTPBTTEBTTXPTTUDTTWVTTWMTTWZTTCATTSBTTKBTTEKTTNHTTPBTTCATTVITTPJTTCYTTAPTTVLTTDHTTVQTTJUTTCFTTLXTTODTTFMTTXRTTRLTTNPTTVNTTYMTTOXTTDUTTVZTTSDTTMPTTYCTTLKTTFATTCETTUFTTGDTTKVTTGYTTVATTYZTTQRTTWQTTMGTTFXTTLDTTXRTTGFTTPLTTQQTTOVTTEOTTJSTTXSTTQKTTRVTTWZTTKXTTRBTTRRTTM...

output:

-1

result:

ok "-1"

Test #22:

score: 0
Accepted
time: 289ms
memory: 65324kb

input:

1000000
DTTTATTTBTTTUTTTUTTTNTTTDTTTITTTATTTRTTTFTTTJTTTZTTTDTTTRTTTETTTWTTTCTTTHTTTFTTTBTTTJTTTUTTTWTTTJTTTCTTTETTTYTTTHTTTWTTTETTTWTTTCTTTZTTTWTTTYTTTKTTTRTTTLTTTVTTTETTTOTTTDTTTPTTTLTTTMTTTWTTTCTTTXTTTDTTTPTTTVTTTFTTTATTTKTTTWTTTOTTTUTTTPTTTZTTTMTTTETTTWTTTRTTTPTTTRTTTHTTTFTTTYTTTRTTTKTTTJTTTETTT...

output:

452272320

result:

ok "452272320"

Test #23:

score: 0
Accepted
time: 322ms
memory: 66648kb

input:

1000000
CTITITNTHTTTBTZTNTMTFTCTZTJTRTBTUTPTWTWTNTUTMTUTETITITATKTMTRTPTVTXTPTHTNTGTSTMTUTWTKTWTITBTCTHTFTWTDTHTWTBTSTNTNTCTGTVTVTVTMTVTITWTJTRTYTETMTKTFTGTPTXTHTGTXTVTPTHTKTSTMTUTMTLTCTDTHTGTUTVTPTYTQTOTBTMTZTZTWTOTFTGTATBTFTQTNTPTGTLTYTKTPTCTFTATSTDTQTBTXTATVTRTGTITSTITDTKTPTNTKTKTBTATWTKTRTBTMTDT...

output:

975999035

result:

ok "975999035"

Test #24:

score: 0
Accepted
time: 573ms
memory: 129168kb

input:

11
WHLKKWTICHLBXNJKGGFGQLTLEHQUIYKLQZVWFFAVIDVCVJHUSJTYQTIJECJNQCLEJNZPKMPVBPKZHENYFXCSXZEUVJAFLMWIZPDWQDNRPBIGBTMNQKQOGJFEQYDHQYIBZXHBMWTJZJJWYWCQLEDVCUVCDMPEWOXGRADJQGRANTLNMTMHALLKTZYLFZPOPTOGKSTJBGJEGKBONVGJUSQDPBTECDEDGHAZCZOMZBMXVVTNMLPPLBVHLZXASGFRAIBAULIYDEHASZNGQDUBZCRTZYIXBDYWAGOIGCOAAPPON...

output:

6385324

result:

ok "6385324"

Test #25:

score: 0
Accepted
time: 1231ms
memory: 240908kb

input:

14
UCBNFDDWTZCYVRYRQCEWBIVBQADDGNHJDJIPZMHCDWLAJDEJXIJIQTUOSNEUONNQIMOCRLSQXBPHDPQYBJLRQMANSCKNMCORGLIGAVBZQWQJKZFYDARHAZWYQOWYBKTWYESJAXNWDEEITRMCAPWAVVQQCCKQBSIPEGYZQXHYLWFOIYQBFESGUABSXJTOLACYNAUGFXJIBICEDPFLCUGQPDVZVGXRBKSHIDMFGEAAAPVCEBZJIZJQJTXQEPLZXFUQYWWPBQIDQDAXCGSBJNMBVOQTPWMTVVIZZTZZNOLBN...

output:

3768074

result:

ok "3768074"

Test #26:

score: -100
Wrong Answer
time: 586ms
memory: 128144kb

input:

621991
PHSWLBLHWDNEUDLSMTKUPSYGZVVTXZVDFLIJERLKFTKBCPATGFTPXCYHAHBCPCFDBHHJMGDDIHSCNHNJMDPGMXXBSVCQMWALQNVOVWESQDBUTDPUMOUFTIHPQPYFUSWARGPFZFVUNNRUBOTHERYQVKCODQOMKXOAKSQEOVEXDNCHYNIVKEJJVJSZSSCQKXDWVMSWEXXKOYMQZSGCLTFQIRZMVVXXPJSGDZWRZYIJOLGGZCAHKUGSMEOHLJZKYZGIEHQDAIGBAPTJQIXUCMZDTDPAWACGFJWUWPRVS...

output:

285656431580

result:

wrong answer 1st words differ - expected: '285656877012', found: '285656431580'