QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#120147#6193. Junk Problemhos_lyricAC ✓79ms3808kbC++147.6kb2023-07-06 14:14:552023-07-06 14:14:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-06 14:14:57]
  • 评测
  • 测评结果:AC
  • 用时:79ms
  • 内存:3808kb
  • [2023-07-06 14:14:55]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }


////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 998244353;
using Mint = ModInt<MO>;

constexpr int LIM_INV = 1010;
Mint inv[LIM_INV], fac[LIM_INV], invFac[LIM_INV];

void prepare() {
  inv[1] = 1;
  for (int i = 2; i < LIM_INV; ++i) {
    inv[i] = -((Mint::M / i) * inv[Mint::M % i]);
  }
  fac[0] = invFac[0] = 1;
  for (int i = 1; i < LIM_INV; ++i) {
    fac[i] = fac[i - 1] * i;
    invFac[i] = invFac[i - 1] * inv[i];
  }
}
Mint binom(Int n, Int k) {
  if (n < 0) {
    if (k >= 0) {
      return ((k & 1) ? -1 : +1) * binom(-n + k - 1, k);
    } else if (n - k >= 0) {
      return (((n - k) & 1) ? -1 : +1) * binom(-k - 1, n - k);
    } else {
      return 0;
    }
  } else {
    if (0 <= k && k <= n) {
      assert(n < LIM_INV);
      return fac[n] * invFac[k] * invFac[n - k];
    } else {
      return 0;
    }
  }
}

Mint interpolateIota(const vector<Mint> &fs, Mint x) {
  const int fsLen = fs.size();
  vector<Mint> prodR(fsLen + 1);
  prodR[fsLen] = 1;
  for (int i = fsLen; --i >= 0; ) prodR[i] = (x - i) * prodR[i + 1];
  Mint ans = 0;
  Mint prodL = 1;
  for (int i = 0; i < fsLen; ++i) {
    // (i - 0) ... (i - (i - 1)) (i - (i + 1)) ... (i - (fsLen - 1))
    ans += invFac[i] * (((fsLen - 1 - i) & 1) ? -1 : +1) *
           invFac[fsLen - 1 - i] * fs[i] * prodL * prodR[i + 1];
    prodL *= (x - i);
  }
  return ans;
}

Mint det(vector<vector<Mint>> a) {
  const int n = a.size();
  Mint ret = 1;
  for (int h = 0; h < n; ++h) {
    for (int i = h; i < n; ++i) if (a[i][h]) {
      if (h != i) {
        swap(a[h], a[i]);
        ret = -ret;
      }
      break;
    }
    ret *= a[h][h];
    if (!ret) break;
    const Mint s = a[h][h].inv();
    for (int j = h + 1; j < n; ++j) a[h][j] *= s;
    for (int i = h + 1; i < n; ++i) {
      const Mint t = a[i][h];
      if (t) for (int j = h + 1; j < n; ++j) a[i][j] -= t * a[h][j];
    }
  }
  return ret;
}


/*
  Talaska
  bidirectional edge: q, q
  matrix: GF of # of paths
  det = (disjoint flow) / (disjoint cycles)
  disjoint cycles = (1-q^2)^K
  disjoint flow: (disjoint paths) * (1-q^2)^(untouched cycles)
*/

int M, N, L, K;
vector<int> A, B;
vector<int> X, Y;

bool spe[110][110];
Mint dp[110][110];

