QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#513145 | #5825. 矩阵 | zhengchenxi | 100 ✓ | 187ms | 126588kb | C++14 | 1.2kb | 2024-08-10 17:03:28 | 2024-08-10 17:03:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=3e3+107;
const int mod=998244353;
int a[N][N],b[N][N],c[N][N];
int d[N],e[N],f[N];
int read()
{
int f=1,s=0;char ch=getchar_unlocked();
while(ch<'0'||ch>'9'){if(ch=='-') f=-1; ch=getchar_unlocked();}
while(ch>='0'&&ch<='9'){s=(s<<1)+(s<<3)+(ch^48);ch=getchar_unlocked();}
return f*s;
}
signed main()
{
int T=read();
while(T--)
{
int n=read();
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) a[i][j]=read();
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) b[i][j]=read();
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) c[i][j]=read();
for(int i=1;i<=n;i++)
{
// f[i]=gen()%(mod-1)+1;
// f[i]=1;
d[i]=e[i]=0;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
d[i]=(d[i]+b[i][j])%mod;
}
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
e[i]=(e[i]+c[i][j])%mod;
}
}
for(int i=1;i<=n;i++) f[i]=d[i],d[i]=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
d[i]=(d[i]+a[i][j]*f[j]%mod)%mod;
}
}
bool flag=0;
for(int i=1;i<=n;i++) if(d[i]%mod!=e[i]%mod) flag=1;
puts(flag?"No":"Yes");
}
}
详细
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 1ms
memory: 7820kb
input:
77 5 310980524 649430325 929726167 322133176 196533101 452124191 763518207 462580246 389109943 258982238 980842752 382992674 892794173 572244127 863057091 124971774 306543135 142770389 191933270 159536107 109591708 788516987 986057559 843265788 373012497 68607783 73771527 80822244 141931517 25629982...
output:
Yes Yes Yes No Yes Yes Yes No Yes Yes No Yes Yes Yes No Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes No Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No No No No Yes Yes No No No Yes Yes No No Yes Yes Yes Yes
result:
ok 77 token(s): yes count is 54, no count is 23
Test #2:
score: 10
Accepted
time: 2ms
memory: 9792kb
input:
20 19 300786426 55348523 438467798 718608329 639575511 877480154 131078518 50498458 505652400 70781693 60607235 327377105 962399950 299685377 189021169 768713056 159947767 323830788 939451729 663015053 702349816 47032062 144232075 8590829 314695773 653195451 79047310 190236549 193759597 40824001 648...
output:
Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes No
result:
ok 20 token(s): yes count is 15, no count is 5
Test #3:
score: 10
Accepted
time: 121ms
memory: 124936kb
input:
17 1596 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
No Yes Yes Yes No Yes No Yes Yes No Yes Yes Yes Yes Yes Yes Yes
result:
ok 17 token(s): yes count is 13, no count is 4
Test #4:
score: 10
Accepted
time: 76ms
memory: 112916kb
input:
67 1434 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:
Yes No Yes Yes Yes No No No Yes No No No No No No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes Yes No Yes No
result:
ok 67 token(s): yes count is 45, no count is 22
Test #5:
score: 10
Accepted
time: 156ms
memory: 118752kb
input:
56 1496 827382385 334050842 562523170 64248344 772202392 344227963 962535698 610424680 191764282 201712819 261741289 38707441 723490918 616784554 656880245 541289597 106479168 181789413 983195098 366707435 245960214 738618459 166000436 637820477 108811383 83646606 418099171 704739401 10052747 848798...
output:
Yes No Yes Yes Yes Yes Yes No Yes Yes No No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No No Yes Yes No No Yes Yes Yes Yes Yes No Yes No No Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes No Yes No Yes
result:
ok 56 token(s): yes count is 40, no count is 16
Test #6:
score: 10
Accepted
time: 187ms
memory: 126588kb
input:
20 1603 91905310 952717462 954485887 678448563 186981847 978898327 338140536 142208894 826264776 31056661 228690801 739960038 636575118 693539178 552731649 447161207 735822147 549896101 448501798 249993628 232603979 651172711 525376001 686066708 334392371 31224732 830607244 501599631 12908074 490182...
output:
Yes No Yes No Yes Yes No No No Yes Yes Yes Yes No No No Yes Yes No Yes
result:
ok 20 token(s): yes count is 11, no count is 9
Test #7:
score: 10
Accepted
time: 146ms
memory: 118440kb
input:
83 1504 312926430 470364934 584087355 865456364 663314460 144864284 86040064 304739271 52110782 189905783 204867442 654669354 700416903 873419055 247798007 336659255 547886460 35701369 50399953 750825612 232240264 279725763 390903577 254078528 123437599 833862824 919919348 664000739 203075130 525566...
output:
Yes Yes Yes Yes No No No No Yes No Yes Yes Yes Yes No Yes Yes Yes Yes Yes No No Yes No No Yes Yes Yes Yes Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes Yes No Yes Yes No Yes No Yes Yes Yes Yes No Yes Yes Yes Yes No Yes Yes Yes Yes No No No Yes No Yes No Yes Yes Yes Yes No No Yes Yes No No Yes No Yes ...
result:
ok 83 token(s): yes count is 55, no count is 28
Test #8:
score: 10
Accepted
time: 146ms
memory: 118556kb
input:
92 1491 422064757 810225812 58914901 70234338 273595204 258594523 880518679 942823445 991245948 834057054 985736324 626095263 195913075 708777902 158324260 624966332 989571760 895942048 76442464 377096766 794818118 240859092 475927849 113281577 787350276 276940304 971362517 217702894 867701250 98410...
output:
No Yes No Yes No Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes No Yes No Yes Yes Yes Yes Yes No Yes Yes Yes No Yes No No Yes Yes Yes Yes Yes Yes Yes Yes Yes No No No No Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No No Yes Yes Yes Yes Ye...
result:
ok 92 token(s): yes count is 64, no count is 28
Test #9:
score: 10
Accepted
time: 146ms
memory: 118692kb
input:
58 1499 751071830 198863820 292534250 533580356 205272669 522998611 544079196 862157715 390778805 173487948 2829675 199144838 675250424 278673908 174319522 917235530 482538942 310120418 499417216 744352970 198105466 851050201 324562569 348438015 496335083 992485291 846615552 237913613 805117120 5265...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes No No Yes No No Yes No Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes No Yes No Yes No No Yes No Yes Yes Yes Yes Yes Yes No Yes Yes Yes No Yes No Yes Yes Yes Yes No No
result:
ok 58 token(s): yes count is 39, no count is 19
Test #10:
score: 10
Accepted
time: 165ms
memory: 119028kb
input:
63 1522 804799017 382423356 136999262 517603642 272623548 81400703 177936492 183644706 811008901 195348189 420358926 621889115 536952352 617681319 415690825 430566736 944543466 941130403 758469932 177203809 35830351 321068848 919341658 612155458 741714933 350499007 364263342 739984562 253160541 1993...
output:
Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No Yes Yes Yes Yes Yes Yes No No Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes No No Yes No No Yes Yes Yes No Yes Yes Yes No Yes No Yes Yes Yes Yes Yes Yes Yes Yes
result:
ok 63 token(s): yes count is 47, no count is 16
Extra Test:
score: 0
Extra Test Passed