QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#119292#6669. Mapaplatelet#0 593ms3928kbC++172.3kb2023-07-05 09:56:252024-05-31 19:05:09

Judging History

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

  • [2024-05-31 19:05:09]
  • 评测
  • 测评结果:0
  • 用时:593ms
  • 内存:3928kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-05 09:56:25]
  • 提交

answer


#include <bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i++)
#define per(i, r, l) for(int i = (r); i >= (l); i--)
#define mem(a, b) memset(a, b, sizeof a)
#define For(i, l, r) for(int i = (l), i##e = (r); i < i##e; i++)
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) int((x).size())

using namespace std;
using ll = long long;

template<class T> inline T& cmin(T& a, const T& b) { if(b < a) a = b; return a; }
template<class T> inline T& cmax(T& a, const T& b) { if(a < b) a = b; return a; }
template<class... Args> void print(Args&&... args) {
    ((cout << args << ' '), ...);
}
template<class... Args> void println(Args&&... args) {
    print(args...), cout << endl;
}

const int P = 1e9 + 7, B = 420;

int x[108], y[108];

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int T, n;
    cin >> T >> n;
    if(T == 1) {
        mt19937_64 gen;
        while(1) {
            auto a = gen() % (P - 1) + 1, b = gen() % P;
            int buc[B] = {};
            rep(i, 1, n) {
                cin >> x[i] >> y[i];
                buc[(x[i] * a + b) % P % B]++;
            }
            int mx = 0;
            For(i, 0, B) cmax(mx, buc[i]);
            if(mx < 2) {
                vector<int> ans;
                For(i, 0, 30) ans.pb(a >> i & 1);
                For(i, 0, 30) ans.pb(b >> i & 1);
                For(i, 0, B) ans.pb(buc[i]);
                int idx[B] = {};
                rep(i, 1, n) idx[(x[i] * a + b) % P % B] = i;
                For(i, 0, B) if(idx[i])
                    For(j, 0, 30) ans.pb(y[idx[i]] >> j & 1);
                cout << SZ(ans) << '\n';
                for(int i : ans) cout << i;
                cout << '\n';
                break;
            }
        }
    } else {
        int q, foo;
        string info;
        cin >> q >> foo >> info;
        uint64_t a = 0, b = 0;
        int ans[B] = {}, p = 0;
        For(i, 0, 30) a |= info[p++] - 48 << i;
        For(i, 0, 30) b |= info[p++] - 48 << i;
        For(i, 0, B) ans[i] = info[p++] - 48;
        For(i, 0, B) if(ans[i]) {
            ans[i] = 0;
            For(j, 0, 30) ans[i] |= info[p++] - 48 << j;
        }
        while(q--) {
            int x;
            cin >> x;
            cout << ans[(x * a + b) % P % B] << '\n';
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 84
Acceptable Answer
time: 158ms = 157ms + 1ms
memory: 3688kb,3588kb

input:

1
100
495528311 963488152
269613430 443544124
700489871 792354118
151890319 506569919
180452297 13229948
684464994 543841485
978085128 903812192
238355172 441140842
28061035 783291471
530823766 718942732
936853023 439421263
201361623 226633955
304644844 778868118
864860135 461524170
88300500 6959354...

output:

3480
1111000101111110011000100101011010001100100010011010000110100001100000100001110000000000000000001111110000000010011000000100000000000010101000000000010100000000000001001100000101000010000100110000101000010100001110001000010010001000000001000010000000001100010010000000000100001011000001000001000...

input:

2
100 79 3480
1111000101111110011000100101011010001100100010011010000110100001100000100001110000000000000000001111110000000010011000000100000000000010101000000000010100000000000001001100000101000010000100110000101000010100001110001000010010001000000001000010000000001100010010000000000100001011000001...

output:

310305144
821194635
174780370
903812192
805026231
996046536
439421263
645287342
90686849
20101025
440972097
543841485
176553522
249563964
461524170
348624865
848301562
506569919
306718453
206848250
382805509
278712030
964702808
868944393
493895143
39665197
574757075
441140842
785665865
229376884
551...

result:

points 0.840 ok K = 3480

Test #2:

score: 84
Acceptable Answer
time: 158ms = 158ms + 0ms
memory: 3628kb,3632kb

input:

1
100
743248071 842720888
367650901 130970775
297946283 705168964
771526942 537186020
245003150 707948455
643491261 668001146
311535032 293708068
183828318 18515526
593973840 915870006
102456762 64193833
729806890 839221652
47145974 35682954
668676377 228428310
370700393 569441954
250911162 48980047...

output:

3480
1001100111010000101100100111100100010101010001110011001101110000000000011011000000000000100000000000000001010000000011100101011000010000010000000000000011000000010110000000101001000001000000000101001000010101101100000000000000100001100000001000101010000001000001010000100000000010010001000010100...

input:

2
100 79 3480
1001100111010000101100100111100100010101010001110011001101110000000000011011000000000000100000000000000001010000000011100101011000010000010000000000000011000000010110000000101001000001000000000101001000010101101100000000000000100001100000001000101010000001000001010000100000000010010001...

output:

442563406
97578442
469403815
293708068
138158276
720700065
839221652
674386240
810209830
563527225
259979005
668001146
813899310
943777483
569441954
226088806
825435650
537186020
131383422
83733737
830289758
425793016
858146541
609883097
414389335
407054915
47572024
18515526
276587480
810627636
4972...

result:

points 0.840 ok K = 3480

Test #3:

score: 84
Acceptable Answer
time: 277ms = 277ms + 0ms
memory: 3928kb,3860kb

input:

1
100
770174568 168127255
893508708 185778664
976425263 477317099
287595878 512153851
621600374 418802856
818787535 612197605
796811122 566496677
789841517 873731343
43178468 619503942
597852289 471053284
66112404 635260765
158101403 199253397
680158192 123081916
626776438 29107026
721141470 5177084...

output:

3480
1000000111111100011110000010000101111110010101100111100110111101000011001011101010000010001000001010001010000000110000000000000010010010000000100000100011010000001010100000011000000010000011000000010000000010100000000001000100001001000000000000010100010010100101000000010000010100000000000000000...

input:

2
100 79 3480
1000000111111100011110000010000101111110010101100111100110111101000011001011101010000010001000001010001010000000110000000000000010010010000000100000100011010000001010100000011000000010000011000000010000000010100000000001000100001001000000000000010100010010100101000000010000010100000000...

output:

676203467
418593456
222540092
566496677
487711174
155177230
635260765
19655934
405420089
197948311
16997620
612197605
623431791
654167214
29107026
103769907
951695033
512153851
401411177
839097490
141196222
886472586
767476542
270436089
885084406
492744649
861074271
873731343
744691837
300804222
364...

result:

points 0.840 ok K = 3480

Test #4:

score: 84
Acceptable Answer
time: 64ms = 63ms + 1ms
memory: 3924kb,3892kb

input:

1
100
546594289 9670068
665528790 773039281
266567267 744830423
338924380 918542055
413001686 717894752
786408307 211692098
280986141 432842000
195582858 921321743
412109607 485887870
262421557 244551274
303481411 585109375
922835159 77375674
276669713 485047938
748493209 63888398
37129726 285918022...

output:

3480
0100101101111110000011111100111011010010000110000111010111010000001000000000101000000001100000010001010001000100001001000100000100111000000000100001010000001110000010001000110000000001000000000001000110100100001100001001001010011010000000010110000110000010000000100100010010000001000100011100100...

input:

2
100 79 3480
0100101101111110000011111100111011010010000110000111010111010000001000000000101000000001100000010001010001000100001001000100000100111000000000100001010000001110000010001000110000000001000000000001000110100100001100001001001010011010000000010110000110000010000000100100010010000001000100...

output:

43372101
204611063
352593757
432842000
142147490
891337416
585109375
743309504
647533065
464964608
876089821
211692098
955710889
971589766
63888398
781195091
748872098
918542055
738134414
271774069
559783342
631668225
32245370
502187994
978371138
563783889
900635155
921321743
760555399
270665755
276...

result:

points 0.840 ok K = 3480

Test #5:

score: 84
Acceptable Answer
time: 119ms = 119ms + 0ms
memory: 3628kb,3664kb

input:

1
100
326454605 159474960
11647328 932941462
367166680 626258331
846588658 385992166
148602944 380296908
32123445 521548223
146657758 872883623
78417135 361494853
902204073 975297913
50096537 520296997
687284103 420187394
93781442 87808395
503014564 573344902
720903126 546124141
87676450 646360824
9...

output:

3480
0000110011011100000001010101110101010001001011010110001000000001010010110011000010010010000010000000001000000110000001000000010000100000111001000000000000110000010010000000001000001101101000001000010010100000100001000010011000010000001001000000111000000000000000000000001100111000010001000010000...

input:

2
100 79 3480
0000110011011100000001010101110101010001001011010110001000000001010010110011000010010010000010000000001000000110000001000000010000100000111001000000000000110000010010000000001000001101101000001000010010100000100001000010011000010000001001000000111000000000000000000000001100111000010001...

output:

744601533
267129639
871217352
872883623
255371549
162360942
420187394
62984915
242781986
691399852
480380990
521548223
206206675
214089065
546124141
380557861
669664079
385992166
150840342
413877880
634078816
965530575
770169571
451364705
804171981
524846617
166621075
361494853
603970305
891038427
6...

result:

points 0.840 ok K = 3480

Test #6:

score: 84
Acceptable Answer
time: 251ms = 251ms + 0ms
memory: 3688kb,3820kb

input:

1
100
64333280 212072142
621741906 581061751
485561139 692210649
992259436 287935018
247191279 473618369
757620730 140577613
737479792 180977604
404566245 999575096
265846881 11981569
207666352 505750476
304958822 388901054
389584560 428620342
171809402 115660346
324907936 144402645
844495803 791121...

output:

3480
1010110000100101001101011000101100101111110000001000110110010000000101100100000100110000001001000001000010010010000000000000000001000000000111000110000110100000010000000100000001110000100000000000010011000010001000000000000110010000100100000011011010100000010100010011000011000000000000111001100...

input:

2
100 79 3480
1010110000100101001101011000101100101111110000001000110110010000000101100100000100110000001001000001000010010010000000000000000001000000000111000110000110100000010000000100000001110000100000000000010011000010001000000000000110010000100100000011011010100000010100010011000011000000000000...

output:

925952390
770406569
77034978
180977604
957934192
99668862
388901054
858699296
371495636
28514411
68070922
140577613
781757001
847250666
144402645
346058199
267461021
287935018
989151756
348668969
556273495
997895853
95321369
938341707
276009971
101428817
899728485
999575096
385642796
181794009
75258...

result:

points 0.840 ok K = 3480

Test #7:

score: 84
Acceptable Answer
time: 316ms = 315ms + 1ms
memory: 3628kb,3700kb

input:

1
100
38589601 573023388
6635272 692946586
153397181 811034102
859889237 493892802
259205483 364719660
954343124 427626481
959173918 753851930
975496695 577574806
311830132 29056811
509015429 310443549
588209966 697904208
31314024 836756664
249907127 458343750
355938610 284261099
221528639 337802970...

output:

3480
0110001111011011110101011001001101010110110111101100100000100001010000111000100001000000000101000111000000100000000100010010100011001111100010000110101100010111000000000101000000010001001010000000010101000010110010000000100000010100000010001000000010000100100000101100100000000000000001001000001...

input:

2
100 79 3480
0110001111011011110101011001001101010110110111101100100000100001010000111000100001000000000101000111000000100000000100010010100011001111100010000110101100010111000000000101000000010001001010000000010101000010110010000000100000010100000010001000000010000100100000101100100000000000000001...

output:

230017218
565349569
47782129
753851930
678112683
647428660
697904208
283703409
312668984
173256201
644234813
427626481
304813844
912323446
284261099
886592164
929134689
493892802
555567576
65699189
645479813
694103982
65190925
671520247
354050416
976551128
738019464
577574806
813237436
891060967
888...

result:

points 0.840 ok K = 3480

Test #8:

score: 84
Acceptable Answer
time: 52ms = 52ms + 0ms
memory: 3852kb,3604kb

input:

1
100
608812690 879292074
479028197 788306143
615995302 841820438
145257256 962764296
602711633 995581697
898256936 448106429
760128150 867194906
843820112 719060821
156799570 629004151
556234422 563271562
355032462 28734192
691911457 345245685
868932163 940932744
589136297 140594459
605248500 81637...

output:

3480
0011101101010000110000010111001000111100111000010010101001000000000101100101000011001100111001010100000010000111000110010000001010000000100000010001101000001110000000010100100010000000000000010101011000000100000100000000000001011000100001000000000000001110000100010000010001010001000001001000100...

input:

2
100 79 3480
0011101101010000110000010111001000111100111000010010101001000000000101100101000011001100111001010100000010000111000110010000001010000000100000010001101000001110000000010100100010000000000000010101011000000100000100000000000001011000100001000000000000001110000100010000010001010001000001...

output:

500331265
566760896
580044819
867194906
560949333
9781752
28734192
263251739
247143049
846291006
332847217
448106429
266605081
382040161
140594459
32445827
364204743
962764296
647363961
549897822
266248054
819012425
609835929
951476639
538336120
158314822
355385207
719060821
493794877
696188978
3014...

result:

points 0.840 ok K = 3480

Test #9:

score: 84
Acceptable Answer
time: 298ms = 298ms + 0ms
memory: 3572kb,3668kb

input:

1
100
221411475 163696773
580081552 897674994
529495152 42484057
439934490 746227851
716122469 137572309
850797298 158711960
820091048 515476547
797154090 246166696
923505280 368103965
246035210 308696941
613434683 955145371
875043135 212559533
205331778 121889189
468477922 194020296
861623799 72521...

output:

3480
0010110001010100000011111111101000101011111100100101001101100110100000010000000000100000010000000010100111000010000100000000001100000000110010100110100011000000010000000000100001000011000000000010100101101001000010101010100000000011000100000000111001010000000000001011000100000110100000011001010...

input:

2
100 79 3480
0010110001010100000011111111101000101011111100100101001101100110100000010000000000100000010000000010100111000010000100000000001100000000110010100110100011000000010000000000100001000011000000000010100101101001000010101010100000000011000100000000111001010000000000001011000100000110100000...

output:

447518344
20372800
820057525
515476547
929148550
975667875
955145371
710181675
270693487
815249231
444426161
158711960
978716476
472823181
194020296
768850245
118243886
746227851
939771652
880147346
23021000
674514174
170878417
120543464
688090699
772795972
659239901
246166696
22324283
62945716
4424...

result:

points 0.840 ok K = 3480

Test #10:

score: 84
Acceptable Answer
time: 141ms = 140ms + 1ms
memory: 3892kb,3596kb

input:

1
100
19599769 503599235
607852146 743568370
186281835 152620298
14504908 481672793
781288195 362834688
151340700 673227358
631578327 616559846
162406965 868151253
654902334 704640894
506151846 36830214
260055673 991685781
541724792 551734837
725627458 660315138
732278528 433696372
325821250 4876257...

output:

3480
1001001000111101011001100111100010010100001101101110000111100000000001010000010000010101000000010000000010101010110000001000101001100101000000000000100000000100010001001010001000010000000011000000000011010100010000000010100000000000001000000000100001101100001101010100100000110000100000010001001...

input:

2
100 79 3480
1001001000111101011001100111100010010100001101101110000111100000000001010000010000010101000000010000000010101010110000001000101001100101000000000000100000000100010001001010001000010000000011000000000011010100010000000010100000000000001000000000100001101100001101010100100000110000100000...

output:

17522166
203911209
128873662
616559846
5724752
637807633
991685781
667107960
23742057
733808995
34061776
673227358
76723239
80053091
433696372
302174338
804265440
481672793
129338272
820651206
457529317
578437883
142129496
92873118
115024862
323981695
456071005
868151253
79539206
533123847
250920833...

result:

points 0.840 ok K = 3480

Test #11:

score: 84
Acceptable Answer
time: 593ms = 592ms + 1ms
memory: 3860kb,3660kb

input:

1
100
754728080 615034506
278142947 739166255
431557648 213650106
801076937 12302465
390056764 405912325
958010191 972296266
618096674 290293214
816072144 822111433
114390542 264666411
362376476 262284198
397871046 932447079
740458746 280549044
401344771 621570565
158481121 162119017
575252154 10877...

output:

3480
1000010110011101101010000010001011001100000111001101010000110000000001100010000001011110010000000000000100001011011101000000000000100000100000000000000000010100101000010001100000010100001000000001101000001000000101001100000000110000111000011000000010000011000010100000011000000010110000100011000...

input:

2
100 79 3480
1000010110011101101010000010001011001100000111001101010000110000000001100010000001011110010000000000000100001011011101000000000000100000100000000000000000010100101000010001100000010100001000000001101000001000000101001100000000110000111000011000000010000011000010100000011000000010110000...

output:

956707937
764151542
425056403
290293214
904945055
569744963
932447079
578669827
615355462
437815230
175380679
972296266
707177724
779023842
162119017
102160143
489008046
12302465
71297359
937102868
844790648
930068047
918051016
375684910
653833961
85896778
97899197
822111433
333928660
394182386
2979...

result:

points 0.840 ok K = 3480

Test #12:

score: 84
Acceptable Answer
time: 97ms = 97ms + 0ms
memory: 3684kb,3524kb

input:

1
100
651602369 609971562
405806520 338858725
82461387 773296498
370394604 205907118
83229151 915559769
402520445 634368224
295827147 51732839
850231879 473145268
91650669 793908439
989299809 96921178
907891317 791908538
221803027 446090649
124079152 603405537
739157248 694680954
704470038 219741129...

output:

3480
1101000101011001101101000111011000101001101010010101110001010000000000000100000000001100001001000001000101010000011010000010010001000010011000001000000100000000100011001100100110000110001000011110000011011000000000000010100010110000101001011000000000001010010001000001001100000101001000101110110...

input:

2
100 79 3480
1101000101011001101101000111011000101001101010010101110001010000000000000100000000001100001001000001000101010000011010000010010001000010011000001000000100000000100011001100100110000110001000011110000011011000000000000010100010110000101001011000000000001010010001000001001100000101001000...

output:

304926408
871747385
695719855
51732839
30730873
858053531
791908538
890946266
742114626
147850369
963347495
634368224
56126240
294913872
694680954
413016011
3780006
205907118
980617161
660575727
27667900
592622098
681202212
760457383
415626677
428417886
570655471
473145268
966433960
923765677
553360...

result:

points 0.840 ok K = 3480

Test #13:

score: 0
Time Limit Exceeded

input:

1
100
900905485 986849220
865890639 989219769
974980553 815503255
12084595 62574731
234049511 570118116
55567194 907451536
607443488 476001345
441446673 515273718
647029160 196634608
984700195 391421066
387033530 548761294
299636778 162002144
258531148 905788089
99288303 231936743
506688707 46687162...

output:


result: