QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#178036 | #7240. ABBA | PhantomThreshold# | AC ✓ | 16ms | 4196kb | C++20 | 928b | 2023-09-13 17:35:51 | 2023-09-13 17:35:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MOD=998244353;
int main()
{
auto poww=[&](long long x,int y)
{
long long ret=1;
while(y)
{
if(y&1)ret*=x,ret%=MOD;
x*=x,x%=MOD;
y>>=1;
}
return ret;
};
int n,m;
cin>>n>>m;
vector<vector<long long>> a(n+5,vector<long long>(m+5));
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>a[i][j];
if(a[i][j]<0)a[i][j]+=MOD;
}
}
int r=1;
for(int i=1;i<=m and r<=n;i++)
{
long long maxx=0;
int maxp=r;
for(int j=r;j<=n;j++)
{
if(a[j][i]!=0)
{
maxx=a[j][i],maxp=j;
break;
}
}
if(maxx==0)continue;
for(int j=i;j<=m;j++)
swap(a[r][j],a[maxp][j]);
for(int j=r+1;j<=n;j++)
{
long long t=a[j][i]*poww(a[r][i],MOD-2)%MOD;
for(int k=i;k<=m;k++)
{
a[j][k]=(a[j][k]-t*a[r][k]%MOD+MOD)%MOD;
}
}
r++;
}
cout<<r-1<<endl;
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3824kb
input:
3 5 1 2 3 4 5 2 4 6 8 10 3 6 9 12 15
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
3 3 2 0 2 0 2 0 2 0 2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
1 1 100
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 2 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 2 1 1 1 2
output:
2
result:
ok 1 number(s): "2"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
2 3 0 0 0 0 0 0
output:
0
result:
ok 1 number(s): "0"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
20 20 1149 -158289 421301 -625382 639638 -312855 442515 -223152 -686926 394334 -746085 -488817 -124299 -137253 215418 -120343 632332 845498 -820913 -770155 216423 -11638 -824453 -329865 -799994 166256 164729 -811228 -477642 312149 -570809 -267741 849126 749161 600137 141212 642385 -310587 412930 -22...
output:
10
result:
ok 1 number(s): "10"
Test #8:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
40 40 -72472 622755 444280 -344396 762590 50780 -9017 -777767 882625 844666 -94185 -559761 351916 -38319 -505063 703925 -183156 -762037 -123591 365776 -465537 296034 -75801 308333 -671463 -434753 323374 -765045 413847 -155019 89362 30194 -173195 782740 550923 887378 -125833 -413816 -162712 610425 36...
output:
20
result:
ok 1 number(s): "20"
Test #9:
score: 0
Accepted
time: 2ms
memory: 3624kb
input:
80 80 -200564 402999 201208 370953 161470 538965 527844 -127979 -148578 -29679 289416 -416491 640287 373462 -265875 -454190 -384704 427126 -237812 -690679 187259 -369787 616195 -249418 -291668 267855 74690 -78823 -6855 -266448 134218 -177354 -685755 -138818 7915 -989390 241030 -199759 319497 -380906...
output:
40
result:
ok 1 number(s): "40"
Test #10:
score: 0
Accepted
time: 3ms
memory: 3712kb
input:
100 100 364505 -194531 109001 -554790 277625 772083 279519 251278 489553 284281 568348 219314 459400 196973 357835 6553 -130455 -358788 414022 -332499 -349676 -788917 -298549 223062 -52856 136058 -425631 -287373 381942 -313648 -120996 163589 -118417 -297886 468187 -302167 408590 -384151 273702 -3017...
output:
50
result:
ok 1 number(s): "50"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
1 200 -137388 605406 150228 160500 -377496 -416658 -62916 -493698 211218 -527724 -579084 86028 -397398 633012 -168204 -195168 240108 141882 -352458 -430140 634296 -255516 263862 -372360 86028 -330630 -138672 -240108 -464166 482784 -132252 39804 451968 58422 552120 -329346 629160 -5778 374286 -399966...
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
2 200 -73295 90146 -74117 109737 136589 -73158 133301 -63842 -51101 55485 -6028 -32058 107271 -96037 -34798 134397 121245 -92064 -67815 -22879 20687 -49594 69185 -63431 37264 129054 -11371 -111655 137 -4247 87132 -49457 90146 -128369 101380 -13563 27948 -88776 -53567 -80419 -130013 -36442 67815 5603...
output:
1
result:
ok 1 number(s): "1"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2 200 -512568 189918 -75962 646292 -237356 -739734 738692 876332 -610258 787440 58012 581534 152514 481032 -618516 -267190 -37270 345952 762388 -934826 -772608 -596578 -315448 432632 234780 -503902 -759468 190840 -372838 -874318 889054 142066 -425264 864710 -786616 -953398 92812 -354614 962314 40864...
output:
2
result:
ok 1 number(s): "2"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 200 -888973 -741473 281702 201434 -972623 790814 772339 164809 -652509 -644422 -970664 -243177 529092 867705 -109872 933415 -26371 -496151 -555880 672360 -586265 -881854 291762 188971 610749 -854206 -698321 -199950 -385925 -634085 -854761 33220 548706 906436 -51326 -488284 812304 -759700 -238773 -...
output:
1
result:
ok 1 number(s): "1"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
200 1 -57283 233762 -517273 -677149 313547 630145 626780 -543717 -460242 -561481 -604160 -775702 476390 113255 673585 -823652 -63239 39548 475443 -773936 -108976 390254 -794533 497737 977058 -863007 129242 -538681 662605 -197589 -151402 -999156 -977855 -274111 -987792 510974 -988302 -963339 250255 3...
output:
1
result:
ok 1 number(s): "1"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
200 1 -166666 762472 179640 637722 -213572 -16966 751494 648700 977042 -33932 544908 26946 154690 274450 554888 649698 -742512 211576 496006 -943110 518960 928140 -985026 178642 513970 266466 74850 -999996 -886224 -122754 -546904 -316366 -28942 -129740 726544 968060 490018 574848 79840 415168 982032...
output:
1
result:
ok 1 number(s): "1"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
200 2 58824 -637260 -45648 494520 -7920 85800 -10728 116220 -68400 741000 -39240 425100 -33552 363480 -30564 331110 -87084 943410 58284 -631410 -4536 49140 59400 -643500 39384 -426660 5904 -63960 -41040 444600 6300 -68250 77796 -842790 -16056 173940 -71892 778830 -9900 107250 8316 -90090 76680 -8307...
output:
1
result:
ok 1 number(s): "1"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
200 2 960507 -284679 -575051 -300305 -552310 64754 351029 -141709 468976 -410948 -278840 -459080 237372 278292 -163261 299513 195229 -866225 -468719 -432749 -640387 -771385 801531 -511923 -696222 -891822 -531667 -996121 16753 -246197 -728269 -915055 885601 -341309 -349451 -574697 -821937 -206439 -32...
output:
2
result:
ok 1 number(s): "2"
Test #19:
score: 0
Accepted
time: 4ms
memory: 4164kb
input:
200 200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
0
result:
ok 1 number(s): "0"
Test #20:
score: 0
Accepted
time: 9ms
memory: 4196kb
input:
200 200 -79648 -106400 116736 136192 -302480 262656 55936 276944 -213712 -103056 -279376 239248 -227392 -271168 117344 177232 217664 -202160 202160 -205808 277552 -258096 194256 195776 92416 200944 232864 232560 144096 -86640 -36480 268736 125552 41648 -149568 92416 -62624 303088 -295184 -225264 -16...
output:
1
result:
ok 1 number(s): "1"
Test #21:
score: 0
Accepted
time: 9ms
memory: 3896kb
input:
200 200 -459208 -142457 -116372 196107 -271809 -115079 296491 -337047 -1427 223378 -82088 -2812 385239 162900 -82964 -527914 282742 -138185 171869 58243 -174842 -107979 99456 157676 -514488 148978 384487 190876 -69551 271265 64878 482271 148497 -496642 -161806 14662 118073 290338 -62248 -536398 8296...
output:
2
result:
ok 1 number(s): "2"
Test #22:
score: 0
Accepted
time: 14ms
memory: 3964kb
input:
200 200 398059 355503 117279 549928 175445 2424 577458 -131733 163190 -102021 -279371 -301301 -153471 -512142 -218065 874460 462708 -152787 596352 275057 -115728 690131 -260887 332091 119822 19319 -211913 10484 302589 378162 -627561 -212257 47219 262428 164449 -233038 164177 -338033 219208 -179884 -...
output:
99
result:
ok 1 number(s): "99"
Test #23:
score: 0
Accepted
time: 15ms
memory: 3932kb
input:
200 200 286856 -283694 21905 936033 479384 541237 364263 -161475 -110266 -175058 14993 817772 -236964 -148203 388226 -193410 177026 287140 419409 -225505 81179 -50826 550209 195625 -301144 -281680 -113387 -576679 -694284 136637 74482 76460 54033 -359552 34111 -328715 349327 -477617 -102224 -10486 41...
output:
100
result:
ok 1 number(s): "100"
Test #24:
score: 0
Accepted
time: 14ms
memory: 3904kb
input:
200 200 223586 -520096 -140193 362150 592865 -211110 -357068 -34480 -231791 318066 112683 -127187 164302 329063 -122351 288332 129415 241132 109603 -148278 -148839 646321 -71189 183693 32568 369625 605851 -165240 345386 391126 -142425 -137371 -561810 -223741 -447394 321393 340616 -255775 425018 2010...
output:
101
result:
ok 1 number(s): "101"
Test #25:
score: 0
Accepted
time: 16ms
memory: 3960kb
input:
200 200 98471 -336441 179490 -137236 -199643 -340884 -226723 -99819 -341596 -62478 -137966 -335231 -44295 344946 -317798 -334408 183927 156748 -348335 -143984 120749 -32554 295812 185693 515943 -151302 -76493 151517 -192664 -233619 148476 20650 101695 -149543 88084 -84180 263921 192086 -199045 11772...
output:
198
result:
ok 1 number(s): "198"
Test #26:
score: 0
Accepted
time: 16ms
memory: 4000kb
input:
200 200 33529 169798 36315 75938 -4590 389086 318318 -239789 69178 80219 -87892 -20987 -104376 112265 521122 47992 -259067 126156 106980 -62937 -269108 -44990 -76017 -86887 41197 -250197 -328925 2918 274755 -542983 58454 228847 -318658 366028 -286475 -103605 -356197 318432 73454 79485 194450 -231326...
output:
199
result:
ok 1 number(s): "199"
Test #27:
score: 0
Accepted
time: 9ms
memory: 4196kb
input:
200 200 300324 361173 68395 440414 318013 336963 -131162 327512 -204301 113443 -290294 -114310 20676 111879 57385 -60243 116785 -270276 -649834 11756 194554 -267913 289031 -92146 75653 79854 60124 -78683 470545 132169 -90481 218409 22687 120043 -219639 -219146 -298391 -160287 -272944 278090 64175 -2...
output:
200
result:
ok 1 number(s): "200"
Test #28:
score: 0
Accepted
time: 9ms
memory: 3952kb
input:
200 200 202508 717943 -275690 308498 -13297 -115972 -139133 -32389 78090 364206 204871 -176752 -628524 -379191 462929 235933 -147052 -137129 10227 196054 -377970 -451642 736592 5242 114049 258771 -627318 -824148 -102807 253777 -18786 -222957 294324 178803 -146737 -214274 574454 -164779 282599 126674...
output:
50
result:
ok 1 number(s): "50"
Test #29:
score: 0
Accepted
time: 12ms
memory: 3960kb
input:
200 200 472075 -198014 345375 542707 -180901 -304044 -491261 -565544 806106 183030 -401118 416275 617383 234970 -37316 -117490 -732343 244273 664647 67691 987753 -124630 -60761 497472 -453897 131477 -827358 -732389 -10200 306370 451992 228041 -143374 -248562 968507 -914917 580919 -543768 267767 4535...
output:
50
result:
ok 1 number(s): "50"
Test #30:
score: 0
Accepted
time: 15ms
memory: 3968kb
input:
200 200 -179609 -238250 -71891 174662 157873 -30508 -93804 -136448 26258 34547 16593 152573 121685 24079 -169966 -68595 375422 -560822 -538278 595885 -120601 -332571 -17202 -69025 292773 99650 -275238 388241 374015 2480 -99340 416761 175522 57017 13220 -56050 -559489 145603 134460 -62889 -642874 290...
output:
100
result:
ok 1 number(s): "100"
Test #31:
score: 0
Accepted
time: 15ms
memory: 3896kb
input:
200 200 376886 188912 -408059 299367 192242 237174 -632084 426641 -241479 249767 -116307 -286096 -196994 191996 -649176 -186751 -15644 -178572 -107523 343985 157595 -246594 -167463 -4371 334528 463593 403907 -8165 479073 313528 -187291 229995 28930 582787 -111509 -3519 -191050 160551 501515 5073 -69...
output:
100
result:
ok 1 number(s): "100"
Test #32:
score: 0
Accepted
time: 15ms
memory: 3952kb
input:
200 200 -113533 419469 219658 -146735 33222 111901 608387 -249963 -577655 234153 -132274 -355086 -136338 -630410 267255 413542 -198529 -309096 89110 347118 -110234 -197656 311361 492852 -141873 -152067 442372 -26180 -166989 283463 -67854 -288753 102058 239202 -103753 182305 -226246 -17674 184299 -26...
output:
150
result:
ok 1 number(s): "150"
Test #33:
score: 0
Accepted
time: 15ms
memory: 4124kb
input:
200 200 -282481 -180267 -208603 384422 396824 31346 -499947 236839 -537822 166154 271580 354499 -288129 -136197 69942 259089 102385 127567 36733 -25614 -227711 110905 -289147 213163 212211 360998 140189 -88642 209438 -75829 925679 160220 70945 448918 -421399 170543 -648209 -67584 -264240 -137963 743...
output:
150
result:
ok 1 number(s): "150"
Test #34:
score: 0
Accepted
time: 16ms
memory: 4196kb
input:
200 200 2610 -89611 290979 -49530 48740 298015 13604 -77685 -346818 -5211 122672 -271725 -405997 -208332 -5124 415253 74601 434582 240365 -201119 307061 -147960 203611 108006 -224309 -163970 -88207 -86401 -271749 280358 -202486 -127089 30910 445236 -254239 91056 -68512 21053 -305806 -87044 -249961 -...
output:
199
result:
ok 1 number(s): "199"
Test #35:
score: 0
Accepted
time: 16ms
memory: 4196kb
input:
200 200 -245673 -129450 57692 -263451 -347228 1636 -318845 -218949 -103575 148560 69287 47240 202362 64287 -165110 80391 -12341 578168 -20633 -324374 -230952 -113273 -378277 261162 -230358 -9962 -503292 -43311 -192060 71560 619710 308899 -200762 -106788 222331 233030 -301527 20858 237233 391439 -122...
output:
199
result:
ok 1 number(s): "199"
Test #36:
score: 0
Accepted
time: 16ms
memory: 3896kb
input:
200 200 613125 -839539 -695688 -216189 -532983 295863 635766 777476 -28238 -252602 -416531 33995 290134 -909781 -383900 549272 -124032 -72506 780767 214191 -797660 -200289 242042 383535 -743093 -524332 192189 -317086 -692817 -736724 -141834 429265 -183227 -182965 795563 -941251 -745754 -241749 56154...
output:
200
result:
ok 1 number(s): "200"
Test #37:
score: 0
Accepted
time: 9ms
memory: 4160kb
input:
199 199 467363 -557013 107158 299703 -422316 -404509 937717 253285 243653 572706 434143 535133 753639 995154 733971 758336 29181 574284 -784333 -486910 544333 -153315 -334434 395901 674691 -677655 -29417 -350245 202778 -663295 -396811 -304811 494926 -319485 -660763 394510 871489 -166544 220183 -3482...
output:
199
result:
ok 1 number(s): "199"
Extra Test:
score: 0
Extra Test Passed