QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786855#5714. 涂色游戏lopzith100 ✓63ms7148kbC++142.4kb2024-11-27 00:08:582024-11-27 00:09:05

Judging History

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

  • [2024-11-27 00:09:05]
  • 评测
  • 测评结果:100
  • 用时:63ms
  • 内存:7148kb
  • [2024-11-27 00:08:58]
  • 提交

answer

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
#define DEFAULT 5e5 + 5
#define int long long
#define i64 long long
#define i128 __int128
#define ull unsigned long long
#define db double
#define ldb long double
#define Arr std::vector
#define Ptn std::pair
#define fi first
#define se second
#define eb emplace_back
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define popc(x) __builtin_popcountll(x)
#define clz(x) __builtin_clzll(x)
#define ctz(x) __builtin_ctzll(x)
#define chkmin(x, y) x = std::min(x, y)
#define chkmax(x, y) x = std::max(x, y)
#define FILE(x) freopen(x ".in", "r", stdin), freopen(x ".out", "w", stdout)
#define TEST(x) freopen(x ".in", "r", stdin), freopen("test.out", "w", stdout)
#define KEL(x) freopen(x ".in", "r", stdin), freopen("a.out", "w", stdout)
#define debug std::cout << "Running on " << __FUNCTION__ << ' ' << __LINE__ << std::endl;
#define fail assert(0);
#define lopzith return 0;
bool BeginPoint;
const int INF = 0x3f3f3f3f, llINF = 0x3f3f3f3f3f3f3f3f, P = 998244353;
const db eps = 1e-9;
const ull base = 13331;
const int N = 1e5 + 5;
int _, n, m, q, A[2][N], vis[2][N];

inline int read()
{
    int w = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        w = (w << 3) + (w << 1) + (ch - 48);
        ch = getchar();
    }
    return w * f;
}

bool EndPoint;
signed main()
{
    std::cerr << "Memory = " << fabs(&BeginPoint - &EndPoint) / 1048576.0 << "MB" << std::endl;

    _ = read();
    while (_--)
    {
        memset(vis, 0, sizeof(vis)), memset(A, 0, sizeof(A));
        n = read(), m = read(), q = read();
        for (int i = 1; i <= q; i++)
        {
            int op = read(), x = read(), c = read();
            A[op][x] = c, vis[op][x] = i;
        }
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= m; j++)
            {
                if (vis[0][i] < vis[1][j])
                {
                    printf("%lld ", A[1][j]);
                }
                else 
                {
                    printf("%lld ", A[0][i]);
                }
            }
            puts("");
        }
    }

    std::cerr << "Time = " << (double)clock() / CLOCKS_PER_SEC << "s" << std::endl;
    lopzith
}

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

详细


Pretests


Final Tests

Test #1:

score: 5
Accepted
time: 0ms
memory: 7048kb

input:

5
1 1 0
1 1 0
1 1 0
1 1 0
1 1 0

output:

0 
0 
0 
0 
0 

result:

ok 5 number(s): "0 0 0 0 0"

Test #2:

score: 5
Accepted
time: 2ms
memory: 7148kb

input:

5
1 1 1
1 1 398881
1 1 1
1 1 806506
1 1 1
1 1 872598
1 1 1
1 1 766964
1 1 1
1 1 351603

output:

398881 
806506 
872598 
766964 
351603 

result:

ok 5 number(s): "398881 806506 872598 766964 351603"

Test #3:

score: 5
Accepted
time: 2ms
memory: 7056kb

input:

5
1 10 20
1 7 360565
1 1 936489
1 7 685204
1 9 762005
1 6 891647
1 8 876489
1 7 216455
1 6 541465
1 8 283299
1 6 363325
1 5 966827
1 3 611215
1 10 21661
1 6 394128
1 6 775323
1 6 466147
1 8 671659
1 7 577168
1 9 295990
1 10 570498
1 10 20
1 2 739786
1 10 679369
1 2 624472
1 5 468249
1 2 325877
1 4 1...

output:

936489 0 611215 0 966827 466147 577168 671659 295990 570498 
764136 325877 267557 824428 468249 157156 388269 681736 0 622005 
775640 148173 848982 604699 946384 55144 332960 980912 565753 5928 
274266 720874 632610 612437 0 577298 235204 788549 883390 91620 
147892 722192 184839 977313 532451 82866...

