QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#700338 | #21608. 行列式 | TheZone | AC ✓ | 54ms | 4420kb | C++23 | 781b | 2024-11-02 12:45:05 | 2024-11-02 12:45:05 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define N 600
#define M 998244353
int i,j,k,n,m,t;
vector<int> v[N+5];
ll invp;
inline int mod(ll x){
return x - (__int128(x) * invp >> 64) * M;
}
ll hls(int n){
int i,j,k,d;
ll res=1;
for(i=1;i<=n;i++){
for(j=i+1;j<=n;j++){
while(v[i][i]){
d=v[j][i]/v[i][i];
if(d)for(k=i;k<=n;k++){
v[j][k]=mod(v[j][k]-1ll*v[i][k]*d);
}
swap(v[i],v[j]); res=M-res;
}
swap(v[i],v[j]); res=M-res;
}
res=res*v[i][i]%M;
if(!res)break;
}
return res;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>n;
invp = (__int128(1) << 64) / M + 1;
for(i=1;i<=n;i++){
v[i].resize(n+1);
for(j=1;j<=n;j++)cin>>v[i][j];
}
cout<<hls(n);
}
详细
Test #1:
score: 100
Accepted
time: 42ms
memory: 4352kb
input:
494 507979999 844753235 308697058 577366689 725069158 935333779 504374900 25818576 590205152 640101368 622693010 938297920 872742027 301114974 734834637 556531110 842083217 975440662 921805913 100862321 393656903 213191224 795146059 30475198 812681603 711143306 28681751 642978178 605226383 94538558 ...
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 48ms
memory: 4360kb
input:
495 460894111 304739937 206829379 20028685 689849252 682804147 71652376 637764473 241844465 687595930 484335000 997257325 91960282 115487884 693010380 928714517 852523641 284836935 938938149 535872486 937318509 488254844 472128573 598325537 448164264 695849563 357631500 18136818 170181462 743369680 ...
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 50ms
memory: 4292kb
input:
497 992978625 135595668 100067592 966258349 268720954 208159553 292815949 144239011 616187807 131223525 37398060 618882052 958381768 705910280 516881626 529797552 103092975 818823641 958107310 519034374 618004601 22089192 451439147 102279534 260848112 137489705 538426740 360715737 501827504 91382013...
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 43ms
memory: 4276kb
input:
490 606095620 526577618 749002 92727045 713477829 711310002 285285518 869895896 341304078 731510833 992849439 615696835 534048295 7595017 876341982 271404948 821155566 819629263 645006528 353400604 445571584 519466696 285384956 443707571 595516109 578463272 120934435 98086674 434596103 255527559 710...
output:
0
result:
ok 1 number(s): "0"
Test #5:
score: 0
Accepted
time: 47ms
memory: 4296kb
input:
493 605501039 514622351 409922706 338082210 362002781 648772017 642575846 274243185 248202320 136781235 167400754 605189664 755270961 408312147 506733752 367383946 171614465 764280716 805904051 935623612 836937936 801903657 585031190 678293238 426882719 162649698 995973931 820868572 59338187 8307812...
output:
0
result:
ok 1 number(s): "0"
Test #6:
score: 0
Accepted
time: 53ms
memory: 4356kb
input:
494 156648746 154396384 640494892 528756313 434883274 318065816 264440383 659789617 608119380 648104885 725454492 696703871 543030428 663661240 890791532 108201616 428505484 322953840 119811886 691103780 306647414 549862302 176916719 909058872 455464665 307270851 584469329 722629343 875317523 629938...
output:
193142761
result:
ok 1 number(s): "193142761"
Test #7:
score: 0
Accepted
time: 54ms
memory: 4320kb
input:
495 120999146 136987924 40280999 438515315 805152546 234164454 129099933 971852321 983937488 410134225 668461222 574343409 885417013 394300887 86086437 570981511 221329455 57893312 584381871 154204049 738660729 728257729 551666498 540440394 165573287 512342480 452470821 669622703 340240729 965382636...
output:
318551051
result:
ok 1 number(s): "318551051"
Test #8:
score: 0
Accepted
time: 54ms
memory: 4344kb
input:
497 451794314 2028037 288974909 111681588 291303632 155763712 177741457 164199418 280452914 745629015 727272894 383855815 451963117 263419161 854025925 625817844 903511050 636159790 788165373 442332844 275132246 358996390 239303569 23523747 398318281 935986353 142493592 695297770 499848367 7061287 5...
output:
534078061
result:
ok 1 number(s): "534078061"
Test #9:
score: 0
Accepted
time: 52ms
memory: 4376kb
input:
490 504915182 841612625 594492394 841259018 581533827 570061398 728741094 498398681 984147412 115961324 995955785 96920367 943961736 864913388 601212881 773189830 352297773 303107436 986036707 547042133 275735038 251015391 616994042 498027183 5049993 35681904 440260100 11762354 376808026 289984422 1...
output:
734889046
result:
ok 1 number(s): "734889046"
Test #10:
score: 0
Accepted
time: 53ms
memory: 4416kb
input:
493 415335212 437019262 878914770 692819383 929176066 657049555 799637676 179913266 266003265 731227835 705323037 201246867 183631677 270611175 680342740 326297106 21564799 746492922 599870983 729200873 612278331 480645345 574356910 493730340 591363277 253325503 325980362 738703013 254741788 3291237...
output:
859411042
result:
ok 1 number(s): "859411042"
Test #11:
score: 0
Accepted
time: 4ms
memory: 4288kb
input:
494 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 105922509 ...
output:
674537883
result:
ok 1 number(s): "674537883"
Test #12:
score: 0
Accepted
time: 8ms
memory: 4112kb
input:
495 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
528868454
result:
ok 1 number(s): "528868454"
Test #13:
score: 0
Accepted
time: 8ms
memory: 4252kb
input:
497 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 436653166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
352355380
result:
ok 1 number(s): "352355380"
Test #14:
score: 0
Accepted
time: 7ms
memory: 4284kb
input:
490 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 452202176 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
823083983
result:
ok 1 number(s): "823083983"
Test #15:
score: 0
Accepted
time: 7ms
memory: 4420kb
input:
493 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
34761749
result:
ok 1 number(s): "34761749"
Test #16:
score: 0
Accepted
time: 4ms
memory: 3824kb
input:
181 156648746 154396384 640494892 528756313 434883274 318065816 264440383 659789617 608119380 648104885 725454492 696703871 543030428 663661240 890791532 108201616 428505484 322953840 119811886 691103780 306647414 549862302 176916719 909058872 455464665 307270851 584469329 722629343 875317523 629938...
output:
684787115
result:
ok 1 number(s): "684787115"
Test #17:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
198 120999146 136987924 40280999 438515315 805152546 234164454 129099933 971852321 983937488 410134225 668461222 574343409 885417013 394300887 86086437 570981511 221329455 57893312 584381871 154204049 738660729 728257729 551666498 540440394 165573287 512342480 452470821 669622703 340240729 965382636...
output:
579180592
result:
ok 1 number(s): "579180592"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
88 451794314 2028037 288974909 111681588 291303632 155763712 177741457 164199418 280452914 745629015 727272894 383855815 451963117 263419161 854025925 625817844 903511050 636159790 788165373 442332844 275132246 358996390 239303569 23523747 398318281 935986353 142493592 695297770 499848367 7061287 55...
output:
916342887
result:
ok 1 number(s): "916342887"
Test #19:
score: 0
Accepted
time: 5ms
memory: 3768kb
input:
193 504915182 841612625 594492394 841259018 581533827 570061398 728741094 498398681 984147412 115961324 995955785 96920367 943961736 864913388 601212881 773189830 352297773 303107436 986036707 547042133 275735038 251015391 616994042 498027183 5049993 35681904 440260100 11762354 376808026 289984422 1...
output:
887554600
result:
ok 1 number(s): "887554600"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
20 415335212 437019262 878914770 692819383 929176066 657049555 799637676 179913266 266003265 731227835 705323037 201246867 183631677 270611175 680342740 326297106 21564799 746492922 599870983 729200873 612278331 480645345 574356910 493730340 591363277 253325503 325980362 738703013 254741788 32912377...
output:
862191592
result:
ok 1 number(s): "862191592"
Extra Test:
score: 0
Extra Test Passed