QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#512690 | #5825. 矩阵 | CuFeO4 | 100 ✓ | 246ms | 67092kb | C++14 | 2.2kb | 2024-08-10 15:24:36 | 2024-08-10 15:24:41 |
Judging History
answer
#include<bits/stdc++.h>
#include<bits/extc++.h>
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;
using namespace std;
#define infile(x) freopen(x,"r",stdin)
#define outfile(x) freopen(x,"w",stdout)
#define errfile(x) freopen(x,"w",stderr)
#ifdef LOCAL
FILE *InFile = infile("in.in"),*OutFile = outfile("out.out");
// FILE *ErrFile=errfile("err.err");
#else
FILE *Infile = stdin,*OutFile = stdout;
//FILE *ErrFile = stderr;
#endif
using ll=long long;using ull=unsigned long long;
using db = double;using ldb = long double;
inline int read(){
int x = 0;char s = getchar();
for(;s < '0' || '9' < s;s = getchar());
for(;'0' <= s && s <= '9';s = getchar())
x = (x<<1) + (x<<3) + (s^48);
return x;
}
const int N = 3010,mod = 998244353;
int n,a[N][N],b[N][N],c[N][N],res[N][N],rnd1[N],rnd2[N];
int v1[N],v2[N];
inline void solve(){
mt19937 rnd((ull)(new char));
int T;T = read();
while(T--){
n = read();
for(int i = 1;i <= n; ++i) rnd1[i] = rnd2[i] = rnd()%mod+1;
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){
v1[i] = 0;
for(int j = 1;j <= n; ++j)
v1[i] = (v1[i] + 1ll*b[i][j]*rnd1[j]%mod)%mod;
}
for(int i = 1;i <= n; ++i) rnd1[i] = v1[i];
for(int i = 1;i <= n; ++i){
v1[i] = 0;
for(int j = 1;j <= n; ++j)
v1[i] = (v1[i] + 1ll*a[i][j]*rnd1[j]%mod)%mod;
}
for(int i = 1;i <= n; ++i){
v2[i] = 0;
for(int j = 1;j <= n; ++j)
v2[i] = (v2[i] + 1ll * c[i][j]*rnd2[j]%mod)%mod;
}
bool flag = true;
for(int i = 1;i <= n; ++i){
if(v1[i] != v2[i]){
flag = false;
break;
}
}
puts(flag?"Yes":"No");
}
}
signed main(){
//cin.tie(nullptr)->sync_with_stdio(false);
//cout.tie(nullptr)->sync_with_stdio(false);
solve();
}
詳細信息
Pretests
Final Tests
Test #1:
score: 10
Accepted
time: 2ms
memory: 11824kb
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: 11896kb
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: 176ms
memory: 65116kb
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: 136ms
memory: 60928kb
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: 199ms
memory: 63112kb
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: 246ms
memory: 67092kb
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: 208ms
memory: 60988kb
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: 208ms
memory: 63104kb
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: 207ms
memory: 63104kb
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: 213ms
memory: 63080kb
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