result:

ok 50 numbers

Test #4:

score: 5
Accepted
time: 45ms
memory: 7132kb

input:

5
1 100000 100000
1 83380 265928
1 4608 512040
1 89253 465041
1 21328 724278
1 90513 414283
1 60747 285335
1 17168 29065
1 99628 96527
1 48160 541605
1 70003 299307
1 88068 333883
1 91586 479865
1 85055 458796
1 49955 21708
1 95005 995483
1 4895 375161
1 97323 785715
1 65384 66461
1 84666 565728
1 3...

output:

0 0 733053 987255 489915 0 158372 0 770341 0 363821 562508 986726 63308 0 438355 592189 0 0 714354 0 0 0 281308 412703 0 0 0 978142 270587 0 59793 0 540830 54900 0 785910 678461 0 596913 0 0 863081 569277 0 0 390918 69293 0 0 139102 834195 0 64184 644632 0 765066 0 624561 0 752371 417980 0 194522 0 ...

result:

ok 500000 numbers

Test #5:

score: 5
Accepted
time: 45ms
memory: 7112kb

input:

5
1 100000 100000
1 50893 201823
1 14939 96626
1 6682 923855
1 7682 672275
1 60416 275481
1 31963 608315
1 81656 181718
1 17019 442318
1 76367 124498
1 22952 742433
1 22534 497358
1 47933 26368
1 76019 474876
1 46026 231847
1 14559 389958
1 8817 898761
1 25606 559112
1 69994 843084
1 39450 754449
1 ...

output:

424824 542809 941762 790647 196455 0 864354 508053 0 0 631701 788180 0 565157 0 0 0 344711 0 677564 104341 476518 0 0 40787 0 506203 197545 0 0 445003 960616 0 0 268898 498961 859500 228344 590638 0 194177 0 0 996154 509775 379673 106013 0 0 393537 301109 850573 472580 0 833070 0 660065 0 0 642362 6...

result:

ok 500000 numbers

Test #6:

score: 5
Accepted
time: 47ms
memory: 7132kb

input:

5
1 100000 100000
0 1 536615
1 40580 889611
1 19878 332331
1 10842 322834
0 1 840308
0 1 126240
0 1 29628
0 1 163406
0 1 245418
1 3916 694852
1 43386 7166
0 1 317425
1 11153 457544
1 40193 760992
0 1 924662
0 1 923652
1 6554 727394
0 1 139657
0 1 607794
0 1 886810
1 80702 483880
1 7322 368003
1 9860...

output:

258136 861141 140435 62968 493660 483572 618371 618371 979461 618371 618371 241185 618371 618371 91558 618371 618371 774270 8851 677875 210446 618371 618371 618371 596142 618371 618371 874509 618371 618371 618371 618371 618371 270313 618371 359408 618371 618371 258714 618371 20664 618371 618371 7991...

result:

ok 500000 numbers

Test #7:

score: 5
Accepted
time: 2ms
memory: 7108kb

input:

5
10 10 20
1 8 673423
1 7 424605
1 3 312199
1 10 508140
1 3 162682
1 3 749375
1 5 313596
1 10 490876
1 4 738019
1 8 41418
1 5 615306
1 10 55191
1 10 652816
1 10 731603
1 8 868630
1 3 690804
1 8 689284
1 3 726192
1 4 566469
1 7 565702
10 10 20
1 6 944262
1 9 784565
1 1 701819
1 7 60163
1 2 242970
1 8...

output:

0 0 726192 566469 615306 0 565702 689284 0 731603 
0 0 726192 566469 615306 0 565702 689284 0 731603 
0 0 726192 566469 615306 0 565702 689284 0 731603 
0 0 726192 566469 615306 0 565702 689284 0 731603 
0 0 726192 566469 615306 0 565702 689284 0 731603 
0 0 726192 566469 615306 0 565702 689284 0 73...

result:

ok 500 numbers

Test #8:

score: 5
Accepted
time: 2ms
memory: 7056kb

input:

5
50 50 100
1 27 862570
1 42 370629
1 21 785851
1 48 149276
1 17 579826
1 2 382417
1 26 862447
1 12 5430
1 44 971992
1 35 639843
1 32 802133
1 7 342897
1 7 270546
1 4 283584
1 3 326401
1 50 936050
1 27 387478
1 21 393261
1 6 33993
1 14 711965
1 27 80599
1 7 951663
1 19 446720
1 45 856663
1 10 580618...

output:

211771 696445 617676 362489 908000 924783 243330 970756 615557 199617 445541 461469 424798 660520 384471 0 810615 0 740328 520649 331714 953012 46738 0 0 374840 80599 0 0 412887 180203 196150 838947 298915 639843 0 205299 806304 0 389925 881969 370629 775160 206724 920696 524777 0 149276 750507 9360...

result:

ok 12500 numbers

Test #9:

score: 5
Accepted
time: 3ms
memory: 7004kb

input:

5
50 50 100
0 7 356320
1 9 808256
1 37 280390
0 26 487750
1 40 397817
1 18 30200
0 34 631941
0 13 513584
1 6 739651
1 14 171785
0 11 136392
1 42 61932
1 48 386171
1 39 726242
0 33 754509
0 30 313532
0 39 702043
1 27 225612
1 11 550726
0 33 682314
1 39 625165
0 2 537042
1 9 145637
1 49 370858
1 10 51...

output:

593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352 593352...

result:

ok 12500 numbers

Test #10:

score: 5
Accepted
time: 34ms
memory: 7100kb

input:

5
1000 500 2000
1 169 182585
1 484 603225
1 266 655192
1 240 964134
1 453 270585
1 149 378050
1 367 507423
1 267 275538
1 253 410546
1 316 294688
1 34 70653
1 214 66202
1 168 468400
1 382 725650
1 303 193247
1 276 951356
1 440 95234
1 308 609459
1 51 83891
1 384 525621
1 338 755187
1 279 973474
1 52...

output:

566311 84494 69307 315833 944797 506373 42846 25335 582201 630614 377034 989114 903209 66958 738249 865278 638450 863860 293854 844525 67775 356215 81764 442559 507883 227073 639007 103929 108146 358216 167931 187079 931004 807951 125814 927782 512882 27344 894929 659059 308357 261015 152908 584119 ...

result:

ok 640000 numbers

Test #11:

score: 5
Accepted
time: 27ms
memory: 6916kb

input:

5
1000 500 2000
1 443 910212
1 236 58757
1 108 343399
1 80 498209
1 440 579804
1 425 533570
1 250 30365
0 200 58555
1 19 479093
0 720 772061
0 979 980538
0 777 653045
1 68 340650
1 363 563005
1 326 35813
0 495 699059
0 72 754208
1 333 519028
1 50 113857
1 312 409359
0 490 879744
0 379 440167
0 493 7...

output:

713123 713123 713123 713123 832332 895579 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 620750 713123 713123 713123 713123 713123 713123 713123 713123 713123 713123 960713 718603 713123 713123 713123 387251 713123 713123 713123 713123 713123 713123...

result:

ok 640000 numbers

Test #12:

score: 5
Accepted
time: 35ms
memory: 7056kb

input:

5
1000 500 2000
0 858 737003
0 365 640928
0 200 262876
0 739 345071
1 474 503914
0 956 406250
1 92 209618
1 161 462769
0 3 133942
1 277 808952
0 323 841499
0 162 35232
0 898 911709
0 486 191287
1 234 729282
1 106 838056
0 284 563674
0 15 725333
1 218 699466
0 89 270139
1 154 460792
1 164 405458
0 61...

output:

187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 456469 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377 187377...

result:

ok 640000 numbers

Test #13:

score: 5
Accepted
time: 44ms
memory: 7148kb

input:

5
1000 100 100000
1 60 257974
1 71 249378
1 62 838830
1 35 542391
1 15 968992
1 33 4931
1 61 41170
1 19 770164
1 82 23402
1 35 817253
1 3 437416
1 78 239094
0 242 498843
1 18 861326
1 89 605940
1 91 257284
1 1 423141
1 83 539139
1 87 201008
1 83 541414
1 89 430733
1 34 364188
0 354 104722
1 3 383896...

output:

364075 684185 145558 63825 329424 110962 437481 477043 215077 812162 141839 657287 739628 561700 400096 834558 338425 367248 183812 296180 830216 362943 71097 910797 716360 384957 452389 170177 777871 623066 123021 730934 375870 589505 479724 17991 420696 323926 206825 786726 857750 991654 806636 77...

result:

ok 500000 numbers

