QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#470594#1788. 量子通信Rikku_eq100 ✓2720ms200104kbC++142.5kb2024-07-10 15:22:512024-07-10 15:22:52

Judging History

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

  • [2024-07-10 15:22:52]
  • 评测
  • 测评结果:100
  • 用时:2720ms
  • 内存:200104kb
  • [2024-07-10 15:22:51]
  • 提交

answer

#include <bits/stdc++.h>
#define popcnt __builtin_popcountll 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=400005;
bool s[N+1][256];

const int B1=16, B2=64, B_1=16, B_2=4;

int n, m;
ull v1, v2;
int rec[18][N];
ull val[N][6], cval[6];
vector <int> res;
char ch[100];

struct Pnt {
    int id, j;
    bool operator< (const Pnt &x) const { return rec[id][j]<rec[x.id][x.j]; }
} vec[18][N];

ull myRand(ull &k1, ull &k2) {
    ull k3 = k1, k4 = k2;
    k1 = k4;
    k3 ^= (k3 << 23);
    k2 = k3 ^ k4 ^ (k3 >> 17) ^ (k4 >> 26);
    return k2 + k4;
}

void gen(int n, ull a1, ull a2) {
    for (int i = 1; i <= n; i++)
        for (int j = 0; j < 256; j++)
            s[i][j] = (myRand(a1, a2) & (1ull << 32)) ? 1 : 0;
}

void insrt (int id, int crec)
{
    int l=1, r=n, posl=n+1;
    while (l<=r) {
        int md=(l+r)>>1;
        if (rec[id][vec[id][md].j]>=crec) { posl=md; r=md-1; }
        else { l=md+1; }
    }
    for (int i=posl; i<=n && rec[id][vec[id][i].j]==crec; i++) { res.push_back(vec[id][i].j); }
}

int main ()
{
    // freopen("qi.in", "r", stdin);
    // freopen("qi.out", "w", stdout);

    scanf("%d %d %llu %llu", &n, &m, &v1, &v2);

    gen(n, v1, v2);

    for (int i=1; i<=n; i++) {
        for (int j=0; j<256; j++) {
            int id=(j>>4);
            rec[id][i]=(rec[id][i]<<1)+s[i][j];
            int id2=(j>>6);
            val[i][id2]=(val[i][id2]<<1)+s[i][j];
        }
    }
    for (int j=0; j<B_1; j++) {
        for (int i=1; i<=n; i++) { vec[j][i]=(Pnt){ j, i }; }
        sort(vec[j]+1, vec[j]+n+1);
        // for (int i=1; i<=n; i++) { cout<<rec[j][vec[j][i].j]<<" "; } cout<<endl;
    }

    bool ok=0;
    for (int t=1; t<=m; t++) {
        int k; scanf("%s %d", ch, &k);

        res.clear();

        int crec=0;
        memset(cval, 0, sizeof(cval));
        for (int i=0; i<64; i++) {
            int cur=(ch[i]<='9' ? (ch[i]-'0') : (ch[i]-'A')+10);
            if (ok) { cur=15-cur; }
            int id=((i*4)>>4);
            crec=(crec<<4)+cur;
            if (i%4==3) { insrt(id, crec); crec=0; }

            int id2=((i*4)>>6);
            cval[id2]=(cval[id2]<<4)+cur;
        }
        
        ok=0;
        for (int i=0; i<(int)res.size(); i++) {
            int id=res[i], cnt=0;
            for (int j=0; j<B_2; j++) { cnt+=popcnt(cval[j]^val[id][j]); }
            if (cnt<=k) { ok=1; break; }
        }
        printf("%d\n", ok);
    }

    return 0;
}

详细

Test #1:

score: 4
Accepted
time: 0ms
memory: 38740kb

input:

10 10 3121593961072376445 4518437979289293620
4D873CAB020EABF8DD2B01801D5322369C55C0E7DD33DBBC586B46EF61B773C0 1
2B4C005C4649569CB45D4461242FD5AA30FC1307EBADF182AD94C1BC09817552 0
3E1680722AD16F7ADCA40949BA54123F1EC351CB2EE0AF7C05FE807980106FB0 0
C1E97F8DD52E9085235BF6B645ABEDC0E13CAE34D11F5083FA017...

output:

1
0
0
1
0
0
0
1
1
0

result:

ok 10 lines

Test #2:

score: 4
Accepted
time: 0ms
memory: 38712kb

input:

500 500 3601229834022830072 507935868101158887
BE7697A65271C1B63137B53333D703DDE4ADE4C44FA00609811B8ABC9313A105 8
BAA641412B65AEC33AD3E240E0DB22FBAEC98F1A3627D245ECABCDF707CF2852 6
C035244C130BE610CF8EC22376B86B6EA4B5E3D64A9BCFDB629B08A9B6649797 12
B33804976AF19E439FDE953639A7CBE7E34CEB59DAA709DC36B...

output:

1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
1
1
0
1
0
0
0
1
0
1
0
1
0
0
1
0
0
0
0
1
1
1
0
0
1
0
0
0
1
1
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
1
0
1
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
0
0
0
1
1
1
0
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
0
1
1
0
0
1
0
1
0
0
0
0
1
1
1
1
0
1
0
...

result:

ok 500 lines

Test #3:

score: 4
Accepted
time: 4ms
memory: 38756kb

input:

1000 1000 2792704894877028803 3018331229909368696
33F3A2F90F60BC06D2974AC3D99365F313A166F1C0C6912A778347BC8116ABA5 0
BE66AAEB1CC0F55B86A621066E7267B770A3246C850DCE5E9F48B6DF55C3CB4C 0
77B91B480D512A55C79BFAD1B58D0DD0AFE57373DC6872E4F444FEDEF87D7729 0
E7CCB42515507273A9123362F000187A8F3D143F234F149B4...

output:

0
0
0
0
0
0
1
0
0
0
0
1
1
0
1
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
...

result:

ok 1000 lines

Test #4:

score: 4
Accepted
time: 8ms
memory: 38924kb

input:

2000 2000 4140677975591367086 3565171337357982581
2A5691176DCD2CADC152EC73EBE073415E9B63BB7B2A7FA13BD87A720807E248 2
9A450FFB9A292CFD899FA3EEF1A65D5F7EAEA8A796500AFF4D12DD76BFEE37E1 0
FED095E2805EE951CCC600D4DBF63451571C421855F534D98350428C693EF1E7 0
E812F9B868DE8C377000082BDAC127A0BA98EF1A80C9875A1...

output:

0
0
0
0
0
0
1
1
1
1
0
0
1
0
0
0
1
1
1
0
0
0
0
0
1
0
1
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
1
1
1
1
0
0
0
1
0
0
1
1
0
0
1
0
0
0
1
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
0
0
1
0
1
0
1
0
0
0
1
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
1
...

result:

ok 2000 lines

Test #5:

score: 4
Accepted
time: 26ms
memory: 43072kb

input:

5000 5000 337685833882778296 3667582177639210888
60F184C2DD41306E6D8562CD348F7423D40BC91C9F9063483C5874E733A8D7F1 9
976E136358EBBF86331B8B11186E8CF0C3798EA71AC68AFE5E0701C72AF672E4 10
953E9B24A41E1EC0A20B2D544E37949F807C626670233CBB3B01F661DF29FDAF 9
657A5C07B17E1A267ECBAB84C85BB0A33A15FA3CD10EB00C1...

output:

0
0
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
0
1
1
0
1
1
1
0
1
0
0
1
0
1
0
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
1
1
0
0
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
0
1
0
1
1
1
1
1
0
1
1
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
0
0
0
1
1
0
1
0
0
1
...

result:

ok 5000 lines

Test #6:

score: 4
Accepted
time: 48ms
memory: 41428kb

input:

10000 10000 1804854406036898939 2457090502516336412
70157138B16B7A5F5805C7A54B85E035C8DE0594E51B32486384CB44E5CC4026 9
5E09B58C1B0BAF0658C7F009169A90037D30584DE96B7B8DD82F8A9CA4A8B1DA 8
5E7AA7CE51D7226ABCA0F3F6E9B2C9738BF1BF7A1FA2B85172E770D960B376BF 10
6FC3FB9D9C43D19A1F4B4D6E3B150EB3F3A4A9AEF98ECE...

output:

1
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
0
0
1
0
1
0
0
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
1
0
1
1
1
0
1
1
0
0
1
1
0
0
1
0
1
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
1
1
0
1
0
0
0
0
0
0
1
1
1
0
1
1
0
1
1
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
0
1
1
1
0
0
1
1
0
0
0
0
1
0
0
1
0
1
1
...

result:

ok 10000 lines

Test #7:

score: 4
Accepted
time: 117ms
memory: 48872kb

input:

20000 20000 3141650340952718195 3590727650650471971
67BA4C0117AF05653FCA96730C3D92451E56C14653229D4B559A3C08F106CA92 9
5D8C4546DF1D0E2BC67317C75EF5AF36591B620A067B2CDEAD9C7308DB67BB8D 13
1AE6447B3E2B893B9BD6FC11271AE7D87E1D6083D1AEFA8BAF32F870A27E88C6 8
3FA9E522DF93A35907AACA02C5A60C78B655E866212E88...

output:

1
1
1
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
0
0
0
1
1
1
0
1
0
1
1
0
1
1
1
1
0
1
1
0
1
0
0
0
1
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
1
1
1
1
1
0
0
1
0
0
0
1
1
1
1
1
0
1
0
0
0
0
0
0
1
1
0
0
0
0
1
1
1
1
1
0
1
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
0
1
0
0
0
1
0
1
0
...

result:

ok 20000 lines

Test #8:

score: 4
Accepted
time: 828ms
memory: 89788kb

input:

100000 100000 3322121142976867601 102939062113468086
69EC2DA1A306AF91E6DD69B3ED22E74883D916D2926AECABAFA8ACECCABE21F2 1
4F92214357780E5B7C5B026E88F6269163F254E6C1CAF67E0A35E9E73B6429D9 0
6F4EC4F4BCC399AF89FD4DAC622D0B066CFC828DBA83839291D981F26913F563 0
C49C98A7BEA5D3B2A77966FE5DF7E1B62F93863A7B1CE9...

output:

1
0
0
0
0
0
1
1
1
0
0
0
1
1
0
0
0
0
1
0
0
0
1
0
0
1
0
0
1
0
1
1
1
0
0
0
0
1
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
1
0
1
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #9:

score: 4
Accepted
time: 2720ms
memory: 199796kb

input:

400000 120000 3664185765448252490 670081501006793320
286C617D5CB8E0B40C99CA83C065CAE43F9DCADE454894617DD85A8689424F35 1
A70F53F5762205981819B5C4BF5D535CDDC11541DD81F9F301CA0EE2AA977728 1
F91CBD5015F6D88053AD7BF162D4199CE9D83FAD93A111FD4DFFDF50D7F33AD7 1
526FA6B3E4793A3A66646EFB45CA5C1BE1C7DE0F131D75...

output:

1
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
1
1
1
0
0
1
0
1
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
0
0
0
0
1
1
1
0
0
1
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
0
1
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
1
1
1
0
0
0
1
0
1
0
0
0
0
1
0
0
0
1
0
0
0
1
1
1
0
0
0
1
0
1
...

result:

ok 120000 lines

Test #10:

score: 4
Accepted
time: 347ms
memory: 59444kb

input:

