QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#482442#9115. Contour Multiplicationucup-team2307#AC ✓529ms42796kbC++201.3kb2024-07-17 19:35:392024-07-17 19:35:39

Judging History

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

  • [2024-07-17 19:35:39]
  • 评测
  • 测评结果:AC
  • 用时:529ms
  • 内存:42796kb
  • [2024-07-17 19:35:39]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
using pii = pair<int, int>;
using vi = vector<int>;
#define fi first
#define se second
#define pb push_back

const int N = 18;

mt19937 rng(time(0));
int mul[1<<N][N+1];

signed main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    int n, m, k;
    cin>>n>>m>>k;
    for (int i=0; i<(1<<n); i++)
        for (int j=0; j<=n; j++)
            mul[i][j] = 1;
    for (int i=1; i<=k; i++)
    {
        int c, d, x;
//        c = rng()%(1<<n);
//        d = rng()%(n+1);
//        x = rng()%m;
        cin>>c>>d>>x;
        mul[c][d] = (mul[c][d] * x) % m;
    }
    for (int i=n-1; i>=0; i--)
    {

//        cout<<i<<":\n";
        for (int cnt=0; cnt<=i+1; cnt++)
        for (int mask=0; mask<(1<<n); mask++)
        {
//            cout<<mask<<" "<<cnt<<" "<<mul[mask][cnt]<<"\n";
            if (cnt >= 1)
            {

                mul[mask^(1<<i)][cnt-1] = (mul[mask^(1<<i)][cnt-1] * mul[mask][cnt])%m;
            }
         }
    }

    for (int i=0; i<(1<<n); i++)
        cout<<mul[i][0]<<" ";
    cout<<"\n";
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3824kb

input:

3 100 2
0 2 4
3 0 25

output:

1 1 1 0 1 4 4 1 

result:

ok 8 tokens

Test #2:

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

input:

4 998244353 7
0 2 4
3 0 25
9 4 37
4 1 16
6 3 8
1 4 68
13 3 97

output:

1552 8 1 9700 1 64 229696 1 8 4 388 8 64 8 68 1 

result:

ok 16 tokens

Test #3:

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

input:

1 2 1
0 1 696782227

output:

1 1 

result:

ok 2 tokens

Test #4:

score: 0
Accepted
time: 57ms
memory: 3696kb

input:

5 461799503 500000
26 2 741819583
24 4 16805970
5 2 192769861
5 4 365614234
31 0 680795402
23 5 256636931
24 4 150277578
3 1 912506287
27 5 785022824
1 4 645930009
8 2 715559837
3 4 166807726
22 2 584850050
23 1 481241174
7 0 947410124
0 4 588117991
13 5 882053755
16 5 430265734
29 5 324612363
9 4 8...

output:

0 0 45928586 0 134497770 0 206758057 394352068 0 244291949 0 209807785 0 285761102 402778530 0 0 0 61435341 287059619 347978730 135518317 363576818 0 0 0 0 0 0 0 0 349412261 

result:

ok 32 tokens

Test #5:

score: 0
Accepted
time: 72ms
memory: 6896kb

input:

13 471577301 500000
6468 6 306578522
8113 3 479854366
720 5 444779113
8132 12 228254993
6354 13 64735677
6877 9 421810792
541 9 278526040
3090 0 986913987
5352 8 16271033
3263 5 929162219
3483 8 459160836
5355 12 867871503
3035 9 877478088
4090 10 88145277
468 6 252659128
4500 6 628030207
455 5 2083...

output:

295995843 436808476 339073319 155918282 48455511 1287988 263069937 40898455 250933189 115069799 274609439 140251254 130482131 221130936 48158903 362421527 310052080 102853257 367494088 214098183 133285802 100856795 170719263 335861409 110676293 435022783 13399750 339217190 201068790 224869164 579876...

result:

ok 8192 tokens

Test #6:

score: 0
Accepted
time: 173ms
memory: 24508kb

input:

17 776322399 500000
4238 2 949485315
55273 2 237870062
18140 17 991755666
3716 11 874076305
56421 6 370528096
44131 7 213869498
123361 5 779889655
14050 15 844502241
121141 15 30699796
3357 1 429213877
111087 3 497729135
57491 12 942050435
56577 6 386925573
101116 9 695049379
119745 5 557908130
4848...

output:

607821963 435030711 61464891 533141760 226500969 217414755 501264864 288361389 632731971 68903544 602992200 555115194 113967195 306579312 377033709 674976501 523269435 299103978 680309115 251645877 16963974 320830545 637207830 697053579 603067512 9627471 269126778 224492217 218616426 108838875 56676...

result:

ok 131072 tokens

Test #7:

score: 0
Accepted
time: 66ms
memory: 4140kb

input:

11 491132898 500000
2007 5 514244254
34 3 290853058
743 9 616880073
1348 1 736717064
2040 3 754468370
1513 9 300895505
422 5 908138116
433 6 918909941
1410 6 966980703
1403 7 417478787
1602 1 241330134
1083 9 311196667
1574 10 269488211
1535 2 928838328
1454 1 863157133
316 10 196067895
634 9 372754...

