QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#313923#7648. 网格图最大流计数alpha102245 715ms23732kbC++149.3kb2024-01-25 10:08:422024-01-25 10:08:42

Judging History

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

  • [2024-01-25 10:08:42]
  • 评测
  • 测评结果:45
  • 用时:715ms
  • 内存:23732kb
  • [2024-01-25 10:08:42]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const int mod = 1e9 + 7;

int neg(int x) { return x ? mod - x : 0; }
int quo2(int x) { return (x + (x & 1 ? mod : 0)) >> 1; }
void add(int &x, int y) { if ((x += y - mod) < 0) x += mod; }
void sub(int &x, int y) { if ((x -= y) < 0) x += mod; }
int mpow(int a, int b) {
  int ret = 1;
  for (; b; b >>= 1) {
    if (b & 1) ret = (ll)ret * a % mod;
    a = (ll)a * a % mod;
  }
  return ret;
}

namespace Matrix {
 
  const int N = 804;
 
  template<class T>
  vector<int> charPoly(int n, T mat) {
    static int a[N + 5][N + 5], poly[N + 5][N + 5];
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = neg(mat[i][j]);
    for (int i = 1; i < n; ++i) {
      int pivot = i + 1;
      for (; pivot <= n && !a[pivot][i]; ++pivot);
      if (pivot > n) continue;
      if (pivot > i + 1) {
        for (int j = i; j <= n; ++j) swap(a[i + 1][j], a[pivot][j]);
        for (int j = 1; j <= n; ++j) swap(a[j][i + 1], a[j][pivot]);
      }
      int nv = mpow(a[i + 1][i], mod - 2);
      for (int j = i + 2; j <= n; ++j)
        if (a[j][i]) {
          int t = (ll)a[j][i] * nv % mod;
          for (int k = i; k <= n; ++k) a[j][k] = (a[j][k] + (ll)(mod - t) * a[i + 1][k]) % mod;
          for (int k = 1; k <= n; ++k) a[k][i + 1] = (a[k][i + 1] + (ll)t * a[k][j]) % mod;
        }
    }
    poly[n + 1][0] = 1;
    for (int i = n; i; --i) {
      poly[i][0] = 0;
      for (int j = 1; j <= n + 1 - i; ++j) poly[i][j] = poly[i + 1][j - 1];
      for (int j = i, t = 1; j <= n && t; t = (ll)t * a[j + 1][j] % mod, ++j) {
        int coe = (ll)t * a[i][j] % mod;
        if (!coe) continue;
        if ((i ^ j) & 1) coe = mod - coe;
        for (int k = 0; k <= n - j; ++k) poly[i][k] = (poly[i][k] + (ll)poly[j + 1][k] * coe) % mod;
      }
    }
    return vector<int>(poly[1], poly[1] + n + 1);
  }
 
  template<class T>
  int det(int n, T mat) {
    static int a[N + 5][N + 5];
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = mat[i][j];
    int ret = 1;
    for (int i = 1; i <= n; ++i) {
      int pivot = i;
      for (; pivot <= n && !a[pivot][i]; ++pivot);
      if (pivot > n) return 0;
      if (pivot > i) {
        ret = mod - ret;
        for (int j = i; j <= n; ++j) swap(a[i][j], a[pivot][j]);
      }
      int nv = mpow(a[i][i], mod - 2);
      for (int j = i + 1; j <= n; ++j)
        if (a[j][i]) {
          int t = (ll)a[j][i] * nv % mod;
          for (int k = i; k <= n; ++k) a[j][k] = (a[j][k] + (ll)(mod - t) * a[i][k]) % mod;
        }
    }
    for (int i = 1; i <= n; ++i) ret = (ll)ret * a[i][i] % mod;
    return ret;
  }
 
  template<class T>
  vector<int> det(int n, T matA, T matB) {
    static int a[N + 5][N + 5], b[N + 5][N + 5];
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = matA[i][j], b[i][j] = matB[i][j];
    int offset = 0, coe = 1;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j < i; ++j)
        if (b[j][i]) {
          int t = mod - b[j][i];
          for (int k = 1; k <= n; ++k)
            a[k][i] = (a[k][i] + (ll)a[k][j] * t) % mod,
            b[k][i] = (b[k][i] + (ll)b[k][j] * t) % mod;
        }
      int pivot = i;
      for (; pivot <= n && !b[pivot][i]; ++pivot);
      if (pivot > n) {
        ++offset;
        for (int j = 1; j <= n; ++j) b[j][i] = a[j][i], a[j][i] = 0;
        for (int j = 1; j < i; ++j) 
          if (b[j][i]) {
            int t = mod - b[j][i];
            for (int k = 1; k <= n; ++k)
              a[k][i] = (a[k][i] + (ll)a[k][j] * t) % mod,
              b[k][i] = (b[k][i] + (ll)b[k][j] * t) % mod;
          }
        pivot = i;
        for (; pivot <= n && !b[pivot][i]; ++pivot);
        if (pivot > n) return vector<int>(n + 1, 0);
      }
      if (pivot > i) {
        coe = mod - coe;
        for (int j = 1; j <= n; ++j)
          swap(a[i][j], a[pivot][j]), swap(b[i][j], b[pivot][j]);
      }
      int nv = mpow(b[i][i], mod - 2); coe = (ll)coe * b[i][i] % mod;
      for (int j = 1; j <= n; ++j)
        a[i][j] = (ll)a[i][j] * nv % mod, b[i][j] = (ll)b[i][j] * nv % mod;
      for (int j = i + 1; j <= n; ++j)
        if (b[j][i]) {
          int t = mod - b[j][i];
          for (int k = 1; k <= n; ++k)
            a[j][k] = (a[j][k] + (ll)a[i][k] * t) % mod,
            b[j][k] = (b[j][k] + (ll)b[i][k] * t) % mod;
        }
    }
    for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[i][j] = neg(a[i][j]), assert(b[i][j] == (i == j));
    auto res = charPoly(n, a);
    vector<int> ret(n - offset + 1);
    for (int i = 0; i <= n - offset; ++i)
      ret[i] = (ll)coe * res[i + offset] % mod;
    ret.resize(n + 1);
    return ret;
  }

  template<class T>
  vector<int> det(int n, T mat[3]) {
    static int a[3][N + 5][N + 5], b[N + 5][N + 5];
    for (int e = 0; e < 3; ++e)
      for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) a[e][i][j] = mat[e][i][j];
    int offset = 0, coe = 1;
    for (int i = 1; i <= n; ++i) {
      int pivot = n + 1;
      for (int rep = 0; pivot > n && rep < 3; ++rep) {
        for (int j = 1; j < i; ++j)
          if (a[2][j][i]) {
            int t = mod - a[2][j][i];
            for (int e = 0; e < 3; ++e)
              for (int k = 1; k <= n; ++k)
                if (a[e][k][j])
                  a[e][k][i] = (a[e][k][i] + (ll)a[e][k][j] * t) % mod;
          }
        for (pivot = i; pivot <= n && !a[2][pivot][i]; ++pivot);
        if (pivot > n && rep < 2) {
          ++offset;
          for (int j = 1; j <= n; ++j) a[2][j][i] = a[1][j][i], a[1][j][i] = a[0][j][i], a[0][j][i] = 0;
        }
      }
      if (pivot > n) return vector<int>(n * 2 + 1, 0);
      if (pivot > i) {
        coe = mod - coe;
        for (int e = 0; e < 3; ++e)
          for (int j = 1; j <= n; ++j) swap(a[e][i][j], a[e][pivot][j]);
      }
      int nv = mpow(a[2][i][i], mod - 2); coe = (ll)coe * a[2][i][i] % mod;
      for (int e = 0; e < 3; ++e)
        for (int j = 1; j <= n; ++j)
          if (a[e][i][j]) a[e][i][j] = (ll)a[e][i][j] * nv % mod;
      for (int j = i + 1; j <= n; ++j)
        if (a[2][j][i]) {
          int t = mod - a[2][j][i];
          for (int e = 0; e < 3; ++e)
            for (int k = 1; k <= n; ++k)
              if (a[e][i][k]) a[e][j][k] = (a[e][j][k] + (ll)a[e][i][k] * t) % mod;
        }
    }
    for (int i = 1; i <= n; ++i) b[i][n + i] = 1;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= n; ++j)
        b[n + i][j] = neg(a[0][i][j]), b[n + i][n + j] = neg(a[1][i][j]);
    auto res = charPoly(n * 2, b);
    vector<int> ret(n * 2 - offset + 1);
    for (int i = 0; i < ret.size(); ++i) ret[i] = (ll)coe * res[i + offset] % mod;
    ret.resize(n * 2 + 1);
    return ret;
  }
 
}

using Matrix::det;

const int N = 402;

int n, m, k;
int a[N + 5], b[N + 5];
int s[N + 5][N + 5], pre[N + 5][N + 5];
int f[2][N + 5][N + 5], g[N + 5][N + 5];
int mat[3][N + 5][N + 5], len;
int ans[N + 5];

int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  for (int i = 1; i <= m; ++i) scanf("%d", b + i);
  for (int i = 1; i <= k; ++i)
    for (int j = 1; j <= k; ++j) {
      scanf("%1d", s[i] + j);
      if (!s[i][j]) pre[i][j] = j;
      else pre[i][j] = pre[i][j - 1];
    }
  for (int i = 1; i < m; ++i)
    for (int j = i + 1; j <= m; ++j) {
      int x0 = pre[k][b[i]], x1 = max(b[i], pre[k][b[j]]);
      add(f[k & 1][b[i]][b[j]], 1),
      sub(f[k & 1][b[i]][x1], 1),
      sub(f[k & 1][x0][b[j]], 1),
      add(f[k & 1][x0][x1], 1);
    }
  for (int i = k; i; --i)
    for (int j = k; j; --j)
      add(f[k & 1][i][j], f[k & 1][i + 1][j]),
      add(f[k & 1][i][j], f[k & 1][i][j + 1]),
      sub(f[k & 1][i][j], f[k & 1][i + 1][j + 1]);
  for (int r = k - 1; r; --r) {
    memset(f[r & 1], 0, sizeof f[r & 1]);
    for (int i = 1; i < k; ++i)
      for (int j = i + 1, v; j <= k; ++j)
        if ((v = f[~r & 1][i][j]) && s[r][i] && s[r][j]) {
          int x0 = pre[r][i], x1 = max(i, pre[r][j]);
          add(f[r & 1][i][j], v),
          sub(f[r & 1][i][x1], v),
          sub(f[r & 1][x0][j], v),
          add(f[r & 1][x0][x1], v);
        }
    for (int i = k; i; --i)
      for (int j = k; j; --j)
        add(f[r & 1][i][j], f[r & 1][i + 1][j]),
        add(f[r & 1][i][j], f[r & 1][i][j + 1]),
        sub(f[r & 1][i][j], f[r & 1][i + 1][j + 1]);
  }
  for (int i = 1; i <= m; ++i) g[k][b[i]] = 1;
  for (int i = k; i; --i)
    for (int j = k; j; --j)
      if (s[i][j])
        add(g[i][j], g[i][j + 1]), add(g[i][j], g[i + 1][j]);
  len = n + 1 + (~n & 1);
  for (int i = 1; i < len; ++i)
    for (int j = i + 1; j <= len; ++j)
      mat[0][i][j] = ~(i ^ j) & 1 ? mod - 1 : 1;
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n; ++j)
      mat[2][i][j] = f[1][a[i]][a[j]];
  for (int i = 1; i <= n; ++i) mat[1][i][n + 1] = g[1][a[i]];
  for (int e = 0; e < 3; ++e)
    for (int i = 1; i < len; ++i)
      for (int j = i + 1; j <= len; ++j)
        mat[e][j][i] = neg(mat[e][i][j]);
  auto res = det(len, mat);
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    ans[i] = res[i];
    for (int j = 1; j < i; ++j) ans[i] = (ans[i] + (ll)(mod - ans[j]) * ans[i - j]) % mod;
    ans[i] = quo2(ans[i]);
  }
  for (int i = n; i >= 0; --i)
    if (ans[i]) { printf("%d %d\n", i, ans[i]); break; }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #2:

score: 0
Accepted
time: 0ms
memory: 17312kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 19448kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1111111
1111111

output:

7 1

result:

ok 2 number(s): "7 1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 20196kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1110111
1111111

output:

6 52

result:

ok 2 number(s): "6 52"

Test #5:

score: 0
Accepted
time: 3ms
memory: 20248kb

input:

7 7 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1111111
1111111
1111111
1111111
1111111
1110111
1111111

output:

6 52

result:

ok 2 number(s): "6 52"

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #6:

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

input:

16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111011111111111111
111111111111111111
111111111111111111
111011110111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
1...

output:

14 328354990

result:

ok 2 number(s): "14 328354990"

Test #7:

score: 0
Accepted
time: 0ms
memory: 21576kb

input:

17 16 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111101111111111
111111111111111111
111111111111011111
...

output:

15 449998848

result:

ok 2 number(s): "15 449998848"

Test #8:

score: 0
Accepted
time: 0ms
memory: 21468kb

input:

16 18 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
111111111111110111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111110111111
111111111111111111
11111111111111111...

output:

15 844316215

result:

ok 2 number(s): "15 844316215"

Test #9:

score: 0
Accepted
time: 3ms
memory: 17368kb

input:

16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
111111111111111111
111111111111111111
111011111111110111
111111111111111111
111111111111111111
111011111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
1...

output:

15 133840

result:

ok 2 number(s): "15 133840"

Test #10:

score: 0
Accepted
time: 0ms
memory: 18592kb

input:

18 18 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111111111111
111111111011111111
111111111111111111
111101111111111111
111111111111111111
11111111111...

output:

16 27330297

result:

ok 2 number(s): "16 27330297"

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #11:

score: 10
Accepted
time: 273ms
memory: 19020kb

input:

10 377 400
1 2 3 4 5 6 7 8 9 10
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 ...

output:

10 843273461

result:

ok 2 number(s): "10 843273461"

Test #12:

score: 0
Accepted
time: 275ms
memory: 18792kb

input:

10 367 400
1 2 3 4 5 6 7 8 9 10
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104...

output:

10 273577493

result:

ok 2 number(s): "10 273577493"

Test #13:

score: -10
Wrong Answer
time: 269ms
memory: 18044kb

input:

10 350 400
1 2 3 4 5 6 7 8 9 10
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 11...

output:

9 664271420

result:

wrong answer 2nd numbers differ - expected: '605707862', found: '664271420'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 10
Accepted

Test #31:

score: 10
Accepted
time: 230ms
memory: 19884kb

input:

73 73 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 ...

output:

73 849796347

result:

ok 2 number(s): "73 849796347"

Test #32:

score: 0
Accepted
time: 228ms
memory: 20996kb

input:

68 68 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...

output:

68 334069950

result:

ok 2 number(s): "68 334069950"

Test #33:

score: 0
Accepted
time: 230ms
memory: 19108kb

input:

72 72 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133...

output:

72 180096245

result:

ok 2 number(s): "72 180096245"

Test #34:

score: 0
Accepted
time: 221ms
memory: 20948kb

input:

71 71 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 13...

output:

71 234343448

result:

ok 2 number(s): "71 234343448"

Test #35:

score: 0
Accepted
time: 230ms
memory: 18664kb

input:

68 68 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152...

output:

68 371509898

result:

ok 2 number(s): "68 371509898"

Test #36:

score: 0
Accepted
time: 354ms
memory: 22048kb

input:

200 200 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

200 852372194

result:

ok 2 number(s): "200 852372194"

Test #37:

score: 0
Accepted
time: 415ms
memory: 23356kb

input:

230 230 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

230 65874836

result:

ok 2 number(s): "230 65874836"

Test #38:

score: 0
Accepted
time: 486ms
memory: 22144kb

input:

260 260 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

260 272563656

result:

ok 2 number(s): "260 272563656"

Test #39:

score: 0
Accepted
time: 583ms
memory: 23552kb

input:

290 290 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

290 95450701

result:

ok 2 number(s): "290 95450701"

Test #40:

score: 0
Accepted
time: 715ms
memory: 22600kb

input:

320 320 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

320 266455174

result:

ok 2 number(s): "320 266455174"

Subtask #6:

score: 25
Accepted

Dependency #5:

100%
Accepted

Test #41:

score: 25
Accepted
time: 309ms
memory: 22180kb

input:

107 371 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

107 3979643

result:

ok 2 number(s): "107 3979643"

Test #42:

score: 0
Accepted
time: 301ms
memory: 19728kb

input:

101 351 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 372994325

result:

ok 2 number(s): "101 372994325"

Test #43:

score: 0
Accepted
time: 301ms
memory: 21048kb

input:

101 369 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 46156842

result:

ok 2 number(s): "101 46156842"

Test #44:

score: 0
Accepted
time: 298ms
memory: 19612kb

input:

101 386 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

101 634357614

result:

ok 2 number(s): "101 634357614"

Test #45:

score: 0
Accepted
time: 307ms
memory: 21416kb

input:

109 388 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

109 24613754

result:

ok 2 number(s): "109 24613754"

Test #46:

score: 0
Accepted
time: 397ms
memory: 23420kb

input:

200 399 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

200 342259639

result:

ok 2 number(s): "200 342259639"

Test #47:

score: 0
Accepted
time: 444ms
memory: 23732kb

input:

230 393 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

230 596706635

result:

ok 2 number(s): "230 596706635"

Test #48:

score: 0
Accepted
time: 514ms
memory: 22484kb

input:

260 393 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

260 569883617

result:

ok 2 number(s): "260 569883617"

Test #49:

score: 0
Accepted
time: 591ms
memory: 23684kb

input:

290 395 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

290 473037952

result:

ok 2 number(s): "290 473037952"

Test #50:

score: 0
Accepted
time: 714ms
memory: 22520kb

input:

320 397 400
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

320 375576485

result:

ok 2 number(s): "320 375576485"

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%