int main() {
  prepare();
  
  for (; ~scanf("%d%d%d%d", &M, &N, &L, &K); ) {
    A.resize(L); for (int i = 0; i < L; ++i) scanf("%d", &A[i]);
    B.resize(L); for (int i = 0; i < L; ++i) scanf("%d", &B[i]);
    X.resize(K);
    Y.resize(K);
    for (int k = 0; k < K; ++k) {
      scanf("%d%d", &X[k], &Y[k]);
    }
    
    memset(spe, 0, sizeof(spe));
    for (int k = 0; k < K; ++k) {
      spe[X[k]][Y[k]    ] = true;
      spe[X[k]][Y[k] + 1] = true;
    }
    
    vector<Mint> fs(2 * K + 1);
    for (int q = 2; q <= 2 + 2 * K; ++q) {
      const Mint cycle = Mint(1 - q * q).inv();
// const Mint cycle=100;
      vector<vector<Mint>> a(L, vector<Mint>(L, 0));
      for (int i = 0; i < L; ++i) {
        memset(dp, 0, sizeof(dp));
        dp[1][A[i]] = 1;
        for (int x = 1; x <= M; ++x) {
          for (int y = 1; y <= N; ) {
            if (spe[x][y]) {
              const Mint f0 = dp[x][y];
              const Mint f1 = dp[x][y + 1];
              dp[x][y    ] = (f0 + f1 * q) * cycle;
              dp[x][y + 1] = (f1 + f0 * q) * cycle;
              dp[x][y + 2] += dp[x][y + 1];
              y += 2;
            } else {
              dp[x][y + 1] += dp[x][y];
              y += 1;
            }
          }
          for (int y = 1; y <= N; ++y) {
            dp[x + 1][y] += dp[x][y];
          }
        }
        for (int j = 0; j < L; ++j) {
          a[i][j] += dp[M][B[j]];
        }
// if(M<=3){cerr<<"q = "<<q<<", i = "<<i<<", dp = "<<endl;for(int x=1;x<=M;++x)pv(dp[x]+1,dp[x]+N+1);}
      }
// cerr<<"q = "<<q<<": a = "<<a<<", det(a) = "<<det(a)<<endl;
      fs[q - 2] = Mint(1 - q * q).pow(K) * det(a);
    }
// cerr<<"fs = "<<fs<<endl;
    
    // q = 1
    const Mint ans = interpolateIota(fs, 1 - 2);
    printf("%u\n", ans.x);
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3720kb

input:

2 2 1 2
2
1
1 1
2 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

3 4 2 1
1 4
1 4
2 2

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

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

output:

388035318

result:

ok 1 number(s): "388035318"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3648kb

input:

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

output:

534075044

result:

ok 1 number(s): "534075044"

Test #5:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

10 10 5 10
1 2 3 6 9
6 7 8 9 10
5 7
1 7
8 8
8 1
9 2
9 7
10 1
7 2
6 7
6 1

output:

113105350

result:

ok 1 number(s): "113105350"

Test #6:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

10 10 5 20
1 2 4 6 8
1 3 4 6 8
9 6
6 5
9 8
2 9
7 6
9 3
8 3
5 4
3 8
4 5
5 9
3 3
4 2
4 8
8 5
10 7
1 8
7 3
5 2
1 5

output:

312012

result:

ok 1 number(s): "312012"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

10 10 5 30
1 3 5 6 8
6 7 8 9 10
9 9
8 7
4 8
10 6
3 9
9 6
7 1
1 5
5 4
2 9
7 5
3 3
8 2
2 5
1 9
6 2
8 5
6 5
8 9
3 7
3 1
10 2
4 3
2 2
6 9
7 3
7 8
1 7
4 1
4 6

output:

720108525

result:

ok 1 number(s): "720108525"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

10 10 1 0
1
3

output:

55

result:

ok 1 number(s): "55"

Test #9:

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

input:

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

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

10 10 3 20
3 4 5
4 6 9
2 3
3 2
1 9
7 5
10 7
6 9
3 4
5 1
1 6
5 6
8 4
10 1
5 3
7 7
4 7
9 6
10 5
3 6
5 8
8 8

output:

0

result:

ok 1 number(s): "0"

Test #11:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

10 10 4 30
1 2 3 4
5 6 7 9
10 1
8 1
1 2
5 7
2 3
10 8
7 9
5 3
6 2
9 9
9 1
2 7
10 4
4 4
4 8
7 7
6 7
7 1
4 2
5 1
9 6
9 3
2 9
3 9
3 7
3 5
7 4
1 4
1 9
8 5

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 1ms
memory: 3768kb

input:

10 10 6 30
3 4 5 6 7 8
5 6 7 8 9 10
3 4
10 8
9 6
6 5
6 9
1 9
2 4
10 6
7 4
7 6
6 7
3 8
7 2
5 5
1 1
2 1
8 1
4 3
8 6
5 9
2 6
8 4
1 7
5 2
3 2
1 4
2 8
8 9
6 1
4 5

output:

0

result:

ok 1 number(s): "0"

Test #13:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

10 10 7 30
1 2 3 4 5 9 10
2 3 4 7 8 9 10
9 3
10 4
2 3
2 8
5 3
2 6
1 4
7 1
6 4
3 5
6 9
10 2
4 6
5 6
7 6
4 3
8 7
6 6
9 5
8 4
7 4
1 8
5 8
3 7
9 8
7 8
8 1
3 3
10 6
8 9

output:

58415340

result:

ok 1 number(s): "58415340"

Test #14:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

10 10 4 20
1 2 5 7
5 7 8 10
10 3
3 2
10 6
9 7
9 4
1 4
8 6
6 3
7 5
3 8
2 3
4 6
6 8
7 8
3 6
8 8
6 6
4 2
4 9
1 1

output:

212921229

result:

ok 1 number(s): "212921229"

Test #15:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

10 10 6 20
1 2 4 7 8 9
3 4 5 8 9 10
3 5
6 5
4 5
6 1
1 8
8 8
2 5
4 9
6 3
4 2
4 7
5 2
9 7
3 8
2 2
9 4
7 6
1 4
8 5
2 7

output:

215578944

result:

ok 1 number(s): "215578944"

Test #16:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

100 10 6 20
1 2 3 4 6 7
2 4 5 6 7 9
17 6
46 9
76 2
75 4
27 6
22 4
5 1
33 7
78 1
38 7
83 9
32 5
97 3
25 8
90 3
50 7
87 1
61 3
39 1
28 9

output:

266132935

result:

ok 1 number(s): "266132935"

Test #17:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

100 10 5 20
1 2 3 4 5
2 5 6 8 9
73 2
56 8
57 9
60 3
5 8
74 3
92 2
72 9
17 4
61 8
41 7
88 8
91 4
52 7
50 4
94 9
64 7
27 6
14 7
4 2

output:

558957370

result:

ok 1 number(s): "558957370"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

100 10 3 20
6 7 9
6 9 10
90 4
72 2
19 1
19 9
64 3
85 3
66 7
66 5
19 6
84 5
16 1
55 6
74 4
31 3
73 4
52 2
32 9
87 2
4 8
70 2

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 2ms
memory: 3716kb

input:

100 10 4 30
2 5 6 7
2 6 8 9
52 1
26 6
39 8
44 9
38 5
11 9
47 3
46 5
42 9
14 2
65 7
68 5
44 1
20 2
42 7
12 4
6 8
73 5
87 2
17 2
28 8
100 4
25 1
3 1
8 2
12 6
36 3
3 3
86 1
95 7

output:

803776201

result:

ok 1 number(s): "803776201"

Test #20:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

100 10 5 50
1 2 3 4 5
2 3 8 9 10
8 1
45 7
69 9
85 6
51 8
40 2
85 4
67 7
65 3
28 7
98 7
94 3
47 5
50 3
44 3
76 8
50 9
48 7
81 9
16 4
70 5
22 3
80 3
22 6
33 3
57 2
4 5
6 5
18 9
74 5
11 5
14 2
3 4
3 1
68 4
37 5
93 7
42 8
78 6
71 2
27 7
57 7
96 6
69 1
30 2
9 6
39 8
54 8
2 3
78 4

output:

463426103

result:

ok 1 number(s): "463426103"

Test #21:

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

input:

100 10 6 50
3 4 5 6 8 9
5 6 7 8 9 10
56 1
39 8
84 6
4 4
66 6
88 8
95 8
24 9
78 2
54 5
85 1
3 4
81 5
36 6
69 9
47 1
60 2
26 9
68 9
8 3
13 2
31 3
25 2
72 3
88 3
81 9
97 1
67 1
90 4
86 6
74 8
56 7
50 6
94 5
67 5
49 3
42 7
42 5
53 7
87 1
80 3
12 6
96 6
58 7
15 9
46 7
89 3
17 6
71 6
6 5

output:

123434985

result:

ok 1 number(s): "123434985"

Test #22:

score: 0
Accepted
time: 2ms
memory: 3708kb

input:

10 100 3 50
14 20 52
44 57 68
1 24
8 43
2 26
6 57
5 56
3 85
2 3
10 80
4 18
9 30
6 6
5 3
4 91
5 50
9 37
4 66
10 10
9 7
7 15
7 46
4 15
2 68
9 50
8 39
5 5
8 64
9 4
5 79
8 59
9 19
10 23
7 19
8 6
5 38
8 92
6 93
5 94
1 21
6 85
5 71
4 60
9 23
3 61
2 76
4 21
8 82
6 99
9 55
3 96
9 64

output:

0

result:

ok 1 number(s): "0"

Test #23:

score: 0
Accepted
time: 2ms
memory: 3648kb

input:

10 100 5 50
12 14 45 50 54
20 24 68 80 88
5 37
10 43
5 86
1 18
6 40
2 83
8 64
6 97
4 31
2 59
3 63
6 17
1 57
5 92
4 9
3 96
9 88
6 71
8 93
10 32
2 32
2 3
6 60
5 57
8 86
4 23
4 40
7 84
10 51
8 83
5 10
8 75
5 44
7 43
1 65
10 20
1 15
3 71
1 30
2 98
8 14
1 92
5 69
10 53
8 48
4 43
3 92
6 74
5 41
3 67

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

10 100 7 50
11 13 21 32 35 67 89
41 56 70 75 90 91 92
3 49
8 39
5 39
1 66
7 15
5 73
8 22
6 24
7 40
1 87
6 28
6 30
3 14
9 40
2 77
5 24
1 63
7 29
6 73
4 19
8 63
10 88
6 56
7 70
7 79
4 56
3 96
2 79
5 85
3 39
7 35
3 35
6 87
1 48
10 38
1 42
3 53
4 60
1 12
9 94
9 4
8 50
9 62
10 60
4 50
7 23
3 81
4 98
2 57...

output:

0

result:

ok 1 number(s): "0"

Test #25:

score: 0
Accepted
time: 13ms
memory: 3772kb

input:

100 100 10 50
4 11 20 24 33 37 38 57 60 71
42 47 48 62 68 80 84 87 91 95
28 22
49 40
89 44
72 33
66 29
99 80
38 92
18 80
36 73
63 26
65 31
48 52
84 6
34 95
37 80
3 94
23 40
37 84
42 75
33 49
97 13
37 19
57 92
78 5
92 89
82 49
23 36
95 85
64 23
86 88
97 51
50 55
51 53
66 67
100 95
54 39
50 34
23 32
9...

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 30ms
memory: 3768kb

input:

100 100 20 50
1 2 9 11 12 15 17 18 20 22 25 34 45 52 56 59 67 71 78 83
23 25 29 35 37 38 53 61 67 68 69 77 80 81 82 85 87 91 95 96
100 15
13 38
42 54
11 31
28 31
14 56
17 5
51 46
59 40
5 72
24 41
100 77
42 70
81 96
3 27
60 9
21 36
40 90
99 51
59 57
51 63
96 29
6 17
23 41
3 45
5 4
84 22
21 63
19 6
59...

output:

0

result:

ok 1 number(s): "0"

Test #27:

score: 0
Accepted
time: 46ms
memory: 3808kb

input:

100 100 30 50
6 9 10 11 14 16 17 18 19 20 21 22 24 25 26 28 30 31 32 39 48 51 58 63 64 65 67 73 78 82
33 34 38 40 42 50 52 53 54 56 60 62 64 68 70 71 74 80 81 84 86 87 88 89 90 95 97 98 99 100
77 7
74 44
83 60
58 21
91 40
30 37
97 9
84 19
78 11
46 23
90 54
40 94
3 46
24 93
65 73
16 34
24 36
40 88
57...

output:

0

result:

ok 1 number(s): "0"

Test #28:

score: 0
Accepted
time: 62ms
memory: 3728kb

input:

100 100 40 50
1 2 3 4 5 6 8 9 10 11 12 13 14 15 16 17 22 26 27 30 33 34 37 38 39 44 45 50 53 54 56 57 62 63 65 66 67 71 77 78
16 19 20 32 33 35 39 41 47 48 52 53 56 61 62 64 65 66 69 70 72 74 75 76 77 78 81 82 83 84 86 87 88 89 90 96 97 98 99 100
57 4
43 42
36 70
93 11
49 46
41 17
76 14
4 92
92 88
7...

output:

696316238

result:

ok 1 number(s): "696316238"

Test #29:

score: 0
Accepted
time: 79ms
memory: 3732kb

input:

100 100 50 50
4 5 6 7 9 10 11 12 13 14 15 16 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 35 39 40 41 44 45 46 49 50 51 52 53 57 60 64 66 73 77 78 80 82 92 98
23 26 29 33 35 36 39 41 42 47 48 49 54 55 56 57 58 59 60 61 62 63 64 66 68 70 71 72 73 74 76 77 79 81 82 83 84 88 89 90 91 92 93 94 95 96 97 ...

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 78ms
memory: 3664kb

input:

100 100 50 50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 17 18 19 20 21 22 25 26 28 29 31 32 33 36 37 38 39 40 41 42 43 44 45 46 47 50 57 59 62 63 64 65 70 71 77 78
4 6 10 13 29 32 37 41 43 44 46 47 52 53 55 58 62 63 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

55822359

result:

ok 1 number(s): "55822359"

Test #31:

score: 0
Accepted
time: 79ms
memory: 3780kb

input:

100 100 50 50
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 28 29 31 32 34 35 36 37 38 39 40 41 47 48 49 50 51 52 53 55 60 65 67 68
20 24 28 31 33 35 40 45 46 54 55 56 57 58 59 61 62 63 66 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

268820259

result:

ok 1 number(s): "268820259"

Test #32:

score: 0
Accepted
time: 78ms
memory: 3792kb

input:

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

output:

252789512

result:

ok 1 number(s): "252789512"

Test #33:

score: 0
Accepted
time: 74ms
memory: 3664kb

input:

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

output:

604525399

result:

ok 1 number(s): "604525399"