output:

414133272 474484338 256673952 140105142 195317172 476786178 58733460 140213250 277643358 403460928 60165954 435023046 445753188 301547322 295684974 51032322 182346084 318614076 291117042 26058744 2338686 39639294 158298426 332380512 456925698 160618824 233964054 278105418 272143008 237853602 3969225...

result:

ok 2048 tokens

Test #8:

score: 0
Accepted
time: 94ms
memory: 8700kb

input:

15 579058550 500000
32545 3 157151048
18523 15 753901453
3827 12 163856627
27651 15 304390524
9099 12 548474043
3952 11 876134765
8555 11 741419277
19584 7 993317642
25039 15 903261611
19930 13 622563144
31381 13 201750579
14308 11 385375599
16204 5 483968395
257 15 535742431
14234 8 168406136
5392 ...

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 32768 tokens

Test #9:

score: 0
Accepted
time: 58ms
memory: 3828kb

input:

1 883803649 500000
0 0 16877287
0 0 511917149
0 0 710833180
1 1 245179137
0 1 854266463
0 1 963160772
1 0 947815593
1 0 145873197
1 0 917690374
0 1 122614801
0 0 240318877
0 1 459554531
0 0 71563734
0 0 142646535
1 0 473655139
0 0 764105581
1 0 459003177
0 1 699373680
1 0 343384433
1 0 659732785
1 1...

output:

0 0 

result:

ok 2 tokens

Test #10:

score: 0
Accepted
time: 61ms
memory: 3784kb

input:

9 893581447 500000
436 0 581636226
205 9 269932845
266 4 962842432
387 4 517885295
177 8 238206737
124 8 50186780
244 0 76064055
30 9 630346296
106 7 853971282
150 9 405847011
315 6 983919875
308 1 828700763
407 0 581011218
262 5 454583337
372 1 73871442
184 6 509050498
391 6 80275234
426 9 99655915...

output:

668718083 173925928 614241298 507965183 286658361 766976287 646875922 244456289 779102082 506578875 230749255 625692100 419633885 550049896 789747167 721376656 736167531 606974500 602727697 607975071 340181127 595354496 508276406 231750882 310922216 228355490 526648617 882696320 544439324 599197819 ...

result:

ok 512 tokens

Test #11:

score: 0
Accepted
time: 487ms
memory: 42796kb

input:

18 798547896 500000
127781 5 700634392
187048 4 461074149
85414 5 560703099
152376 5 45078516
173616 3 370561806
103182 4 278920182
133392 4 745396914
208374 4 790769334
1671 5 889763129
259586 3 975955043
34043 3 927380442
7253 3 63867802
47965 3 793901753
14380 5 824806721
253914 4 941100282
90157...

output:

366699312 201991320 510478200 774265392 608729904 66928032 80635824 571294296 443830104 720868896 663892200 746821296 312333408 175925520 395592336 6781320 331723512 774818784 692219520 603600984 113803056 227626200 419200920 332026128 757801656 282616776 226277712 730614816 261869760 744795000 4186...

result:

ok 262144 tokens

Test #12:

score: 0
Accepted
time: 519ms
memory: 42660kb

input:

18 682490263 500000
92754 4 734376078
162222 5 78353340
241178 5 176408718
93456 5 917810057
5233 4 236891697
161144 5 452979010
231168 5 727526402
72875 3 194305288
181191 5 742457736
40971 5 941565212
201081 3 424936337
221714 5 235529416
230679 4 955574790
25360 3 779109168
136400 4 576037162
746...

output:

235359215 107684395 18507307 265135052 575481452 571815881 558446707 268724092 0 409638775 386959209 595131446 29651804 628380207 407094779 382731531 0 313544868 503645233 186487574 468287911 316745975 131504009 470982330 202791316 0 0 72883902 0 556823722 493091872 444257177 0 302780387 60314345 44...

result:

ok 262144 tokens

Test #13:

score: 0
Accepted
time: 529ms
memory: 42664kb

input:

18 861399930 500000
57726 5 768117764
137395 3 617484677
134798 3 202179736
34536 4 495574299
98994 3 103221588
219107 3 922005138
66801 3 414688589
199520 4 597841241
98568 4 517004489
84499 5 690355935
105975 3 922492232
174030 3 702158330
151250 5 39099975
36341 3 106526770
18887 3 505941341
1869...

output:

590548620 686528790 352496940 680547810 638830350 226791420 472316850 437139450 291792900 478145340 560871480 105330840 80988900 192445290 492475290 337947900 161642160 163727940 755004390 167353260 76858230 584946870 544455780 579091830 441948810 534130080 803677500 190496550 757502280 769564770 69...

result:

ok 262144 tokens

Test #14:

score: 0
Accepted
time: 517ms
memory: 42716kb

input:

18 40309598 500000
22698 5 723711595
112569 3 939796567
28418 5 522918055
237759 3 778371240
192755 4 969551478
14925 5 391031267
164578 3 179998631
64022 4 218196641
15944 3 369699095
128027 3 29081259
10870 3 420048127
126347 3 168787245
71821 4 122625159
47322 3 355796517
163517 4 140878221
10422...

output:

29722868 23596188 22544718 3573766 33573778 38799082 39800558 34216560 16868656 26611620 8681204 29398026 27161190 36177722 17045700 20294568 19080208 11757718 34836550 3880590 11679990 31805984 12765088 126854 7978222 23770600 12121942 12993974 23804606 37386076 17236156 8631308 35934794 30279158 5...

result:

ok 262144 tokens

Test #15:

score: 0
Accepted
time: 486ms
memory: 42736kb

input:

18 219219265 500000
249815 4 746438665
29817 4 481763422
181536 4 773895204
184182 4 178206898
237466 4 896203869
2375 4 356135483
24373 4 792078740
113854 4 533636087
116165 4 565090096
211 4 454060166
12162 4 670971824
215326 4 916699894
195464 4 325584587
120413 4 160913163
33880 4 994691427
1779...

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 262144 tokens

Test #16:

score: 0
Accepted
time: 340ms
memory: 42656kb

input:

18 103161632 500000
214787 4 225378118
70558 4 124670216
195929 4 96207096
77802 4 771837423
175696 4 443180422
79878 4 933899724
118134 4 987225621
34731 4 839428506
112459 4 739148924
97987 4 329164932
154563 4 799220285
152557 4 320235848
112840 4 453464161
112378 4 880374624
9398 4 38449451
8280...

output:

11739616 25191488 48269088 99732864 65904160 42815360 71152256 35652736 101825248 2204608 101129504 2631552 7749504 19964672 33009536 25710272 57149792 10249344 50755936 496608 1548960 100973152 68636960 61550496 63388640 21390880 48399904 84987168 36290688 30693600 30658208 94672704 96402656 434763...

result:

ok 262144 tokens

Test #17:

score: 0
Accepted
time: 351ms
memory: 42788kb

input:

18 735134400 500000
226293 4 589176582
183376 4 235002052
38089 4 523268033
131930 4 496216010
37830 4 485133010
60998 4 971328507
201831 4 821615510
129074 4 490393298
188813 4 868282447
214496 4 795913668
128506 4 24665747
181814 4 959657546
136409 4 745175067
250558 4 554667761
258612 4 227254748...

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 262144 tokens

Test #18:

score: 0
Accepted
time: 330ms
memory: 42660kb

input:

18 735134400 500000
10325 4 972069535
131993 4 190595884
13263 4 84723003
250153 4 254231706
79826 4 100838630
2078 4 794614298
161281 4 389288969
105413 4 356723189
246775 4 342752738
56994 4 587972375
38335 4 711827934
46315 4 413563213
120922 4 524615467
235275 4 329214514
39997 4 995676089
15670...

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 262144 tokens

Test #19:

score: 0
Accepted
time: 419ms
memory: 42724kb

input:

18 735134400 500000
56501 4 981847333
80611 4 929370268
250581 4 941145272
106232 4 12247402
121821 4 126609648
205301 4 539752234
120732 4 330077583
81752 4 223053080
42593 4 444107875
161636 4 380031082
210307 4 398990122
172960 4 494353725
105435 4 677171021
219992 4 476876421
83525 4 764097430
2...

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 262144 tokens

Test #20:

score: 0
Accepted
time: 469ms
memory: 42644kb

input:

18 735134400 500000
102677 4 696657832
29229 4 258079255
225754 4 424452388
224456 4 770263097
163817 4 447347966
146381 4 284890171
80182 4 897751041
58091 4 89382971
100556 4 918578165
4134 4 545204942
120136 4 459267463
37462 4 653292092
89948 4 751578721
204709 4 34603728
127053 4 532518771
1587...

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 262144 tokens

Test #21:

score: 0
Accepted
time: 384ms
memory: 42660kb

input:

18 735134400 500000
259775 4 980365503
261992 4 495336407
246369 4 696059200
179961 4 379715656
119499 4 807885143
182611 4 490130779
53445 4 295088497
190489 4 447985116
170602 4 399067660
170880 4 114817957
137643 4 339023787
186578 4 143446128
92874 4 793028326
6380 4 994152005
152289 4 885281612...

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 262144 tokens

Test #22:

score: 0
Accepted
time: 447ms
memory: 42724kb

input:

18 735134400 500000
43808 4 990143301
210610 4 450930238
221542 4 257514170
36040 4 137731352
161494 4 128623462
123691 4 235268716
12895 4 862761955
166828 4 314315007
228565 4 578570651
13378 4 279991817
47471 4 26185975
51079 4 224236641
77387 4 945583880
253241 4 846846612
195817 4 948670253
113...

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 262144 tokens

Extra Test:

score: 0
Extra Test Passed