Test #14:

score: 5
Accepted
time: 29ms
memory: 7060kb

input:

5
100 1000 100000
0 93 732652
0 9 789780
0 78 716137
0 65 471050
0 63 866005
0 8 393091
0 63 503017
0 86 301425
0 27 40453
0 19 19895
0 2 502189
0 15 315276
1 463 1893
0 39 466005
0 39 935445
0 95 572841
0 53 317732
0 100 382680
0 11 271586
0 29 66489
0 10 268924
0 38 755582
0 90 752535
0 24 709860
...

output:

864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 195804 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053 864053...

result:

ok 500000 numbers

Test #15:

score: 5
Accepted
time: 43ms
memory: 7000kb

input:

5
100000 2 10
1 1 576142
1 2 569232
1 1 411332
1 1 425797
1 2 772959
1 2 392500
1 2 29726
1 2 397526
1 2 557717
1 2 755192
2 100000 10
1 45126 522729
1 4430 349308
1 34707 279447
1 38091 322134
1 57939 239598
1 63757 243024
1 77317 146768
1 97880 543942
1 87895 814260
1 79976 39530
500 500 4000
1 24...

output:

425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
425797 755192 
...

result:

ok 1000000 numbers

Test #16:

score: 5
Accepted
time: 38ms
memory: 7132kb

input:

5
100000 2 10
1 1 997591
1 1 669040
1 2 61059
1 2 675958
1 2 250917
1 1 393083
1 1 470847
1 1 902449
1 2 454358
1 1 229840
2 100000 10
1 313 426481
1 18851 514257
1 30541 506206
1 62638 379700
1 86845 108462
1 21799 672955
1 65155 699700
1 54535 598060
1 74075 672073
1 62479 515411
500 500 4000
1 24...

output:

229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
229840 454358 
...

result:

ok 1000000 numbers

Test #17:

score: 5
Accepted
time: 53ms
memory: 7120kb

input:

5
100000 2 10
0 61756 74542
1 1 14170
1 2 734933
1 2 528717
0 58924 427327
0 90052 475534
1 1 154322
1 2 422891
0 41549 243766
1 2 238881
2 100000 10
1 63693 540875
1 97587 574403
1 43652 673060
0 2 492115
0 1 196173
0 2 134417
1 18700 956589
0 2 462355
0 1 901757
1 33430 209944
500 500 4000
0 366 4...

output:

154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
154322 238881 
...

result:

ok 1000000 numbers

Test #18:

score: 5
Accepted
time: 46ms
memory: 6912kb

input:

5
100000 2 10
0 50841 853916
1 2 19940
1 1 422513
0 15754 191127
1 1 202011
0 3889 171453
0 47355 807718
1 1 355665
1 1 556910
1 2 650969
2 100000 10
1 32815 264556
1 70617 663577
1 35159 957457
0 1 328336
1 75537 444331
0 1 183745
1 45716 669353
0 2 280143
0 1 422266
0 2 677175
500 500 4000
1 74 97...

output:

556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
556910 650969 
...

result:

ok 1000000 numbers

Test #19:

score: 5
Accepted
time: 63ms
memory: 7068kb

input:

5
100000 2 100000
0 50893 864543
1 2 141460
1 1 163742
1 2 380217
1 2 145635
1 1 544834
0 71428 446658
0 74 630549
0 1300 400669
0 40739 990371
1 1 960077
1 1 805870
1 2 610464
1 2 617795
1 2 211076
1 2 967317
1 2 847002
0 89154 55145
1 2 4862
0 7854 591523
0 1583 957901
0 22237 987646
0 62631 97105...

output:

209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
209094 782509 
...

result:

ok 1000000 numbers

Test #20:

score: 5
Accepted
time: 59ms
memory: 7056kb

input:

5
100000 2 100000
0 44074 669517
1 1 179998
1 1 852346
0 6142 69251
0 78111 912128
1 2 220273
1 1 645270
0 89337 597116
0 40558 251861
0 91758 366619
0 28093 658157
0 95114 369284
0 45929 895885
1 1 454015
1 1 48482
1 2 483717
1 2 517782
0 66924 335909
1 1 966843
1 1 621378
1 1 919304
0 54921 930287...

output:

497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
497836 405766 
...

result:

ok 1000000 numbers

Extra Test:

score: 0
Extra Test Passed