50000 50000 297116797042729948 453385896128362610
EF0E62973AAEEBF82F5F1C6583CDB3A4F62702460094DDC13E66DAFE32755B79 1
43694AA1BE3C85C92354F18B4D1618F407B98A30B462A6DC4534BA3939E35D6B 2
AAA575A373186B6B5335D6C603D269F74560677532A606B32E1AAB94BA61436C 1
632656BCF7C6342D974ACAE59D3B289220F426433A80D5D78...

output:

0
0
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
0
0
1
0
0
0
1
1
0
1
0
0
0
0
1
0
1
1
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
1
1
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
0
1
1
1
0
0
0
0
1
1
...

result:

ok 50000 lines

Test #11:

score: 4
Accepted
time: 516ms
memory: 71824kb

input:

70000 70000 783429024698327745 1498595230910951963
A2ADC022D2304FAA3329DECBE1289D7BEE60BD8A51A32D0E9A499253FAB41B5D 2
01AB505E6AA3447398EB811174FBBB3D96F70A76F0C7070C604AC3B7349279D5 2
29DED8FAACBACA9D9495A46ED81A6AF62F347DA865D1AB58201DE06130196321 3
6C3A22A5903D59015E00909B0D8097AE0F747F85450A4D03...

output:

1
0
1
1
0
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
1
0
0
0
1
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
1
0
1
1
0
0
0
1
0
...

result:

ok 70000 lines

Test #12:

score: 4
Accepted
time: 822ms
memory: 89600kb

input:

100000 100000 2959552472493442515 1859332660030400863
C5E30B46DC5095656A3105FB70EC56ADED6145C09818C8801696C8200EC6183F 1
7087B9C921D3120B49DC7714B2BD02AD31A9B5644859C9A56BBD3545B81B55BD 1
11BA7BEA9043AEBD11BE43C6B37CA3914539F7A7B5B25524116DAB0D3FCB66DD 1
809B0ABA5B9D027C9B506F30419FE8E33D6359DEB9FD9...

output:

0
1
0
1
0
0
1
1
1
0
0
0
1
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
0
0
0
0
0
1
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
1
1
1
0
0
0
0
0
1
1
0
1
1
0
1
0
0
1
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
0
1
0
0
...

result:

ok 100000 lines

Test #13:

score: 4
Accepted
time: 184ms
memory: 52228kb

input:

30000 30000 3047464397205204960 808376681971380551
18DC149E90A1BD0182975796AF3EDCCB077EC787BFD70AEEC8482A16B61EAC36 3
B0DF6FCB78BBC43D1833344E966D63F13745909BFE0F0D2A23176A83C461F643 5
DE6F09CCA425F0761F089179E83446922F6BEE5EBB3D70E9725621AC74463D8D 4
F3573F6E2D2FC6D66D0AE9E78320DD852FB4AE931687A3AE...

output:

0
1
1
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
1
0
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
0
1
0
1
1
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
0
0
1
0
1
0
0
0
1
1
0
0
1
0
0
1
1
0
0
0
1
0
1
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
1
1
0
1
0
1
1
...

result:

ok 30000 lines

Test #14:

score: 4
Accepted
time: 434ms
memory: 68696kb

input:

60000 60000 11645237757045796 1062926478779079712
651AD2BB9B918DBB3EF3A289037029D61D27C91F54114BA9FC77DA96956665CF 3
57F0B41C89C89B20530F124D2D57484DC540C66B58A51E274ACC2A75C4BED42B 3
43E5A93ACDFA3E47C7927C4721BD23A81F69CC6EDED2DF5A062C39CC315EA3B5 4
461C03ABFDA2A2868C61C0CA6BCBC0E319F5F340F0BC816E6...

output:

1
0
0
0
0
0
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
0
1
0
1
1
1
0
0
0
0
1
0
0
1
1
0
0
1
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
0
0
1
1
0
0
1
0
1
0
0
0
1
1
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
0
1
0
0
0
1
0
1
0
0
0
0
...

result:

ok 60000 lines

Test #15:

score: 4
Accepted
time: 1037ms
memory: 95784kb

input:

120000 120000 3471692030545737673 2123175783402743581
F0655FE4E423DF0A6DAFF365C538B0316AA4F81E6A961E223271A84FB4A66D44 2
B0EC88E65EF09C7365BE02CCD61CE11B5810EFF6188F22D89A7A851C524FCC9A 4
3F4830FF5D149DA44D9366FA8E1527C20328884FBE35470C89367FD928E8AC02 2
44D96B19CAFA7E169FFB27AC75FD2BC1BFAC0B48D8A89...

output:

0
1
0
0
1
0
1
1
1
0
1
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
1
0
1
1
1
0
0
0
0
0
1
1
1
1
1
0
0
...

result:

ok 120000 lines

Test #16:

score: 4
Accepted
time: 429ms
memory: 65988kb

input:

60000 60000 983090870179964195 2716957657550969430
F39FCEA1FB89D2B581FF0B7DFA8AB49E4EBEF977725007804273812869542AB4 8
4EDF761C0B45EC576C17A2ACCB819091E38B29D4D406CCBD56F6604A01F982F8 8
6E9D001CB8E2A2B6EE07E9045C14B6DF3476F540F14B462AEF6B0AD6513D00E2 6
CD4E5F4BE063E33738C3D6A3C3A3B2CC095F74C09C6E6CA0...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 60000 lines

Test #17:

score: 4
Accepted
time: 1057ms
memory: 95200kb

input:

120000 120000 3730626778684572911 3973546692773820389
6304979C9CF98378F2E99638E7084B001AE575BC1957D739FD6657F65D01755C 6
465F3C1FC9284FFC78C4A5E2BD733874F74F5A58B5A3745D0C57AC26996228C0 10
085F2ED97FB742D2467B6E4D479F798F91EC4382816B74E0824B4853F36F71BF 11
41791DD9D5B1BD0F5459830B1879DE76F654BC4D528...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 120000 lines

Test #18:

score: 4
Accepted
time: 2522ms
memory: 200104kb

input:

400000 100000 3082560293056410414 3169876384910601720
7822A3A7CA3D896CF710567602B11C95E76E66A16BE658DC98B1A40EA5975B17 12
7408C564039613C8DE1DDDDFC5F3B1EE281C4C5E059C509B62DEFD55DA9229B9 15
1BA3E50FDE1E3FFAD68B7C4D137C29D0C4E386AECF24B45E3EF8D99135CB3760 14
EF033673BB3A9300BA12725133AC706F001F7437D5...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #19:

score: 4
Accepted
time: 192ms
memory: 54220kb

input:

30000 30000 762627763988714547 1566751358439128675
054AB075BA67B9516FDED7A20827C4E53868F90A3782FEB1885C59BAB8788532 4
B93E08295BE56F23EBB6CA516FDF99A63CB10803FE0DEE1E88DE2148795F86DD 6
477F3D58B0102B8EE7A67D50E499C7FFD414B996C0C5C74B5679007ECEE11474 6
3F7C13CA987629AC5FA7E6FF14523B920A36B20B2E4701D8...

output:

1
0
0
1
0
1
0
0
1
0
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
0
0
1
0
1
0
0
1
1
0
1
0
0
0
1
1
0
0
1
0
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
1
0
1
1
1
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
...

result:

ok 30000 lines

Test #20:

score: 4
Accepted
time: 443ms
memory: 68452kb

input:

60000 60000 3855343102918812369 2030322794493693025
8FF92A089BB8AA4DDD68B2551F6EFDB01A20F660239CBD5A9A9A22A996D38E85 8
5073101D41AB2C84A111036CF6F3BB64B96C227E2B10EBFBC70882773B0502E7 5
F5215143A44ED3EACB11FB5722D940B525CBEE64553D495FEF757136EAB11594 9
C53876A2D924A70E638E222E5CED7E665CE423A3C382215...

output:

1
0
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
1
0
0
1
0
1
0
0
0
1
1
0
1
0
0
1
1
1
1
1
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
1
0
0
1
0
0
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
1
1
0
...

result:

ok 60000 lines

Test #21:

score: 4
Accepted
time: 717ms
memory: 81812kb

input:

90000 90000 1868063822638126738 3730730209925563900
35A5A46350C0DD8399739EC8E37988562DD7AE6136DB32651685D509D45238A7 7
7A9008593D5FA1E0A33AB76C79464D402AB631A38734D2B3CF817966312F2A80 7
5CA71729B5B155DCA24A9DAF8C1087386F687AF2DCFF4BE2661F474C4987DBE6 11
2C01373A4A885C8AFAE892B775D5814DD4F10CD43E6CA9...

output:

0
1
1
0
0
1
1
0
0
1
0
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
1
1
0
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
1
1
0
0
0
1
1
1
0
1
0
1
0
0
0
0
1
0
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
0
0
...

result:

ok 90000 lines

Test #22:

score: 4
Accepted
time: 1435ms
memory: 126932kb

input:

200000 120000 4172962445183597561 853008272229311236
5B4AAD61614E62696B844AB1C0B349538A9CB9ACC831EF29C12829625982181A 12
9655401E12951C1625E36B27D34A20F2A8CCD9176331183F81E9336C8CFAB024 12
4E42E860E2AF4C143D585F3E558F2F34B0E82FD746FD25C9D04B31DE07F185CF 12
AB80A0E3376FB44306E185AD539F482AD48BCCB8795...

output:

1
0
1
0
1
1
1
0
1
0
1
1
0
0
1
1
0
1
1
0
0
1
0
0
1
1
0
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1
0
0
1
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
1
0
1
1
1
1
0
1
1
0
1
1
0
1
1
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
1
0
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
...

result:

ok 120000 lines

Test #23:

score: 4
Accepted
time: 1849ms
memory: 199780kb

input:

400000 80000 3652017636921394692 2985663838268994667
1FCD505E37B71D81284735BF467D728A27CD7010DBB454FE6CBDB99BF64AEBAA 15
1194FEE6A7E12004D6C8C6D9FC95BE42AA143DBFC63AEBB58A3C621C3366D3F2 12
1FCD505E37B71D81284735BF467D728A27CD6629DBB454FE6CBDB99BF64A6192 13
E958EC2D538A138964C0E448FF3F3EBB4D506264AAF...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 80000 lines

Test #24:

score: 4
Accepted
time: 2323ms
memory: 198536kb

input:

400000 100000 3963695580282795710 2338638026954171579
1F649C2282A525A35401AAA902CB5C1A0673F8B799F37B7ECC002B3A922B1388 9
BCBA40361530758A758E9DE869C1A55106CFE448B1B8ECAD7E039236FFE96D12 10
478D6EAF91D9A5F2F7699BB0F748F3605849BC4AF9D5C20457B76DC03CE664B6 9
E549F9832C515AAFB7C2F2B76D87D69FEB4F3470FBA5...

output:

1
0
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
0
1
0
0
0
0
0
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
0
1
1
0
0
1
0
1
1
0
0
0
1
0
1
1
1
1
0
1
0
0
0
1
0
1
1
0
1
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1
0
0
1
0
0
1
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
1
0
0
0
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
0
...

result:

ok 100000 lines

Test #25:

score: 4
Accepted
time: 2295ms
memory: 199436kb

input:

400000 120000 742743139170628325 4432014180078271417
BB876569AA2FC932ED6E140093400881D0376A983BA6538C708742B79ED6C7D8 11
4D9E2DB65711B2CF22DCDEDD86EB851363ADEE2C3BB5679363EAAF6BD5588AE9 9
81D81D0D0339F2628C97D51757B3A1E43BD6DCF92C12E048C04E0D83AFABA458 11
81D81D0D0339F2628C971A3857B3A1E43BD6D5FE2C12...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 120000 lines

Extra Test:

score: 0
Extra Test Passed