QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746925#9562. 欧伊昔SunsetGlow9520 1442ms159308kbC++113.3kb2024-11-14 15:52:532024-11-14 15:52:53

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 15:52:53]
  • 评测
  • 测评结果:20
  • 用时:1442ms
  • 内存:159308kb
  • [2024-11-14 15:52:53]
  • 提交

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 = 60000000;
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;
      }
    }
  }
  R = max(R, RDX);
//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
Time Limit Exceeded

Test #6:

score: 5
Accepted
time: 0ms
memory: 7648kb

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: 1ms
memory: 7728kb

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: 0ms
memory: 7744kb

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: 246ms
memory: 36152kb

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
Time Limit Exceeded

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: 20
Accepted
time: 0ms
memory: 7724kb

input:

1 1 1
0 0 0
1 1 1
1
6 2 1
3 1 5

output:

18 63 0 

result:

ok single line: '18 63 0 '

Test #12:

score: 20
Accepted
time: 0ms
memory: 7720kb

input:

1 1 0
0 0 1
0 0 1
3
4 6 4 5 6 8 7 7 4 0 0 9 1 0 9 0 8 5 3 4 0 0 4 2 3 5 1
4 2 5 5 6 2 4 6 5 2 5 0 0 4 0 6 3 8 1 2 3 7 0 6 8 4 8

output:

1776 1049 0 1615 1167 0 0 0 0 1582 1203 0 1536 1202 0 0 0 0 0 0 0 0 0 0 0 0 0 

result:

ok single line: '1776 1049 0 1615 1167 0 0 0 0 ...1202 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #13:

score: 20
Accepted
time: 0ms
memory: 7648kb

input:

1 1 1
1 1 1
0 0 0
6
8 7 3 9 0 9 3 3 8 3 2 4 9 8 4 1 2 9 0 3 1 8 7 9 9 4 0 4 6 6 7 2 2 1 4 4 4 3 6 7 8 0 2 7 4 9 8 6 2 9 9 8 3 7 6 4 1 2 2 0 3 0 3 9 8 5 9 3 5 6 4 1 9 6 3 2 9 4 9 2 7 5 0 3 0 2 7 5 4 5 6 1 9 3 7 2 6 3 2 3 5 3 3 0 8 1 4 0 1 1 4 5 0 0 2 1 8 3 6 6 3 0 1 9 3 4 9 2 7 1 2 8 5 1 4 3 4 9 8 5 ...

output:

12752 31880 0 31880 41444 0 0 0 0 38256 76512 0 54196 117956 0 0 0 0 0 0 0 0 0 0 0 0 0 38256 76512 0 66948 143460 0 0 0 0 51008 98828 0 191280 210408 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 38256 70136 0 63760 102016 0 0 0 0 79700 111580 0 105204 219972 0 0 0 ...

result:

ok single line: '12752 31880 0 31880 41444 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #14:

score: 20
Accepted
time: 5ms
memory: 7748kb

input:

0 0 1
0 0 1
0 0 1
9
3 5 7 4 5 0 9 0 8 1 6 7 7 2 6 3 2 9 8 2 8 1 5 2 0 0 1 0 6 5 8 6 9 3 2 1 8 3 0 9 2 9 0 2 6 0 0 4 0 6 2 7 8 7 9 8 8 8 4 5 1 1 8 3 1 1 6 2 6 9 4 9 2 9 4 7 3 7 0 8 3 3 1 5 8 8 6 3 5 3 9 6 1 8 1 7 4 6 4 7 1 8 4 1 3 3 3 3 0 7 5 5 2 4 0 0 9 7 2 6 0 9 0 9 6 3 0 5 0 8 3 4 3 0 3 4 8 5 9 6 ...

output:

203913878 109813438 0 98983010 49535892 0 0 0 0 102800292 53353174 0 55217428 20418020 0 0 0 0 0 0 0 0 0 0 0 0 0 107949184 50068536 0 53708270 24324076 0 0 0 0 56549038 23791432 0 27963810 13316100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99071784 48115508 0 49...

result:

ok single line: '203913878 109813438 0 98983010... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #15:

score: 0
Wrong Answer
time: 42ms
memory: 11848kb

input:

0 0 0
0 0 0
0 0 0
11
4 2 4 1 1 1 9 6 0 9 2 5 4 0 4 7 7 3 5 4 2 4 3 7 1 2 4 6 7 0 1 1 4 4 1 2 9 3 9 5 0 1 9 8 7 8 9 0 9 8 4 2 8 8 4 2 2 0 8 7 7 9 7 8 6 8 7 7 8 1 6 2 4 3 9 3 9 9 2 7 0 7 2 3 7 5 9 5 2 1 6 3 3 0 8 4 2 8 3 7 2 5 4 9 8 4 5 1 3 7 5 1 4 3 8 8 4 3 3 6 9 5 4 8 5 1 7 1 9 0 5 7 8 0 6 5 5 2 7 9...

output:

-243691473 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

wrong answer 1st lines differ - expected: '635411468335 0 0 0 0 0 0 0 0 0...0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0', found: '-243691473 0 0 0 0 0 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 30
Accepted
time: 1ms
memory: 7652kb

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: 0ms
memory: 7668kb

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: 0ms
memory: 7740kb

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: 7808kb

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: 45ms
memory: 7680kb

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: 5ms
memory: 7732kb

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: 0ms
memory: 7776kb

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: 7724kb

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: 45ms
memory: 12036kb

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: 252ms
memory: 35592kb

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: 10
Accepted

Dependency #5:

100%
Accepted

Test #26:

score: 10
Accepted
time: 1421ms
memory: 157848kb

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:

20727578 5156335 21621423 5121038 1270467 5610621 21819960 5435312 21368600 5066732 1286635 5335177 1284793 330067 1393001 5138370 1263197 5166174 21409615 5333424 21616454 5226007 1273977 5391904 21636789 5495408 21723289 5235685 1355263 5405449 1324225 330456 1407383 5392455 1306198 5244026 134256...

result:

ok single line: '20727578 5156335 21621423 5121...4322 22029026 6092995 20320082 '

Test #27:

score: 10
Accepted
time: 155ms
memory: 22772kb

input:

2 1 2
0 2 1
0 1 1
10
0 4 5 9 6 3 7 7 7 4 6 3 1 4 6 0 0 7 7 2 2 1 9 9 0 5 0 7 3 1 2 6 2 4 0 7 1 7 3 5 2 3 2 8 2 0 9 1 7 4 6 3 5 5 2 6 2 3 0 8 4 3 7 1 3 6 6 8 5 9 0 4 9 3 2 3 6 2 8 1 6 3 7 7 7 1 3 5 2 4 6 5 3 9 9 8 6 5 0 9 6 5 1 5 1 2 2 5 1 3 3 0 7 3 8 2 7 8 8 6 4 9 9 0 6 7 5 3 9 3 5 4 4 3 1 2 2 2 9 5...

output:

43038 42855 39927 85518 135400 109061 65250 91041 77560 9437 97710 52589 28118 210304 118946 18999 157334 89213 26010 69990 46238 57184 173416 109828 40771 121147 79872 84789 68931 74358 61202 232223 146021 74817 154406 112183 79047 101039 88457 225186 271836 247023 155375 191141 172372 81601 83557 ...

result:

ok single line: '43038 42855 39927 85518 135400...1531294 778480 1570364 1176086 '

Test #28:

score: 10
Accepted
time: 159ms
memory: 23840kb

input:

0 2 1
0 2 0
0 1 0
10
6 1 3 6 1 3 2 6 3 5 4 6 7 8 2 2 9 9 6 4 7 4 1 4 4 5 5 5 7 8 5 3 0 5 8 3 5 9 6 8 7 2 7 6 1 8 1 8 5 5 1 6 4 3 3 2 9 9 6 4 4 0 2 0 7 9 2 0 7 7 8 4 3 1 4 9 5 7 4 2 9 5 7 4 8 8 0 3 7 0 9 0 2 6 1 9 4 8 1 5 6 7 0 3 5 0 9 5 0 6 1 5 4 4 9 9 6 4 1 9 3 0 0 2 8 0 5 7 0 0 8 1 8 9 3 9 4 8 1 0...

output:

197873744 77768748 78272872 81052318 31755812 32392416 81487741 33586834 33939514 78536360 31163941 30277517 31152191 12183902 12340469 30388455 12560737 12597240 76283839 32541707 32055742 30754734 11913534 11940382 29498605 11550990 11427215 81213484 32928302 32742694 31525193 12590193 12757953 30...

result:

ok single line: '197873744 77768748 78272872 81... 24378 15939 58367 32018 31619 '

Test #29:

score: 10
Accepted
time: 1442ms
memory: 159308kb

input:

2 1 1
2 0 0
1 2 0
10
3 9 8 4 5 2 4 3 6 7 0 2 7 6 3 1 7 0 9 7 2 8 6 4 8 7 3 0 2 5 3 3 5 7 8 1 0 1 3 6 7 4 7 6 6 3 9 1 0 9 3 4 2 4 4 6 1 9 1 4 7 3 3 0 0 4 9 1 1 4 1 4 6 6 9 3 6 8 1 5 9 8 5 8 7 5 3 3 8 2 3 4 8 7 1 7 1 6 2 7 5 2 6 1 6 9 3 4 9 5 9 3 3 8 8 4 8 5 7 5 4 4 9 6 0 4 2 3 3 3 2 1 9 4 7 5 4 8 3 8...

output:

1179748 1192921 1215002 1211905 1168412 1204043 1197924 1166839 1178519 1292728 1173100 1223218 1230837 1220928 1220698 1222146 1165807 1194625 1311732 1218871 1216575 1256915 1207374 1211928 1206060 1161905 1187727 1156553 1167595 1179065 1166891 1214210 1199928 1157238 1180981 1170865 1179448 1193...

result:

ok single line: '1179748 1192921 1215002 121190...203760 1147499 1174644 1198543 '

Test #30:

score: 10
Accepted
time: 148ms
memory: 23644kb

input:

0 2 1
0 0 0
0 2 2
10
7 5 1 3 6 6 3 0 7 5 4 4 5 2 1 4 9 8 5 9 7 0 9 9 5 4 5 7 3 5 6 9 1 1 0 7 4 6 4 5 6 1 6 3 5 8 3 4 5 7 3 9 4 7 6 0 4 7 7 4 8 5 7 8 8 4 5 2 9 0 4 2 8 2 5 8 3 9 3 9 1 4 2 5 2 1 4 2 7 5 9 6 0 3 9 6 2 0 0 6 8 2 7 8 9 4 3 3 3 7 8 8 6 1 4 0 7 5 7 2 9 8 1 3 4 3 1 8 2 6 8 5 4 1 1 6 7 6 5 8...

output:

196463879 38204910 117127217 38517441 7241994 23190836 114538324 22353777 69603579 40069122 7748655 23110204 8270704 1483209 4319437 23892837 4686572 13708898 119648006 23077687 70562700 23558515 4464804 13461157 70628313 13871203 42508803 38940140 7929270 24205777 7647594 1481530 4599536 23764913 4...

result:

ok single line: '196463879 38204910 117127217 3... 355914 1881370 399066 1210127 '

Subtask #7:

score: 0
Time Limit Exceeded

Dependency #6:

100%
Accepted

Test #31:

score: 20
Accepted
time: 702ms
memory: 71380kb

input:

2 0 1
0 2 0
2 0 0
11
8 7 4 3 3 2 2 8 4 7 3 2 5 0 1 5 2 9 8 6 4 6 6 4 5 2 8 0 7 2 1 3 0 8 4 7 8 6 6 5 5 0 5 3 1 0 8 3 8 2 0 4 8 1 0 2 1 7 3 3 7 9 1 0 5 2 7 4 7 6 8 9 2 4 5 9 3 8 3 6 2 4 3 6 8 7 9 1 0 7 0 5 8 5 3 1 5 9 6 8 2 6 3 6 2 5 3 6 1 9 1 3 5 0 1 8 7 3 4 1 0 7 5 2 2 7 7 1 3 9 7 8 5 4 6 7 3 1 0 0...

output:

985177950 197617374 590134862 198859485 39857044 118341573 591604462 119095453 354362936 197704625 39189734 118342480 39860423 7939740 23797318 118965644 23756253 70912290 591036105 118483662 354251518 118859385 23668766 71147297 355216746 71729751 212686586 196972402 39401015 117591721 39873134 806...

result:

ok single line: '985177950 197617374 590134862 ...225979 6274983 1240166 3667256 '

Test #32:

score: 20
Accepted
time: 692ms
memory: 72132kb

input:

0 0 1
1 1 1
1 0 2
11
1 0 2 6 5 3 0 0 0 2 2 0 1 9 3 2 2 4 7 1 5 4 9 3 0 3 5 4 0 9 0 4 6 1 7 0 9 6 7 2 3 3 4 1 5 1 8 7 5 1 0 9 3 8 2 5 8 2 9 7 0 0 7 5 2 6 1 0 5 7 1 2 3 3 9 8 0 0 2 7 3 6 6 1 1 7 9 5 4 0 1 3 1 6 7 6 4 5 3 8 4 2 9 7 9 9 8 9 5 2 9 4 9 7 8 3 3 2 0 9 6 6 1 2 6 2 3 8 7 9 1 8 0 8 7 2 0 7 2 8...

output:

3581462 5754641 1220642 5965897 10041685 1963115 1135917 1958584 411826 5747573 9494203 1888247 9892895 16813091 3226382 1997008 3315163 608774 1129634 1904230 390109 1968200 3302182 628108 414989 648851 117823 5956138 9704332 2139194 9725123 15932059 3386644 1960155 3188808 668719 9822510 16463138 ...

result:

ok single line: '3581462 5754641 1220642 596589...45 233 24 328 583 120 47 42 16 '

Test #33:

score: 0
Time Limit Exceeded

input:

0 0 2
1 1 0
1 0 1
11
3 0 4 3 8 8 9 5 9 5 4 7 5 9 3 1 2 9 7 4 4 2 0 2 9 3 0 1 5 7 6 2 8 3 1 1 1 2 6 4 0 3 5 0 1 9 0 2 0 5 9 5 0 3 8 1 4 2 9 6 2 7 6 5 4 9 6 7 8 0 2 2 0 5 9 6 9 1 0 6 2 5 6 6 2 1 4 8 2 7 7 7 1 5 1 0 7 6 5 6 9 7 7 8 0 5 0 3 8 5 6 3 4 5 0 0 0 0 7 2 8 9 5 5 2 4 3 6 4 3 5 1 6 1 0 6 0 3 6 4...

output:


result: