QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#123402#6106. Making NumberSpaceJellyfishWA 159ms9868kbC++172.3kb2023-07-12 15:18:312023-07-12 15:18:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-12 15:18:34]
  • 评测
  • 测评结果:WA
  • 用时:159ms
  • 内存:9868kb
  • [2023-07-12 15:18:31]
  • 提交

answer

#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
int n, m, cnt[15], c[100005][15];
char s1[100005], s2[100005];
int lowbit(int x) { return x & (-x); }
void Add(int id, int x, int val) {
    for (int i = x; i <= n; i += lowbit(i))
        c[i][id] += val;
}
int Query(int id, int x) {
    int res = 0;
    for (int i = x; i >= 1; i -= lowbit(i))
        res += c[i][id];
    return res;
}
bool chk(int x) {
    int cnt2[15];
    for (int i = 0; i <= 9; i++) {
        if(cnt[i] < Query(i, x))
            return false;
        cnt2[i] = cnt[i] - Query(i, x);
    }
    if(x == n)
        return true;
    int nw = x + 1;
    for (int i = 9; i >= 0; i--) {
        if(s2[nw] - '0' > i)
            return false;
        if(Query(i, nw + cnt2[i] - 1) - Query(i, nw - 1) < cnt2[i])
            return true;
        nw = nw + cnt2[i];
        if(nw == n + 1)
            return true;
    }
    return true;
}
int Ask(int pos) {
    if(!chk(0))
        return -1;
    int l = 0, r = n, ans = -1;
    while(l <= r) {
        int mid = (l + r) >> 1;
        if(chk(mid))
            l = mid + 1, ans = mid;
        else
            r = mid - 1;
    }
    // cout << "$ " << ans << endl;
    if(pos <= ans)
        return s2[pos] - '0';
    int cnt2[15];
    for (int i = 0; i <= 9; i++)
        cnt2[i] = cnt[i] - Query(i, ans);
    int val = s2[ans + 1] - '0';
    // cout << val << endl;
    for (int i = 0; i <= 9; i++)
        if(i > val && cnt2[i]) {
            --cnt2[i];
            val = i;
            break;
        }
    if (pos == ans + 1)
        return val;
    pos = pos - ans - 1;
    for (int i = 0; i <= 9; i++) {
        if(cnt2[i] >= pos)
            return i;
        pos -= cnt2[i];
    }
    return 9;
}
int main(){
    scanf("%s%s", s1 + 1, s2 + 1);
    n = strlen(s1 + 1);
    scanf("%d", &m);
    for (int i = 1; i <= n; i++)
        ++cnt[s1[i] - '0'];
    for (int i = 1; i <= n; i++)
        Add(s2[i] - '0', i, 1);
    while(m--) {
        int opt, l, x;
        scanf("%d%d", &opt, &l);
        if(opt == 1) {
            scanf("%d", &x);
            Add(s2[l] - '0', l, -1);
            Add(x, l, 1);
            s2[l] = '0' + x;
        }
        else
            printf("%d\n", Ask(l));
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3304 1615
6
2 3
2 4
1 1 3
2 2
1 2 4
2 1

output:

3
4
0
3

result:

ok 4 number(s): "3 4 0 3"

Test #2:

score: 0
Accepted
time: 1ms
memory: 5860kb

input:

838046 780357
10
2 1
2 2
1 2 4
2 3
2 4
1 4 5
2 5
2 6
1 1 9
2 2

output:

8
0
3
4
6
8
-1

result:

ok 7 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

2950 9052
4
2 1
2 2
2 3
2 4

output:

9
0
5
2

result:

ok 4 number(s): "9 0 5 2"

Test #4:

score: 0
Accepted
time: 130ms
memory: 9848kb

input:

677626993975892499704039030543272430899275243910257911804799779050091046516452988178013531014268918811173939650642586439566406179191340032290242471164620397693718115937469230865639050202204033086180013798392250945514997389392089836361472892923108709052296874567465127993121832785182254870655135620662...

output:

7
9
3
6
0
4
7
1
1
4
1
5
4
5
2
1
3
8
3
8
4
9
5
8
1
5
6
1
3
9
4
7
2
2
4
1
2
0
1
8
3
7
0
8
5
9
9
4
9
4
4
4
7
1
5
6
3
0
3
7
4
6
2
4
9
6
4
8
2
0
4
4
2
0
6
4
8
4
9
9
9
0
4
6
8
1
9
6
5
8
3
1
5
4
8
8
7
7
4
0
0
6
2
0
3
9
8
6
8
2
9
2
7
6
1
4
3
8
9
6
4
8
3
5
4
7
5
7
4
1
7
5
3
9
0
9
8
9
1
5
6
8
9
8
5
5
0
1
8
0
...

result:

ok 49975 numbers

Test #5:

score: 0
Accepted
time: 115ms
memory: 9868kb

input:

511480086753564282821528855178563929745572703769018450686519315364994143491916967272893579288334926852555836951575502077626800161580974941822438484334857675128558893510619871726746734393334541554012208506864881136634075294480149999489082362631943342210952658415428622030685123950393010171647050758706...

output:

6
2
8
5
5
4
6
0
4
4
7
6
0
7
4
5
2
2
4
3
9
5
3
5
9
7
3
4
4
7
6
6
1
8
8
9
5
3
4
8
8
5
2
1
1
9
9
4
6
6
3
5
0
3
5
9
5
1
6
4
2
3
0
0
2
4
2
0
1
0
4
4
6
0
7
7
2
4
6
8
3
4
8
7
8
7
8
3
2
1
6
0
5
7
6
0
1
7
4
8
3
3
0
6
8
2
7
0
8
4
5
3
5
5
5
2
2
6
8
1
2
0
4
7
6
9
5
1
7
5
4
8
7
5
7
9
6
7
2
4
4
1
8
3
6
6
7
4
9
1
...

result:

ok 49929 numbers

Test #6:

score: 0
Accepted
time: 124ms
memory: 9648kb

input:

472330038062685403802290048373688812241446646131931548371358882106958120983785742309604463056365028053384497842197902484437459388258909692021136121000437587309020081655554248416237604736980589208691771671180049141616984590478595217573559381574160795133081222146011610538801003982869672106413196666521...

output:

1
0
7
0
7
5
8
3
3
2
4
7
0
4
1
9
1
4
7
0
4
2
6
0
5
7
2
2
7
6
3
9
4
5
9
1
0
1
6
9
4
3
2
3
9
9
1
2
6
7
1
3
0
3
9
0
3
3
8
7
2
0
5
9
5
4
1
5
3
0
2
7
7
9
2
4
2
9
9
2
8
8
7
2
1
4
0
0
9
8
7
0
9
1
4
2
4
1
0
8
2
8
5
3
5
6
3
9
5
3
3
2
2
1
7
1
5
3
1
4
5
9
2
9
7
8
2
5
7
3
6
8
6
0
5
9
8
6
0
5
0
9
9
4
4
7
5
2
9
0
...

result:

ok 50042 numbers

Test #7:

score: 0
Accepted
time: 121ms
memory: 9616kb

input:

386233463881717072875581827146070520751747126770517661713166628789189627724980782503822688280432695205513144141020509128499902342551505341291338189246300115206785134828666443367135785829882467172883975489827563563779932862926264780289693656829908932995843695380306139371737193136677430867087011811629...

output:

3
4
1
9
4
5
6
9
2
7
5
6
6
3
1
3
4
1
1
8
9
8
4
9
2
6
5
8
6
2
6
5
2
0
9
2
6
2
5
1
0
7
4
0
0
8
6
3
2
1
1
8
7
0
8
2
9
7
4
7
8
0
4
4
4
1
6
2
3
5
2
5
7
4
7
5
2
8
5
6
7
9
8
3
4
6
6
5
4
6
6
2
6
3
9
8
8
9
1
1
8
0
3
5
8
1
9
2
8
8
3
7
6
8
3
3
7
1
8
7
6
4
4
3
5
1
9
7
0
8
7
4
7
5
2
1
3
3
9
4
0
1
4
7
9
8
2
8
2
1
...

result:

ok 49992 numbers

Test #8:

score: 0
Accepted
time: 139ms
memory: 9728kb

input:

745583415671483224856063268315723013208093546585338940411563348183242984213440969816633586058807593886948284456364509705729509729228715032842535706716746469625245322861513742352222229050932105542759840801595902514973411977932610802947368055541931365403552209659301957818972982202503192705179196359265...

output:

2
6
5
5
6
3
5
3
8
4
8
8
2
9
8
7
4
2
9
3
7
4
5
7
6
3
3
7
3
3
8
8
1
1
6
9
3
7
6
1
6
0
7
2
5
9
6
9
8
7
5
2
4
2
2
3
5
1
1
0
4
6
5
9
4
4
3
3
4
8
9
7
3
3
6
6
2
5
9
4
8
8
9
6
5
6
6
1
8
9
6
6
4
8
1
6
3
9
5
3
0
4
6
0
3
2
5
4
0
1
1
9
1
3
3
3
7
6
3
8
3
4
2
3
9
1
3
5
9
3
6
4
7
6
1
2
3
9
3
7
0
4
3
0
1
8
9
3
4
9
...

result:

ok 49998 numbers

Test #9:

score: 0
Accepted
time: 111ms
memory: 9620kb

input:

687148149898590835128734096020818522700529479354111091949312960135002085101685319911019178222572129521797945953853905713726059302432395983082137469982521105165791059980657901801789909933674074000321433370751326550034923277070556265051872985662112168660614913449190413055498618459115952038181012606241...

output:

8
9
1
3
3
5
6
1
9
6
8
7
8
4
4
1
0
8
7
4
5
3
1
9
6
1
7
1
3
5
0
9
2
9
8
9
1
9
3
6
5
7
5
0
4
8
2
7
4
5
0
5
8
4
1
4
4
0
2
2
2
8
6
8
2
4
8
7
4
8
1
4
4
9
9
0
8
2
2
9
6
7
8
8
2
7
3
5
6
0
0
8
1
6
3
3
8
9
9
7
7
8
5
0
1
9
8
0
3
7
8
3
6
9
3
1
6
8
8
6
8
6
4
2
7
1
4
4
7
8
8
5
7
5
0
2
6
6
9
5
6
4
9
9
0
8
1
0
1
7
...

result:

ok 49960 numbers

Test #10:

score: 0
Accepted
time: 124ms
memory: 9576kb

input:

511410590003206748743026837297269617156860999163734519503176440751003346982052198127800474000547281930526632644516345712652806992189907653673339456162173013088973643589761306561810879584560558973989908184836364781078674144968906782339481360394956565722773781126049434152414561245822910375917863114385...

output:

6
5
8
4
6
7
3
3
7
5
4
7
3
4
9
7
5
7
5
9
6
7
1
1
0
4
6
6
6
2
1
1
1
1
1
4
3
0
6
6
1
3
1
8
5
6
9
4
1
3
1
3
3
1
2
6
7
4
5
8
9
1
9
5
4
0
6
2
0
8
5
3
3
6
5
2
4
0
9
3
3
7
7
1
5
3
0
0
2
1
4
7
5
3
3
7
4
9
0
0
9
7
1
3
0
3
3
9
6
7
3
6
6
5
7
1
4
1
6
8
3
5
1
1
6
5
8
7
7
8
6
0
6
9
3
3
7
3
5
4
1
6
3
3
5
9
9
3
8
6
...

result:

ok 50026 numbers

Test #11:

score: 0
Accepted
time: 133ms
memory: 9852kb

input:

412360324827978957176583694828310104622570454802673606075377276215378423471812273240200693215211478171394399847108642814672419979452510744863417210894498320009435941598606905856781313771012596687811178858150589131279746416550676044440596239657711594345549954832445910296588861477458018692941905242921...

output:

1
8
5
2
3
9
2
8
3
8
4
3
6
5
4
1
3
1
3
5
5
8
9
2
6
1
6
4
0
6
6
3
5
6
3
4
8
3
9
0
4
0
2
4
7
5
4
3
3
6
9
9
3
2
6
9
4
9
8
7
5
4
7
7
1
0
3
2
7
7
3
8
7
4
8
3
9
9
1
1
3
6
3
4
3
6
4
5
5
7
2
2
4
6
3
3
7
3
0
8
7
9
6
8
8
3
5
0
5
9
4
3
1
2
5
4
2
7
1
8
9
8
3
5
1
0
9
4
2
4
2
3
3
1
3
4
8
4
6
3
6
9
8
0
1
1
9
5
5
3
...

result:

ok 49948 numbers

Test #12:

score: 0
Accepted
time: 146ms
memory: 9844kb

input:

856329357016035505153679499429017618522016754810690745637585353807331320998717013354091215483446306780029058518021052461209557195048736635002613733400864914984195578672150918541302093698958464131643763263426069118339541672648022567592260494469158830001260168605992533833064759869674003545017260491009...

output:

6
8
7
0
4
5
2
3
8
9
4
3
9
1
9
5
6
7
3
4
6
6
6
8
1
8
7
5
3
2
4
0
5
5
4
0
7
1
7
6
2
0
8
7
1
0
7
9
6
3
6
7
0
1
5
1
5
4
9
6
9
7
5
3
9
9
0
0
1
1
1
6
0
0
1
6
2
6
9
5
5
6
8
9
2
4
9
8
4
4
3
1
8
7
5
6
4
3
6
3
5
8
1
6
8
2
2
7
5
6
1
6
8
0
9
8
8
2
2
6
9
8
6
6
5
0
8
2
8
9
1
7
9
8
8
6
6
4
7
7
8
6
0
3
4
0
8
9
5
5
...

result:

ok 50026 numbers

Test #13:

score: 0
Accepted
time: 102ms
memory: 9808kb

input:

207978770069539728817271045945248746241818636280006621963858065263619645208863709951955581650441063780888002768150890864716529529107478452273845099423444295437542775021972720210956321827972662761649312268042113348860266380256320778223985862679633592673273717863417100156085087721855894555348405500719...

output:

0
2
8
1
3
4
5
2
7
1
3
4
7
4
2
8
7
8
8
6
1
3
2
5
4
1
2
8
3
1
9
7
6
1
1
1
6
2
9
9
1
2
5
8
6
0
3
9
3
5
3
5
1
5
9
9
1
7
9
6
1
0
3
8
7
5
3
1
6
2
5
7
6
0
6
6
4
1
5
8
9
9
2
3
3
0
5
5
4
6
8
9
4
6
4
2
6
5
1
6
2
9
5
7
8
1
3
3
7
4
1
6
4
9
7
8
2
9
7
4
7
1
4
7
7
9
1
1
8
6
5
2
3
7
6
7
5
9
1
5
1
4
6
8
0
7
1
6
5
2
...

result:

ok 50025 numbers

Test #14:

score: 0
Accepted
time: 109ms
memory: 9628kb

input:

164428742658650397298339420552443455101568119017687712665088396853574942791024688455356045424416501995017237219123098822376166101955464501466812812649086495459262962860410367705834209150622335631443903792735958848302687895202370035731150731351456335899336987100067685293569877313567752878310940738755...

output:

1
8
6
9
4
2
1
1
4
5
2
7
5
5
3
5
9
0
8
1
3
2
5
3
8
1
5
8
5
1
8
6
4
8
2
3
5
8
0
2
1
6
1
4
6
2
8
1
8
9
8
7
1
0
0
2
5
1
8
7
7
4
8
5
2
5
8
3
8
6
7
7
5
8
0
2
3
3
7
7
0
1
6
1
0
4
6
6
8
7
8
6
2
9
6
0
2
1
5
1
4
0
6
2
8
9
4
9
8
1
9
8
3
0
4
5
0
9
8
3
1
8
1
6
8
0
8
5
8
8
1
9
5
0
1
0
3
4
2
2
9
5
3
7
5
6
2
2
0
6
...

result:

ok 50022 numbers

Test #15:

score: 0
Accepted
time: 148ms
memory: 9864kb

input:

998767354558322906625620015167794944657818251826400836199407978416545069691547034108346073612303533094806958918805437473506719658260875212008010754739853345390768650837328322896341589343550573089739136161331978235561797773390415153085804136062697178719078131890066607436125156355189718122782466286459...

output:

8
7
1
8
6
9
3
0
3
8
4
4
7
4
8
6
5
6
3
6
8
9
2
0
3
6
6
5
1
5
9
0
4
2
4
4
9
8
7
3
5
4
5
6
7
5
2
5
3
9
2
3
8
0
1
9
8
2
2
7
5
6
9
4
1
7
2
3
5
8
7
6
5
1
8
7
9
6
5
6
8
3
0
2
3
8
1
6
9
0
0
2
2
6
5
5
2
9
4
5
2
6
3
0
4
3
6
5
1
9
6
1
6
2
0
9
2
0
0
0
2
1
7
1
9
4
6
4
5
3
5
7
3
7
0
6
9
0
0
9
6
3
3
6
0
8
1
7
5
0
...

result:

ok 49925 numbers

Test #16:

score: 0
Accepted
time: 138ms
memory: 9812kb

input:

496117747349030859242712439552847857173335411600183925191605438390308987026311211708747951426974071035231015263358833473203227234913873963653616567985338093815470280976485981645438455282050097953301422963637710015063600088898465670743373005589682945970747704429911563933261846140395176443170301349475...

output:

8
7
8
7
3
9
0
9
9
6
6
6
6
9
4
4
8
7
9
0
4
3
9
2
0
4
0
5
7
0
0
2
2
0
4
7
9
3
7
5
9
4
1
7
5
0
5
8
2
2
3
1
1
5
4
8
2
9
9
9
3
3
5
9
2
2
3
8
0
2
7
9
0
7
6
2
0
5
7
6
5
4
5
7
9
1
0
5
7
9
0
5
8
1
7
4
8
8
6
2
5
3
2
9
9
8
6
5
3
1
6
6
9
9
2
4
6
0
7
7
2
9
5
0
1
7
1
3
7
9
2
1
4
8
6
1
6
1
3
5
3
5
4
3
6
3
0
7
6
8
...

result:

ok 49966 numbers

Test #17:

score: 0
Accepted
time: 132ms
memory: 9628kb

input:

879077611568305029524273214759692546023681920619909666645816914982402484913116250093137152695049206643460741460271833570279670253121465212427814124175174303836095991951317860795539333476942195636187095271368531406226910990880535137299873821691406148014509516363900520071195534330828232780282826477512...

output:

4
2
2
0
5
4
0
1
4
5
7
2
2
5
2
3
1
7
9
0
6
0
3
0
4
4
0
6
7
5
8
2
3
3
9
6
3
6
0
5
2
1
8
1
0
9
1
7
0
9
8
4
8
2
8
0
0
9
5
1
7
4
5
4
8
9
3
1
9
0
0
2
0
7
6
8
6
0
6
1
2
9
1
1
7
1
4
7
7
6
8
9
8
6
6
2
3
8
9
4
0
4
8
8
5
6
5
8
0
8
5
2
4
4
0
1
1
1
4
3
1
4
1
6
2
0
7
7
3
1
6
7
9
5
9
2
1
4
5
8
2
8
9
8
0
4
4
6
1
5
...

result:

ok 49930 numbers

Test #18:

score: 0
Accepted
time: 116ms
memory: 9620kb

input:

203968624374417872599305057960984030372982060448780195288250350584273341499079030196956080469617724888838406395743230124996577835874461904028816041291105143917991579964524439244822473009488603180812160846042219893300437496918585071513942690378687371239260250594909446238312463866438654013074218583158...

output:

4
4
2
1
9
2
8
7
7
9
0
0
9
0
3
6
0
0
0
3
2
0
6
4
6
4
8
7
8
3
4
6
4
3
3
9
7
5
2
8
2
0
9
3
7
8
1
9
1
8
6
2
5
1
4
2
3
8
7
9
5
5
1
8
8
4
8
5
5
9
3
1
4
8
1
5
1
1
5
3
5
4
8
0
3
3
7
3
3
6
2
3
1
4
3
1
9
4
2
5
2
2
4
6
4
6
0
4
4
9
2
2
9
2
9
8
3
8
3
6
4
8
1
1
3
4
5
9
6
0
2
1
4
1
9
4
9
4
0
4
5
9
6
5
0
0
6
4
2
7
...

result:

ok 50003 numbers

Test #19:

score: 0
Accepted
time: 115ms
memory: 9864kb

input:

664828096591123841572296486591075547872856344115703231722069827322096608384090019204366008637182716083677163674626630101166122412141233257614793889487901853834607207647628854345933911980118782654448753250508439833562347861706645574261195579084500718799334623432092033351838757658540625351640733190174...

output:

9
3
8
3
6
7
6
2
3
9
2
5
7
1
9
2
1
3
2
1
9
1
2
2
7
7
2
1
3
4
7
9
4
6
3
2
9
5
1
0
2
6
7
5
0
0
3
4
3
2
6
4
9
0
2
0
6
1
0
0
5
8
7
2
6
6
2
7
2
8
6
0
8
1
9
9
4
0
9
9
9
3
9
1
6
0
1
9
7
1
3
1
7
8
5
4
3
1
2
7
0
3
5
1
7
9
9
3
0
7
6
4
2
3
5
4
4
6
4
0
3
8
5
0
0
0
6
6
8
9
0
1
9
3
7
9
7
4
7
6
6
9
2
2
6
6
4
8
8
7
...

result:

ok 49932 numbers

Test #20:

score: 0
Accepted
time: 130ms
memory: 9672kb

input:

538277005780206492547758127106338332942166863920626370354889467904857105765864853407146908051557283832086050965218002709762370809755260168800991848537318108412183410666511031136010687133126586128270827928749854284725338763494617082398663948307548401951295673167687759918452646683358081278618679228278...

output:

5
6
6
5
5
2
9
7
4
0
3
5
0
7
5
7
4
4
0
6
6
9
2
0
9
7
2
9
2
1
3
8
4
1
1
0
7
0
9
4
5
7
7
2
1
3
9
2
7
8
4
9
4
0
7
9
8
2
3
1
3
3
3
9
1
4
5
7
2
7
9
7
0
2
2
0
6
4
9
7
2
1
8
1
0
2
9
5
9
3
9
6
5
2
0
0
0
3
7
3
3
2
0
6
2
2
8
1
9
4
3
4
0
5
9
9
6
4
9
2
4
6
1
2
3
3
1
1
7
4
7
6
0
7
1
9
6
8
8
2
6
3
2
5
5
7
5
2
7
7
...

result:

ok 49986 numbers

Test #21:

score: 0
Accepted
time: 115ms
memory: 9860kb

input:

495771171510956215425849505877989041934463907749463401816284949317967102657725642519357521827220981533415719496177403212899877861008462319189997565717292012399843108955067492885127568226666094372172812133495292610825814638596763445052778805429795808678025887319040351695928846875889183001500514376014...

output:

0
0
7
6
0
2
6
8
5
1
3
4
2
7
1
5
6
4
8
2
7
7
4
9
1
4
0
5
1
1
0
9
7
3
0
2
2
2
7
3
2
0
5
7
1
4
7
4
6
8
7
3
2
8
5
9
5
5
6
8
3
7
8
4
1
2
4
7
3
6
0
2
1
6
1
8
2
9
5
0
7
7
3
7
0
6
9
2
1
3
2
2
8
9
6
1
8
4
2
5
1
5
8
8
9
7
0
2
8
0
7
9
1
3
9
0
3
0
2
2
1
2
4
2
4
1
0
7
9
4
0
9
1
3
3
5
4
7
2
4
0
4
0
5
5
1
7
4
5
9
...

result:

ok 49938 numbers

Test #22:

score: 0
Accepted
time: 137ms
memory: 9628kb

input:

339021186719668483838715376004230534434933258139082986584033309451762283542528687694537199091395539732284376157061909810459620048718678068779193113943885652210405795974721651379416846641514792856746325971179616451066361148304792963168282675194510047836786751096975236151504932023091965948552679823138...

output:

6
7
0
8
9
9
0
7
1
7
4
6
0
7
6
6
4
6
9
5
7
0
0
4
2
6
2
2
2
7
4
8
2
0
3
8
6
2
4
9
2
1
3
9
3
9
2
7
3
8
4
5
3
0
2
8
7
2
8
6
0
4
8
1
7
3
6
9
0
5
1
6
7
9
0
4
7
0
6
6
0
1
1
3
1
9
2
7
6
7
4
0
0
2
7
3
4
3
1
9
8
2
1
5
8
8
7
0
5
1
7
7
6
9
0
7
2
1
1
3
0
4
6
1
1
4
1
7
8
8
8
9
0
0
7
5
5
0
6
1
3
7
7
2
0
7
2
4
7
5
...

result:

ok 49981 numbers

Test #23:

score: 0
Accepted
time: 104ms
memory: 9572kb

input:

982785026525426716882042936180514667751283786386206050446143243960867407815359255008057908268651562142164706343879003037524226079930774131586056314459643132401529562979630028015745276169684869852727881008541171308112403521690763653373751520126387382411044586528624189483080092870501589527365878963787...

output:

9
0
5
9
5
3
9
4
8
5
5
0
7
8
0
8
2
4
9
7
5
1
7
8
7
2
1
9
6
0
1
1
7
7
3
9
8
3
7
5
3
3
4
0
3
3
5
5
1
2
4
2
3
7
6
2
7
5
9
9
6
5
7
9
1
4
5
9
2
5
4
2
5
8
8
9
9
6
4
9
5
2
9
9
5
2
0
2
1
7
2
6
7
1
0
1
5
9
0
2
3
9
4
9
3
1
7
9
5
6
5
1
5
3
0
3
2
1
0
4
8
2
2
8
2
0
6
3
9
7
7
8
9
6
6
2
4
5
5
0
8
4
2
1
5
0
8
8
6
9
...

result:

ok 49935 numbers

Test #24:

score: 0
Accepted
time: 123ms
memory: 9628kb

input:

443189678460132360813229383747775566201531260183924145814374873124718304625184044102407980436726530281103403600495012079144539296227791201748933585065829937525249850952548487400872752642176523326750976376213596833271856626381717111637261715449128129329793550291211001960166382428116169484337714797923...

output:

2
3
5
8
5
1
0
3
4
9
3
8
9
3
0
3
6
7
3
7
0
8
3
0
6
3
9
0
4
9
8
1
7
3
7
0
3
4
8
7
9
8
0
4
7
9
6
8
9
1
3
7
2
7
1
5
1
2
9
5
8
6
4
5
3
0
8
9
9
1
5
3
7
1
4
9
4
4
8
2
1
0
7
3
5
4
4
4
8
2
4
9
9
9
3
6
3
9
8
2
9
3
2
5
2
8
0
9
2
6
7
4
3
7
2
8
6
1
0
7
3
0
4
7
8
7
6
2
0
0
0
0
2
8
5
6
1
8
4
3
0
2
5
1
2
0
2
9
6
2
...

result:

ok 49925 numbers

Test #25:

score: -100
Wrong Answer
time: 159ms
memory: 9856kb

input:

377878063054648573132795928952066251589852722198763685377798555912772465112969982319088416200394212086938168995388418666417588212990303556333139028105492643416261499977209596160279434433012015610306105181975416278435366998383873238763930635351946516940594922091276462427730172694022021737709235844047...

output:

2
5
6
8
6
6
8
6
9
6
3
8
6
0
9
0
1
0
0
8
3
9
9
4
0
5
5
4
1
4
2
0
6
1
0
3
0
6
2
3
8
2
3
8
5
1
1
8
6
9
3
5
4
3
2
3
9
2
6
2
4
7
2
6
4
0
1
8
6
0
4
9
4
5
1
0
7
8
4
1
7
5
0
1
8
3
5
3
3
7
2
5
4
0
7
1
4
7
7
1
0
7
6
5
0
2
9
3
8
0
9
0
3
4
9
0
0
8
6
7
2
4
0
5
2
8
7
1
6
1
8
8
6
6
6
4
2
8
1
6
0
7
2
9
9
8
1
1
1
0
...

result:

wrong answer 42240th numbers differ - expected: '2', found: '1'