QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#746904 | #9562. 欧伊昔 | SunsetGlow95 | 10 | 266ms | 36572kb | C++11 | 3.3kb | 2024-11-14 15:49:58 | 2024-11-14 15:49:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int RDX = 3;
const int MXR = 6;
const int MXN = 12;
const int MXL = 180000;
const int MXC = 3000000;
int N, table[RDX][RDX];
long long arr[MXC], brr[MXC];
int scnt[RDX], spv, R(1), pwr[MXN];
int coa[RDX][MXR], cob[RDX][MXR], coc[MXR][RDX], tmp[MXR];
bitset<MXC> legal;
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
for (int i(0); i != RDX; ++i)
for (int j(0); j != RDX; ++j)
cin >> table[i][j], ++scnt[table[i][j]];
spv = max_element(scnt, scnt + RDX) - scnt;
coc[0][spv] = 1;
for (int i(0); i != RDX; ++i) {
coa[i][0] = cob[i][0] = 1;
if (i == spv) continue;
for (int j(0); j != RDX; ++j) scnt[j] = 0;
for (int j(0); j != RDX; ++j)
for (int k(0); k != RDX; ++k) scnt[k] += table[j][k] == i;
bool typ(*max_element(scnt, scnt + RDX) <= 1);
for (int j(0); j != RDX; ++j) {
bool ex(false);
for (int k(0); k != RDX; ++k) {
if ((typ ? table[j][k] : table[k][j]) == i)
(typ ? cob : coa)[k][R] = 1, ex = true;
}
if (ex) {
(typ ? coa : cob)[j][R] = 1;
coc[R][i] = 1;
coc[R][spv] = -1;
++R;
}
}
}
//for (int i(0); i != RDX; ++i) {
// for (int j(0); j != R; ++j) cout << coa[i][j] << ' ';
// cout << endl;
//}
//cout << endl;
//for (int i(0); i != RDX; ++i) {
// for (int j(0); j != R; ++j) cout << cob[i][j] << ' ';
// cout << endl;
//}
//cout << endl;
//for (int i(0); i != R; ++i) {
// for (int j(0); j != RDX; ++j) cout << coc[i][j] << ' ';
// cout << endl;
//}
//cout << endl;
assert(R <= MXR);
cin >> N;
pwr[0] = 1;
for (int i(1); i <= N; ++i) pwr[i] = pwr[i - 1] * R;
for (int i(0); i != pwr[N]; ++i) {
legal[i] = true;
for (int j(0); j != N && legal[i]; ++j)
if (i / pwr[j] % R >= RDX) legal[i] = false;
if (!legal[i]) continue;
cin >> arr[i];
}
for (int i(0); i != pwr[N]; ++i) {
if (!legal[i]) continue;
cin >> brr[i];
}
for (int i(0); i != N; ++i) {
for (int j(0); j != pwr[N]; ++j) {
if (j / pwr[i] % R) continue;
for (int k(0); k != RDX; ++k)
for (int l(0); l != R; ++l)
tmp[l] += arr[j + k * pwr[i]] * coa[k][l];
for (int k(0); k != R; ++k)
arr[j + k * pwr[i]] = tmp[k], tmp[k] = 0;
for (int k(0); k != RDX; ++k)
for (int l(0); l != R; ++l)
tmp[l] += brr[j + k * pwr[i]] * cob[k][l];
for (int k(0); k != R; ++k)
brr[j + k * pwr[i]] = tmp[k], tmp[k] = 0;
}
}
//for (int i(0); i != pwr[N]; ++i) cout << arr[i] << ' ';
//cout << endl;
//for (int i(0); i != pwr[N]; ++i) cout << brr[i] << ' ';
//cout << endl;
for (int i(0); i != pwr[N]; ++i) arr[i] *= brr[i], brr[i] = 0;
for (int i(0); i != N; ++i) {
// for (int j(0); j != pwr[N]; ++j)
// cout << arr[j] << ' ';
// cout << endl;
for (int j(0); j != pwr[N]; ++j) {
if (j / pwr[i] % R) continue;
for (int k(0); k != R; ++k)
for (int l(0); l != RDX; ++l)
tmp[l] += arr[j + k * pwr[i]] * coc[k][l];
for (int k(0); k != R; ++k)
arr[j + k * pwr[i]] = tmp[k], tmp[k] = 0;
}
}
for (int i(0); i != pwr[N]; ++i) {
if (!legal[i]) continue;
cout << arr[i] << ' ';
}
cout << endl;
return 0;
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
0 1 2 1 2 0 2 0 1 1 7 1 5 8 4 5
output:
result:
Subtask #2:
score: 0
Runtime Error
Test #6:
score: 5
Accepted
time: 0ms
memory: 5676kb
input:
1 2 1 2 0 0 1 0 0 1 8 9 3 1 6 1
output:
84 19 57
result:
ok single line: '84 19 57 '
Test #7:
score: 5
Accepted
time: 0ms
memory: 7736kb
input:
1 2 1 2 0 0 1 0 0 3 0 9 8 8 9 2 6 5 1 7 2 9 8 8 7 9 1 9 8 0 3 6 8 6 6 1 6 2 7 1 0 3 4 9 1 7 3 1 3 3 6 1 4 6 7 3 9 5 0 6 5 6 6 8
output:
2070 1350 930 936 1077 524 774 445 422 995 939 563 984 446 409 681 160 255 715 715 415 569 372 227 360 144 155
result:
ok single line: '2070 1350 930 936 1077 524 774...15 415 569 372 227 360 144 155 '
Test #8:
score: 5
Accepted
time: 2ms
memory: 5792kb
input:
1 2 1 2 0 0 1 0 0 6 4 6 7 3 1 5 3 4 8 5 8 4 8 2 5 9 5 8 9 9 5 0 1 3 3 6 2 6 2 0 7 4 1 9 3 0 1 4 7 6 3 5 6 6 6 8 5 4 7 6 5 6 0 9 3 3 7 7 5 3 2 8 8 6 6 7 5 1 5 0 4 0 6 4 4 0 8 8 9 7 2 3 9 1 2 7 7 5 9 4 2 0 4 0 7 3 2 0 0 5 7 3 0 3 1 4 7 1 5 0 5 7 0 7 3 3 3 0 4 4 8 3 0 3 5 4 6 4 6 2 5 2 6 0 1 0 3 2 7 2 ...
output:
83790 80087 47498 54766 53378 30734 37004 38711 20149 56840 51419 30908 44535 34931 19224 28930 21902 13476 40400 35311 23275 29138 24090 14354 18657 16767 10404 54800 54365 26409 41788 36518 23297 26116 26545 15046 43022 40283 20072 32970 27617 15595 19273 21888 11540 29066 27596 14097 20358 17763 ...
result:
ok single line: '83790 80087 47498 54766 53378 ... 3398 2919 2036 2020 2095 1314 '
Test #9:
score: 5
Accepted
time: 262ms
memory: 36424kb
input:
1 2 1 2 0 0 1 0 0 9 1 4 5 7 9 9 3 2 8 2 1 9 6 3 7 1 5 1 8 5 5 2 2 6 4 0 2 2 4 5 5 6 1 0 4 3 4 6 8 5 9 6 5 0 6 3 9 9 6 0 3 0 9 8 4 8 5 2 6 2 3 7 6 1 6 0 0 0 6 9 1 5 1 1 6 9 3 0 1 6 3 9 9 4 1 6 7 6 1 9 4 8 3 7 5 6 7 7 4 2 1 8 0 2 0 1 4 9 6 1 3 9 3 9 1 7 6 3 5 1 2 9 5 9 1 9 0 2 6 8 0 3 2 3 3 8 7 5 7 5 ...
output:
5491236 3870726 2722667 4095376 3095055 2071305 2714963 2074656 1399744 4044155 3120903 2064947 3040305 2366779 1542749 2083106 1574507 1033341 2685025 2000208 1380383 2078336 1610975 1031792 1345673 1054928 715576 4117744 2722921 1889883 3038009 1917155 1380031 2125417 1319541 942766 2939040 204967...
result:
ok single line: '5491236 3870726 2722667 409537...8 22661 14107 20702 15112 9567 '
Test #10:
score: 0
Runtime Error
input:
1 2 1 2 0 0 1 0 0 11 7 0 4 5 4 2 8 0 5 2 6 3 3 3 7 4 9 1 2 5 3 2 2 4 9 2 3 4 2 6 6 4 7 8 5 4 0 2 1 1 2 2 6 3 6 5 6 8 3 9 3 4 5 0 6 7 1 9 3 7 9 2 6 8 8 2 4 6 4 1 8 9 2 7 7 8 4 3 8 8 9 3 8 8 8 0 2 0 1 8 8 4 5 6 8 8 8 3 4 0 2 7 6 5 0 8 8 0 5 1 9 7 2 4 4 9 5 8 8 7 3 7 3 4 0 1 8 6 5 5 9 0 0 6 3 7 1 3 5 3...
output:
result:
Subtask #3:
score: 0
Wrong Answer
Test #11:
score: 0
Wrong Answer
time: 1ms
memory: 5692kb
input:
1 1 1 0 0 0 1 1 1 1 6 2 1 3 1 5
output:
8 24
result:
wrong answer 1st lines differ - expected: '18 63 0', found: '8 24 '
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 30
Accepted
time: 1ms
memory: 5724kb
input:
1 1 1 0 0 1 1 1 0 1 1 0 9 8 1 9
output:
81 99 0
result:
ok single line: '81 99 0 '
Test #17:
score: 30
Accepted
time: 1ms
memory: 7708kb
input:
0 0 1 0 0 1 1 1 0 3 7 6 2 7 7 9 5 5 6 0 5 7 5 8 1 0 6 0 9 3 3 5 1 8 2 2 1 8 5 9 1 0 0 0 4 9 1 4 3 2 5 1 9 2 2 8 7 6 8 7 3 9 1 0
output:
2402 1847 0 1687 1320 0 0 0 0 2363 1614 0 1492 955 0 0 0 0 0 0 0 0 0 0 0 0 0
result:
ok single line: '2402 1847 0 1687 1320 0 0 0 0 ... 955 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #18:
score: 30
Accepted
time: 1ms
memory: 5712kb
input:
1 0 0 0 1 0 1 0 1 6 4 6 4 1 9 6 7 6 7 5 0 7 4 1 5 7 5 7 4 7 9 7 6 3 3 8 5 4 4 0 8 8 9 2 8 3 5 9 3 1 4 1 1 5 7 7 7 5 7 4 9 8 1 0 7 9 3 8 4 8 2 9 5 3 4 0 5 3 8 2 7 8 8 7 4 8 5 2 4 2 1 0 6 1 7 0 1 2 9 8 3 5 9 9 0 1 6 3 9 7 0 1 9 8 4 4 4 3 1 4 5 4 4 6 2 2 7 2 6 5 8 5 4 5 9 7 4 1 7 1 3 2 6 3 6 0 0 5 9 6 ...
output:
322011 265965 0 260223 215956 0 0 0 0 263733 211227 0 215511 174371 0 0 0 0 0 0 0 0 0 0 0 0 0 266760 215095 0 211273 172309 0 0 0 0 214580 167887 0 173403 135852 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 253574 204516 0 204277 166421 0 0 0 0 207948 162851 0 1729...
result:
ok single line: '322011 265965 0 260223 215956 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #19:
score: 30
Accepted
time: 5ms
memory: 5796kb
input:
0 0 0 1 0 1 1 0 1 9 4 2 6 7 4 0 9 7 7 1 6 0 1 4 4 6 7 0 8 4 1 3 2 2 0 6 6 8 9 7 0 3 8 9 4 1 8 6 5 7 5 4 2 8 3 7 9 6 1 7 5 2 9 2 7 9 7 1 2 1 3 4 4 7 0 7 3 9 7 6 5 3 8 7 0 4 6 2 7 4 0 6 0 4 4 1 2 0 7 4 2 2 4 6 8 0 3 2 2 1 8 7 7 7 8 3 2 4 6 4 4 8 2 4 6 5 0 0 1 7 5 0 6 7 3 4 4 3 5 6 8 1 9 2 5 1 6 0 6 5 ...
output:
40385937 31934762 0 31782968 25077003 0 0 0 0 31023309 24888805 0 23789431 19681164 0 0 0 0 0 0 0 0 0 0 0 0 0 31987079 25546274 0 25044943 19461021 0 0 0 0 25039688 19751368 0 19460419 15885046 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 30628498 25280629 0 245971...
result:
ok single line: '40385937 31934762 0 31782968 2... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Test #20:
score: 0
Wrong Answer
time: 46ms
memory: 7948kb
input:
1 0 1 0 1 1 0 1 1 11 1 2 3 9 6 4 9 3 8 9 5 9 4 3 3 2 9 6 1 8 0 4 2 5 2 0 7 6 8 0 1 7 9 7 2 8 7 2 4 5 3 1 6 7 8 9 5 2 2 2 7 5 2 6 9 1 5 1 9 4 9 6 0 3 6 2 1 1 0 7 7 8 0 8 7 6 7 9 3 7 8 7 3 3 0 5 9 1 7 3 5 4 3 3 1 1 6 4 2 7 4 1 4 3 4 7 0 7 2 5 6 9 5 9 1 6 4 9 6 9 7 9 2 2 5 3 7 3 7 5 9 8 9 7 1 7 7 6 0 2...
output:
3330757 6904276 0 6996758 14294336 0 0 0 0 7094512 14150626 0 14703887 29236909 0 0 0 0 0 0 0 0 0 0 0 0 0 6778135 14131886 0 14023801 28519549 0 0 0 0 14162278 28291932 0 28809996 57166032 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7085904 14086903 0 14087635 278...
result:
wrong answer 1st lines differ - expected: '3330757 6904276 0 6996758 1429...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '3330757 6904276 0 6996758 1429... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '
Subtask #5:
score: 10
Accepted
Test #21:
score: 10
Accepted
time: 6ms
memory: 5832kb
input:
0 2 2 1 1 1 0 1 1 9 2 7 2 7 4 5 9 7 9 6 8 4 0 6 3 3 6 3 0 5 2 3 7 6 7 8 3 6 1 1 6 9 9 2 7 2 1 2 8 2 9 3 5 0 5 7 1 2 3 1 4 8 0 4 3 4 2 8 8 4 2 9 3 7 1 1 6 6 4 0 9 6 5 8 8 1 3 8 7 3 0 4 3 8 7 0 0 7 6 4 3 6 0 2 3 3 6 5 0 5 9 8 6 1 0 4 7 8 2 4 7 4 8 6 9 6 3 5 1 8 0 1 4 7 0 0 1 2 7 7 0 5 5 3 8 2 7 8 9 8 ...
output:
18440 36200 13740 21447 61214 26652 5665 22043 8496 29112 57852 21456 67960 192140 70368 29748 86008 35360 8912 17724 6564 29955 76168 32916 11361 32499 12720 18364 76188 36444 42131 187672 92455 14190 70759 31583 70268 162402 69612 200033 446344 181086 87111 192351 80214 28253 57785 24432 98560 188...
result:
ok single line: '18440 36200 13740 21447 61214 ...76 81555 44223 4512 28578 4596 '
Test #22:
score: 10
Accepted
time: 1ms
memory: 5664kb
input:
0 1 2 1 0 0 1 0 1 1 0 9 2 9 7 1
output:
86 101 0
result:
ok single line: '86 101 0 '
Test #23:
score: 10
Accepted
time: 1ms
memory: 5756kb
input:
2 2 0 0 0 1 0 0 1 5 7 8 3 5 6 1 5 0 1 9 7 3 0 7 0 9 4 7 2 3 1 4 9 4 6 4 9 6 9 8 9 7 8 4 1 4 1 7 7 3 9 3 6 6 8 2 4 3 4 2 4 7 9 9 7 3 0 7 2 6 8 2 3 7 3 2 5 8 9 6 8 4 2 1 1 6 8 6 2 9 8 3 8 5 2 1 8 3 1 3 9 8 7 6 2 9 3 2 1 7 4 8 3 3 8 0 4 5 1 5 2 2 7 3 1 9 4 4 7 1 7 6 5 0 6 8 9 3 3 8 8 6 5 7 6 3 6 0 0 6 ...
output:
65779 30392 21974 25288 12458 7720 24011 9803 10740 28954 12095 10240 11185 4960 3594 10287 3557 5314 24799 11548 8039 9011 4444 2949 10517 4941 3339 27387 10507 10096 12176 3831 4214 8780 3028 4385 14146 4070 5339 5293 2110 1761 4031 1015 2464 10147 3888 3541 4242 1177 1726 3898 1645 1300 24473 122...
result:
ok single line: '65779 30392 21974 25288 12458 ... 1803 912 352 590 2096 891 973 '
Test #24:
score: 10
Accepted
time: 44ms
memory: 12080kb
input:
2 1 1 0 2 2 2 1 1 8 1 1 0 0 2 9 1 0 3 7 7 3 9 2 5 0 1 4 3 3 4 3 0 1 4 5 3 4 2 7 6 3 7 6 5 1 5 6 4 0 8 3 1 3 6 2 0 2 4 7 8 6 3 1 7 0 1 3 1 2 8 9 3 3 0 4 6 0 5 6 1 0 8 9 9 4 4 8 0 7 0 8 3 1 1 1 3 0 8 4 3 8 7 2 8 5 6 4 3 7 7 9 5 8 5 2 6 0 7 5 2 1 9 7 4 8 2 0 4 2 1 0 4 0 0 6 7 1 6 4 9 2 9 1 7 1 3 0 4 3 ...
output:
20 128 104 64 304 280 72 432 351 81 437 378 242 1505 1243 297 1622 1373 81 488 403 264 1377 1218 287 1645 1350 48 276 256 432 1170 1476 288 1158 1260 396 675 1036 1344 5740 5564 1460 3940 4930 276 921 1084 1524 5298 5754 1336 4529 4886 64 376 328 336 1221 1278 304 1421 1356 360 1096 1316 1276 5976 5...
result:
ok single line: '20 128 104 64 304 280 72 432 3...1334228 322796 1305543 1304871 '
Test #25:
score: 10
Accepted
time: 266ms
memory: 36572kb
input:
2 1 0 2 2 1 0 1 0 9 3 3 3 3 9 1 1 8 2 3 3 3 1 2 7 1 3 9 9 0 8 5 3 3 3 8 9 5 3 5 9 2 2 2 2 0 2 1 9 2 2 0 6 8 6 3 2 0 6 0 0 1 8 1 5 4 7 2 7 5 5 3 1 8 2 7 4 2 4 9 3 8 5 2 5 8 5 5 5 1 3 5 7 4 2 1 9 7 5 5 5 9 4 2 8 1 7 3 1 2 6 3 6 6 1 3 8 6 8 8 8 2 3 8 0 5 3 5 1 6 3 7 9 7 4 6 3 4 8 5 4 9 4 2 7 4 4 6 4 4 ...
output:
382719 394780 410001 404799 370344 395193 369887 382774 367853 418595 409880 413992 401861 383871 399489 394754 416730 392562 379397 399755 381864 400221 387273 387760 341016 403931 377194 397060 406517 414908 381951 399267 395721 390054 411603 415746 422094 409681 417867 384646 400520 405957 415701...
result:
ok single line: '382719 394780 410001 404799 37...19 409550 390200 424778 402937 '
Subtask #6:
score: 0
Runtime Error
Dependency #5:
100%
Accepted
Test #26:
score: 0
Runtime Error
input:
0 0 1 2 0 0 2 2 2 10 4 9 8 4 7 8 0 9 7 4 8 2 1 5 5 2 0 6 4 7 5 8 5 2 4 1 9 8 2 6 4 0 1 1 3 2 4 3 6 3 1 5 2 9 6 5 3 7 0 3 6 7 8 2 6 7 6 2 5 1 9 6 3 9 7 1 5 8 3 7 9 2 8 9 6 9 8 8 2 2 0 9 7 9 9 5 4 1 3 0 7 9 9 7 8 9 8 1 9 5 0 0 6 2 3 7 1 9 8 5 8 3 9 0 1 5 3 5 9 8 7 9 1 6 6 1 8 3 2 2 4 9 0 7 9 3 0 4 0 5...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #6:
0%