QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#199350 | #6347. XOR Determinant | ucup-team870# | AC ✓ | 18ms | 4036kb | C++14 | 1.4kb | 2023-10-04 09:52:49 | 2023-10-04 09:52:50 |
Judging History
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 IOS {cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);}
using namespace std;
mt19937_64 rd(time(0));
typedef long long ll;
typedef pair<int,int> P;
const int mod=998244353,N=122;
ll v[N][N];
ll qp(ll x,ll y){
ll res=1; x=(x%mod+mod)%mod;
while(y){
if(y&1)res=res*x%mod;
x=x*x%mod; y>>=1;
} return res;
}
void slv(){
int n; //n=62;
cin>>n;
vector<ll>a(n+1),b(n+1);
// rep(i,1,n){
// a[i]=rd()%(1ll<<60); b[i]=rd()%(1ll<<60);
// }
rep(i,1,n)cin>>a[i];
rep(i,1,n)cin>>b[i];
if(n>61){
cout<<"0\n"; return;
}
rep(i,1,n){
rep(j,1,n)v[i][j]=(a[i]^b[j])%mod;
}
int ans=1;
rep(i,1,n){
rep(j,i,n){
if(v[j][i]){
if(j!=i)ans=-ans;
swap(v[i],v[j]); break;
}
}
if(!v[i][i]){
cout<<"0\n";return;
}
ll inv=qp(v[i][i],mod-2);
rep(j,i+1,n){
ll t=inv*v[j][i]%mod;
rep(k,i,n)v[j][k]=(v[j][k]-t*v[i][k])%mod;
}
ans=ans*v[i][i]%mod;
}
// rep(i,1,n){
// rep(j,1,n)cout<<v[i][j]<<' '; cout<<'\n';
// }
cout<<(ans%mod+mod)%mod<<'\n';
}
int main() {
IOS
int T;cin>>T;
while(T--)slv();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3692kb
input:
3 2 2 5 4 1 1 1000000000000000001 987467354324283836 4 1 2 3 4 1 2 3 4
output:
21 214139910 998244129
result:
ok 3 number(s): "21 214139910 998244129"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1 5 1 2 3 4 5 1 2 3 4 5
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
100 10 1107560013855173757 966681903163989710 521892103913129269 1038348664970462356 604430971757857481 1106581500345020431 788162934600883665 124672524392773463 534904853987097709 784497626701360420 402515001559379490 846591944896429860 761680713769800085 722846292535048189 621369111578909792 49581...
output:
548320033 488137899 509538360 732652365 956551480 888843023 560651618 189658616 667887492 788885505 155196573 934158515 897579513 928218896 846866262 443345610 390799518 148725345 892245870 273938687 487734460 478338536 258981818 853512398 952636045 406224138 199504048 631337716 29490784 62730160 94...
result:
ok 100 numbers
Test #4:
score: 0
Accepted
time: 15ms
memory: 3980kb
input:
181 55 259826570151423127 58870406144128000 310271049587997524 401710073886773698 514286909385841735 162284846714225243 536074036455895273 265892726370365687 1083624247485293743 2294265759278634 1109697269509916767 119509764279027081 676809147172263541 685533985118893838 578164705093722225 749670267...
output:
250966714 189614849 870870263 628983732 439500925 167026357 880398758 988810735 911943102 1063939 834869831 322770187 318884496 313423629 256256099 557682540 821588970 365649865 728030647 227507483 54912370 697674469 17837535 608934788 198096034 862343012 611724164 461668994 190235391 3648045 303758...
result:
ok 181 numbers
Test #5:
score: 0
Accepted
time: 18ms
memory: 3756kb
input:
169 59 263131534273822231 721315260374372529 22596975172294779 587943029601145634 578406889381301720 1052976625790254378 1042479356926816953 62521207877861669 84439288007663497 104844738588741000 1114460585099051870 114694613171354451 737641966677819022 428614303859254465 736738606337870847 10270405...
output:
679833894 707359193 489328896 489331972 378698263 670232661 604105888 337180462 768492368 287273997 416687126 531928536 497729522 781926730 637316876 448456159 839190068 52762183 584682392 634497786 902597867 971239442 361789519 331227756 191954243 240205925 234462528 495375269 592860446 207834359 8...
result:
ok 169 numbers
Test #6:
score: 0
Accepted
time: 17ms
memory: 4012kb
input:
166 60 80154134565266370 488932265115032860 303835835035297206 575581085106658104 833807689536921183 187169890408130963 1048058980828122057 110567463708412924 327808012109170094 95218974667774735 433999115170249685 467678946339214050 609742608869014608 133569764370459119 776300965852048567 463747864...
output:
670693684 567395563 608098032 942216233 217410998 326969104 25422274 480790118 342481245 102562285 61647851 552914906 620545717 914965321 3734736 105108911 696719302 651957753 613434616 624957763 426547790 885982943 586546938 104962862 114875102 677394436 60012578 348000979 692703882 977900715 85838...
result:
ok 166 numbers
Test #7:
score: 0
Accepted
time: 18ms
memory: 3744kb
input:
163 61 80980377743349794 78082725295428680 808378069808536832 277850281918593630 877981892336811364 898303075033883084 323880166130506137 525399171051596912 366242148391474277 120856593948882151 723420323440470677 764275661616196241 647981809066855810 259339928715802532 1105675893907201571 986085105...
output:
781999390 150921221 900235323 20064573 694343886 190286225 449935087 616624976 39538288 98442178 774594670 603521139 10351203 463784420 333056108 882021489 788229234 168165928 207073662 923993026 73715002 601966927 335770037 491758974 130974448 495077297 687620817 975466541 141059536 870777248 69416...
result:
ok 163 numbers
Test #8:
score: 0
Accepted
time: 2ms
memory: 3936kb
input:
161 62 81806616626465922 820154690082671476 159998799974929481 1133040983337376131 922156095136701546 752622856039737192 940230878394780900 876189860964965406 404676288968745755 146494213229989566 1012841527415724372 53450261428508183 918808710068410578 9472340566470933 895300396186403473 5946824184...
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 161 numbers
Test #9:
score: 0
Accepted
time: 15ms
memory: 3680kb
input:
181 55 813902528530498317 180553376450447066 952929383886454990 1127838565189677747 462303537504172717 166170016407693079 41709138539484009 120616734935102105 773550734702549860 652558168256903871 822608206166062912 344962306047843251 653626998063283215 539367306208685872 1073092847699637600 1075409...
output:
533150857 223914787 76208125 879575230 684211869 489973789 363840325 385273972 683382412 754906630 723304744 891645742 840183276 857914697 465043418 273457101 599333673 289388109 36603890 188185515 711040291 251963599 164600864 248651956 320282448 799695992 514398894 743707838 241657476 423674013 85...
result:
ok 181 numbers
Test #10:
score: 0
Accepted
time: 13ms
memory: 3756kb
input:
169 59 664633971924301509 1015856842210128652 1135439982029079939 664938483297163839 969041681867477622 503817547941989704 1120582593358942609 512315393524375922 822718879463481778 722296330081651187 953334605269893274 1009903145972283456 94273932496766485 1045164449466553642 719185047838359120 9174...
output:
540805188 209724623 224913308 292637194 539286796 46210618 494591805 43193364 240515170 893233359 54134421 455536894 641024771 868384248 689588299 973292922 5411084 401959756 742933833 325618479 922496999 315641820 499458907 61205446 170295419 265505548 446460060 936773155 206367474 155004066 986553...
result:
ok 169 numbers
Test #11:
score: 0
Accepted
time: 17ms
memory: 3976kb
input:
166 60 438751897612726088 884489715619741346 23331573624464874 930776067265462412 39206478187622273 344702045846930483 336358708039241526 246423880255388410 355338111331239092 501191972975416832 812854079844091372 131788710116818991 485083549946140380 712851737653481480 707183787820265532 5694722665...
output:
505017865 244328792 927344639 677883188 949936571 839752803 641551817 990797216 465518177 62806406 71692954 709749005 652669480 756273241 627226311 507735638 515999266 928603310 104990004 642309248 140191239 609391980 715786045 150545610 174667619 340303901 915009948 150208198 16001630 915760064 904...
result:
ok 166 numbers
Test #12:
score: 0
Accepted
time: 18ms
memory: 3744kb
input:
163 61 606137986164597094 288888906808066084 1075148874264087892 330016912604527219 606346398592488360 948734332384841167 612808446315210925 305201077715513332 560028049479780861 192288153526804840 789160270425808641 1104725498421783449 615630835465346487 373837385237765447 940211620425070518 114300...
output:
975345327 330502973 66545596 625685446 336974815 971935248 628956027 25695672 546021282 641037835 607780784 566453312 572137163 669805025 290615984 64744663 204878686 905048888 974237989 610688344 920096387 517535618 836277689 478344157 148295210 734049074 377010889 853985155 151682954 467017941 711...
result:
ok 163 numbers
Test #13:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
161 62 204565264782443886 86262081086943157 396383503922503367 441342868074144963 662068935529021160 232386748419747309 311285488989846316 191012590169460885 157941978175301522 451547184819719164 594601365823175856 974151620488863468 772774499757852953 178301110067560089 100998644286448982 100432943...
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 161 numbers
Test #14:
score: 0
Accepted
time: 2ms
memory: 3708kb
input:
10 1000 901789285036373850 551281949268396521 878675026029307816 232353893052742618 282478458952634385 594328444125314099 240943963070985986 1351997653528367 67904742576990276 105971007583102831 439932648144504352 930024009301071260 998092707364170936 1001082649286606430 991795711725486065 701333592...
output:
0 0 0 0 0 0 0 0 0 0
result:
ok 10 numbers
Test #15:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
5 2000 430524949516104788 761714890778265787 492578849171032080 885322526997308306 52262836398241401 165051513964825262 1035581243534689912 657180693219234515 231034019148427788 877378881709638819 721070517355819538 812887449257257639 1104545776802998651 133501675578071972 447090182702868582 1658207...
output:
0 0 0 0 0
result:
ok 5 number(s): "0 0 0 0 0"
Test #16:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
3 3000 1112182122897649998 972147832288135053 106482672312756345 974968714155728098 888696088411183401 79483381482287537 916888989103971777 452146820167493671 495865251229327831 876607651219509782 1149977195264332214 444048331642435436 624692249227908849 741004581351796952 285840553266343585 2806563...
output:
0 0 0
result:
ok 3 number(s): "0 0 0"
Test #17:
score: 0
Accepted
time: 2ms
memory: 3760kb
input:
2 4000 640917791672348232 29659264896190048 873308004356294881 744753095896302411 459419153955727268 575213840843878152 798196734673253643 682811094191843311 673259625481526850 518484402601072657 107032281491632067 167026137339116741 436497053493527354 377463381605627956 427810986404737022 109152488...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #18:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
2 4999 1135444633311501208 90279035091864910 16821296539666479 1046070809505842740 737100690308217339 575910855173371803 845126505080869303 1041680540611069336 79362855813988947 788781454003227199 328210225095439184 131466495466041873 1022377407734903886 226199390608643554 961331040001580766 3916356...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #19:
score: 0
Accepted
time: 2ms
memory: 4036kb
input:
2 5000 169653456152079169 240092206406059314 487211827498019145 538385411027376829 30142223795238430 1070944300205468768 119165540227240574 894372422205625437 885759494875552832 217008872325778896 1042925456232579615 248301849169211268 13922190449393552 732806899414048080 574965648260520491 83728147...
output:
0 0
result:
ok 2 number(s): "0 0"
Test #20:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
112 89 889429371203515704 460443767010346911 653895795406935282 582576007928132700 231469773411370242 362329758127075428 589424807279748361 223827725797894847 859365944897586945 699345639622516531 768183141645938649 1122841202559933178 193246363332955460 902331735099195440 315583059893836516 6584727...
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
result:
ok 112 numbers
Test #21:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
111 90 228060771751007241 570214063433645169 486870573566989705 649444527351798989 444837337186337795 621798852624095715 942714363724023129 758557377724972384 442379732631130994 546230700795782355 939672385666422391 455424707542186492 211715370058969491 526045774402769358 795076410155903909 62927752...
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
result:
ok 111 numbers
Test #22:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
84 119 14678929386429953 1048182613982528840 520462603303024815 558529960729962403 660342429167843023 41381675961848824 948440525049783527 410037804363627088 300531479389543894 854727441177397911 850060068286149107 486670191391468123 758142503562288245 690514033154736852 1061122394063596308 35730636...
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
result:
ok 84 numbers
Test #23:
score: 0
Accepted
time: 2ms
memory: 3700kb
input:
83 120 984623034284721067 815799614428221875 546168020530442169 915743229323462486 328496449481539681 119243903821723416 631047415752070036 62964382821085368 1098096169573871805 840434300070215545 959130230364480211 1111126841025115139 562614679640899734 766077858869768259 210074486084220184 5744545...
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
result:
ok 83 numbers
Test #24:
score: 0
Accepted
time: 2ms
memory: 3736kb
input:
55 179 114353094344002625 526439627254477603 630138734870491549 547795913088969238 1119389706129794340 678621940415642567 1078577551319476828 931618635505289709 1023815369793697429 915246012475424855 197452077847738146 551910767210269486 1075336374154782746 1124728592071278316 575766407096873720 659...
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
result:
ok 55 numbers
Test #25:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
55 180 1084297199242293740 294056631995137933 911377599028461272 535433972889449003 221869001678566826 100124218762028757 1002346823794429432 503732356548656240 22065859294916627 1014189605872731163 975891456696308236 115308845331404773 69552724333901028 233824790514974417 699050417753323960 5126168...
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
result:
ok 55 numbers
Test #26:
score: 0
Accepted
time: 5ms
memory: 3780kb
input:
995 17 455020582711785941 101049831052989076 644484598115323441 996033953973631887 571804515738105159 915799786865118917 9552249597666363 5132296966321634 427603614307809014 330548437405245578 375950838029697553 619289061543764588 1109011514402648319 614264641941812025 971742760972329451 18439963242...
output:
975395265 346955514 235206505 979987171 320187618 396918523 360106021 424055270 609940208 429155306 980698705 647744203 951242871 494880755 766444832 686105298 600008835 631649435 421317901 868539062 24808307 317496003 129273907 552554771 416191884 675857215 524039093 751067008 474439834 219405318 4...
result:
ok 995 numbers
Test #27:
score: 0
Accepted
time: 14ms
memory: 3724kb
input:
202 46 924784274809132667 819033584895748171 733700240115727850 691634328812010996 785264807368955109 302085343394375647 872422048742771267 938917766519674659 335437377424658503 959816353507963691 498742643721949841 1001768915018140210 85549710031106290 54201530531527432 340826229450779887 722437372...
output:
522954388 148400874 483191966 34206991 625109889 763117138 32716472 54283744 209150897 265237035 709033068 309025995 275810777 210773460 144508830 245799286 298759612 674914098 912554241 500430690 383089778 378416611 76041350 630614273 260031583 248398544 960247232 109197575 404247974 440443270 7218...
result:
ok 202 numbers
Test #28:
score: 0
Accepted
time: 17ms
memory: 3752kb
input:
174 61 1032083232044731498 355957996281040786 368641031965495573 796663268135070442 796330530447122345 674269862404888858 400596484181545674 26831942237948702 83854654338697284 29437219307557211 533586279534131079 972365847875622576 631733204996151473 300132904287260157 919005859860867692 7774272920...
output:
394222188 28080501 376340480 87242186 681104370 357371538 935222886 65273002 550121377 949358165 585779265 152984212 514397762 592631398 76536596 563796382 524379428 164723726 338595375 438361882 564222818 700881473 970881653 46572274 551613068 668549810 66200100 55497662 430949343 571295904 7361085...
result:
ok 174 numbers
Test #29:
score: 0
Accepted
time: 14ms
memory: 3988kb
input:
167 58 606860014767344045 44273116115805147 262860854522527622 94514475561616272 323860647642632971 951973547393174698 1135637494049228589 424083522185318705 868882181252822404 948872517818194562 1113899188684509737 221387006182012469 565153314898159308 729028822000748899 1036199630291173027 7207174...
output:
235255537 654126051 119707135 0 972855606 795686374 0 390780225 594321463 143912754 215844291 550142389 127836204 0 313940329 173749140 533414974 0 303588418 179300282 528338567 657326340 757540791 686685098 371282664 247052967 0 0 0 0 83172216 796138725 448783671 893975659 0 0 726536568 809770164 2...
result:
ok 167 numbers
Test #30:
score: 0
Accepted
time: 10ms
memory: 3704kb
input:
164 60 235035030182524054 728460036183446208 962003949241581394 1055312775854311391 254312532236102071 1035795983452030602 780067033885087030 850649939398842287 366839786095428525 247274396776601653 172264577654336664 32254574811836581 495145109788065695 557352899612637016 1055094871592907016 106223...
output:
42633338 0 511966967 0 0 0 266819211 759921406 655725156 0 0 0 0 0 388160770 490375315 0 624619695 612273864 0 0 0 304521169 883736884 399458713 0 0 0 0 69956260 814458962 4328287 341810066 0 0 0 541927061 837262446 0 225542423 0 0 765119918 554283535 0 0 900348794 0 0 480480273 528408692 274377700 ...
result:
ok 164 numbers