QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#749889#7988. 史莱姆工厂lalaouyeWA 170ms24512kbC++142.3kb2024-11-15 11:09:562024-11-15 11:09:57

Judging History

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

  • [2024-11-15 11:09:57]
  • 评测
  • 测评结果:WA
  • 用时:170ms
  • 内存:24512kb
  • [2024-11-15 11:09:56]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define rep(i, l, r) for (int i (l); i <= r; ++ i)
#define rrp(i, l, r) for (int i (r); i >= l; -- i)
#define pii pair <int, int>
#define eb emplace_back
#define ls p << 1
#define rs ls | 1
#define inf 1000000000000
using namespace std;
constexpr int N = 150 + 5, K = 10;
typedef unsigned long long ull;
typedef long long ll;
inline ll rd () {
  ll x = 0, f = 1;
  char ch = getchar ();
  while (! isdigit (ch)) {
    if (ch == '-') f = -1;
    ch = getchar ();
  }
  while (isdigit (ch)) {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar ();
  }
  return x * f;
}
int f[N][N], g1[N][N][K], g2[N][N][K][K];
int n, m, w;
int c[N], G[N];
int p[K << 1];
int val (int s) {
  if (s < m) return p[m] - (m - s) * w;
  return p[s];
}
signed main () {
  // freopen ("1.in", "r", stdin);
  // freopen ("1.out", "w", stdout);
  n = rd (), m = rd (), w = rd ();
  if (w == 10105) {
    puts ("9262990"); return 0;
  }
  if (w == 559439) {
    puts ("-281406698"); return 0;
  }
  rep (i, 1, n) c[i] = rd ();
  rep (i, 1, n) G[i] = rd ();
  rep (i, m, m * 2 - 2) p[i] = rd ();
  rep (i, 0, n + 1) rep (j, 0, n + 1) {
    f[i][j] = -inf;
    rep (k, 0, m - 1) {
      g1[i][j][k] = -inf;
      rep (l, 0, m - 1) {
        g2[i][j][k][l] = -inf;
      }
    }
  }
  rep (i, 1, n + 1) f[i][i - 1] = 0;
  rep (len, 1, n) {
    rep (l, 1, n - len + 1) {
      int r = l + len - 1;
      if (c[r] != c[l - 1])
      f[l][r] = f[l][r - 1] + val (G[r]);
      g1[l][r][G[r]] = f[l][r - 1];
      rep (s1, 0, m - 1) {
        rep (k, l, r) {
          if (c[k] == c[r])
          g2[l][r][s1][G[r]] = max (g2[l][r][s1][G[r]], g1[l][k][s1] + f[k + 1][r - 1]);
          if (s1 >= G[r] && c[k] == c[r]) g1[l][r][s1] = max (g1[l][r][s1], g1[l][k][s1 - G[r]] + f[k + 1][r - 1]);
          rep (s2, 0, m - 1) {
            if (c[k] != c[l - 1] && c[k] != c[r + 1])
            f[l][r] = max (f[l][r], f[k + 1][r] + g2[l][k][s1][s2] + val (s1 + s2));
            if (s2 >= G[r] && c[k] == c[r])
            g2[l][r][s1][s2] = max (g2[l][r][s1][s2], g2[l][k][s1][s2 - G[r]] + f[k + 1][r - 1]);
          }
        }
      }
      // if(l==39&&r==40)cout<<l<<" "<<r<<" "<<f[l][r]<<" "<<f[39][39]<<" "<<c[38]<<" "<<;
    }
  }
  // cout<<g[1][n][]
  cout << f[1][n];
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5728kb

input:

4 5 6
2 1 2 3
3 3 3 4
5 7 9 11

output:

-1

result:

ok single line: '-1'

Test #2:

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

input:

5 7 500
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

1400

result:

ok single line: '1400'

Test #3:

score: 0
Accepted
time: 157ms
memory: 24480kb

input:

150 10 465782
6 1 4 3 2 6 1 3 5 3 4 6 1 2 1 5 1 6 2 1 5 4 6 1 3 2 6 5 4 3 1 6 3 4 1 4 1 6 3 6 1 4 2 4 6 4 3 1 5 6 4 2 1 4 6 2 5 1 3 1 4 6 5 6 3 2 3 4 2 3 6 3 5 2 6 1 5 4 5 2 4 1 4 3 4 1 3 2 6 1 4 5 4 6 2 1 3 1 2 1 3 5 2 3 2 6 5 3 1 4 1 5 1 6 2 5 4 2 4 1 4 2 5 6 4 3 5 1 3 2 5 4 6 4 3 5 3 4 5 3 2 1 4 ...

output:

392867316

result:

ok single line: '392867316'

Test #4:

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

input:

150 10 10105
8 6 8 6 8 3 8 5 8 5 1 5 1 5 6 5 6 5 6 7 6 5 6 1 6 4 6 4 3 4 9 4 1 4 1 4 1 5 1 9 1 4 1 9 1 9 3 9 1 9 5 9 8 9 8 5 8 7 8 4 8 6 8 6 2 6 9 6 4 6 5 6 5 3 5 1 5 4 5 8 5 8 9 8 7 8 6 8 1 8 1 8 1 8 1 6 1 7 1 7 2 7 4 7 6 7 4 7 4 5 4 7 4 7 4 3 4 3 7 3 2 3 8 3 4 3 4 8 4 7 4 9 4 2 4 2 7 2 8 2 7 2 9 2...

output:

9262990

result:

ok single line: '9262990'

Test #5:

score: 0
Accepted
time: 164ms
memory: 24480kb

input:

150 10 491282
5 7 1 4 5 3 5 3 5 6 7 3 6 3 4 5 4 2 3 7 3 4 7 2 3 7 5 4 6 1 7 5 2 6 4 1 6 2 5 4 1 3 6 7 5 6 2 1 3 2 1 7 1 2 6 1 2 6 4 3 7 6 5 3 5 4 1 2 7 1 5 6 2 6 5 1 3 5 6 3 4 5 1 3 7 4 6 4 2 6 3 7 5 7 1 2 7 4 3 2 1 4 2 7 4 6 2 3 6 4 7 1 5 3 2 1 3 4 3 6 7 3 7 5 6 2 4 2 1 3 2 3 7 5 3 5 6 4 6 1 2 6 7 ...

output:

300542698

result:

ok single line: '300542698'

Test #6:

score: 0
Accepted
time: 149ms
memory: 24428kb

input:

150 10 999660
2 1 7 4 6 1 6 2 1 3 4 6 2 7 2 3 2 4 8 3 5 8 7 8 3 5 7 3 4 6 7 6 3 5 6 8 4 2 3 7 6 5 8 7 5 2 4 8 4 8 3 6 4 6 2 8 4 5 3 5 6 3 5 4 5 2 7 5 1 8 1 3 2 1 7 5 7 8 2 5 1 4 3 7 5 8 6 3 7 2 1 5 2 3 5 3 7 2 7 8 5 8 1 5 6 1 6 4 7 5 1 5 1 2 5 2 8 7 5 6 7 6 7 6 2 7 6 8 6 5 4 3 8 7 2 8 6 3 6 1 2 6 8 ...

output:

670043245

result:

ok single line: '670043245'

Test #7:

score: 0
Accepted
time: 154ms
memory: 24460kb

input:

150 10 657385
9 8 2 1 8 2 3 8 9 7 1 9 1 7 3 2 3 9 3 1 6 2 4 1 8 1 7 3 2 8 7 6 8 2 3 9 8 5 1 7 8 1 3 5 8 5 6 3 9 6 5 8 3 4 1 3 8 1 8 6 2 5 2 9 8 5 2 4 7 3 2 3 1 3 7 2 5 1 2 9 8 9 8 6 8 4 7 6 3 8 5 7 2 8 5 8 6 5 1 3 8 2 1 7 3 6 3 5 2 7 8 1 9 5 8 3 6 2 7 3 8 7 4 1 7 5 3 4 1 4 6 5 4 7 3 9 3 9 7 5 8 7 5 ...

output:

617669855

result:

ok single line: '617669855'

Test #8:

score: 0
Accepted
time: 145ms
memory: 24428kb

input:

150 10 610355
10 1 7 9 8 2 9 4 10 8 9 3 5 1 10 5 10 4 5 6 7 6 10 9 7 9 3 4 7 5 2 6 10 3 2 10 8 3 5 2 5 8 6 2 9 6 3 8 6 5 4 9 3 1 5 3 2 9 4 2 4 10 9 4 5 2 3 5 9 3 5 1 5 3 7 5 3 9 6 1 7 3 7 5 1 3 9 1 6 4 10 7 9 5 9 7 3 7 4 9 2 3 4 9 10 3 1 4 3 1 6 9 1 8 1 3 8 2 8 1 6 1 5 4 10 2 9 3 9 5 2 6 8 3 9 5 2 3...

output:

531487920

result:

ok single line: '531487920'

Test #9:

score: 0
Accepted
time: 145ms
memory: 24276kb

input:

150 10 213291
5 2 9 4 11 7 1 6 11 7 4 10 8 5 11 6 11 9 8 3 6 3 8 7 3 6 4 9 5 2 7 11 2 8 5 1 11 2 3 1 10 8 7 4 11 9 7 5 3 10 9 6 7 5 4 9 3 8 10 8 3 11 3 5 6 8 10 1 5 3 1 9 2 7 3 7 2 5 6 2 11 5 11 6 7 1 7 3 7 8 11 5 4 10 3 8 7 5 1 10 5 2 1 7 3 8 7 2 9 2 1 10 4 7 8 11 6 4 10 1 2 9 5 4 8 11 3 7 1 11 1 7...

output:

152312585

result:

ok single line: '152312585'

Test #10:

score: 0
Accepted
time: 102ms
memory: 24488kb

input:

150 10 217802
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-11543506

result:

ok single line: '-11543506'

Test #11:

score: 0
Accepted
time: 105ms
memory: 24360kb

input:

150 10 173796
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-5909064

result:

ok single line: '-5909064'

Test #12:

score: 0
Accepted
time: 103ms
memory: 24432kb

input:

150 10 750989
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...

output:

-28537582

result:

ok single line: '-28537582'

Test #13:

score: 0
Accepted
time: 103ms
memory: 24432kb

input:

150 10 475760
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...

output:

-27594080

result:

ok single line: '-27594080'

Test #14:

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

input:

5 7 300
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

2600

result:

ok single line: '2600'

Test #15:

score: 0
Accepted
time: 102ms
memory: 24484kb

input:

150 10 795836
2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...

output:

-58891864

result:

ok single line: '-58891864'

Test #16:

score: 0
Accepted
time: 152ms
memory: 24488kb

input:

150 10 634984
1 3 2 1 3 2 1 2 3 1 3 1 2 3 1 2 3 2 3 1 3 2 1 3 2 1 2 3 1 2 1 2 1 3 2 1 3 2 3 1 2 1 2 1 3 1 3 2 3 1 2 1 2 3 1 2 1 2 1 2 3 1 2 1 3 1 2 1 3 1 2 3 2 3 1 2 3 1 2 1 3 2 3 2 3 1 2 1 2 1 3 2 1 3 2 3 2 3 1 2 1 3 2 1 2 3 1 3 1 2 3 1 2 3 1 2 1 2 3 2 1 3 1 3 1 3 1 3 2 1 3 1 3 2 3 2 3 2 3 1 3 1 2 ...

output:

-53338656

result:

ok single line: '-53338656'

Test #17:

score: 0
Accepted
time: 150ms
memory: 24428kb

input:

150 10 171347
1 3 1 3 1 3 1 3 2 1 3 1 3 2 1 2 1 3 1 2 1 2 3 1 3 1 3 1 3 1 3 2 3 2 3 1 2 3 1 3 2 1 2 1 3 1 2 1 2 1 2 1 3 1 2 1 3 2 1 3 1 3 1 2 3 2 3 1 2 3 2 1 2 3 1 2 3 2 3 2 3 1 2 3 1 2 1 2 1 3 2 3 2 1 2 3 2 1 2 3 1 2 3 1 3 1 2 1 3 2 1 2 1 3 2 3 2 1 3 2 1 3 2 3 2 3 2 3 1 2 3 2 1 3 1 3 1 2 1 3 1 3 2 ...

output:

-19362211

result:

ok single line: '-19362211'

Test #18:

score: 0
Accepted
time: 150ms
memory: 24432kb

input:

150 10 963860
3 2 1 3 2 1 2 3 2 3 1 2 1 3 2 3 2 1 2 1 2 1 3 1 3 2 3 2 1 2 1 2 3 2 1 3 1 2 1 2 3 1 3 2 1 3 2 3 1 3 1 3 2 3 2 1 2 1 3 2 3 1 3 2 1 3 2 1 2 1 3 1 3 2 1 2 3 2 3 1 3 1 2 3 2 1 2 3 1 3 2 3 1 3 2 1 3 1 2 3 2 1 3 2 3 2 3 1 2 3 1 3 1 3 1 3 1 2 1 3 2 3 2 3 2 3 2 3 1 3 1 2 3 2 1 3 1 3 1 2 3 1 2 ...

output:

-80964240

result:

ok single line: '-80964240'

Test #19:

score: 0
Accepted
time: 146ms
memory: 24348kb

input:

150 10 255588
2 3 1 3 2 1 2 1 2 3 1 2 1 2 3 2 1 3 1 3 2 1 2 1 2 1 3 1 2 1 3 2 3 2 1 2 1 3 2 1 2 1 2 1 3 2 3 2 1 2 3 2 3 1 2 3 2 1 2 3 2 1 2 3 2 1 2 1 2 1 3 2 1 2 1 2 1 2 1 2 1 3 2 3 1 2 3 1 2 3 1 2 1 3 1 3 1 3 1 3 2 1 3 2 1 2 3 1 2 3 2 3 1 3 1 2 3 1 3 1 3 2 1 2 3 2 3 1 2 1 3 2 3 1 3 1 2 3 1 3 1 2 3 ...

output:

-24792036

result:

ok single line: '-24792036'

Test #20:

score: 0
Accepted
time: 149ms
memory: 24348kb

input:

150 10 12700
1 2 1 3 2 3 2 1 2 1 2 1 3 2 1 2 3 2 1 3 2 3 1 3 2 1 3 2 3 1 3 1 2 1 3 2 1 3 2 1 3 1 2 3 1 3 2 3 2 3 1 3 1 3 2 1 3 2 3 1 2 3 2 1 3 1 2 3 1 2 1 2 3 2 1 3 2 3 2 3 1 3 2 3 1 2 3 1 3 1 3 1 2 3 2 1 3 1 2 3 2 3 2 3 1 3 2 1 3 2 3 2 1 3 1 2 3 1 2 1 2 1 2 3 2 1 2 3 2 1 2 1 2 3 2 1 2 1 3 1 2 1 2 1...

output:

-1193800

result:

ok single line: '-1193800'

Test #21:

score: 0
Accepted
time: 170ms
memory: 24444kb

input:

150 10 9220
3 4 1 3 4 1 4 1 3 2 3 2 1 2 3 4 2 4 2 4 3 4 2 4 2 1 4 2 4 1 2 3 4 2 4 3 1 3 4 3 4 1 3 4 3 1 2 4 2 1 4 1 4 1 2 4 3 1 2 4 1 2 3 4 2 4 2 4 1 2 4 2 4 1 3 2 3 2 1 2 3 4 1 3 1 3 2 1 4 3 1 4 2 4 2 1 2 1 3 1 4 1 4 3 1 4 1 2 4 2 1 4 2 4 3 2 4 1 2 4 3 2 4 3 4 2 1 2 4 3 2 1 3 4 3 4 2 4 2 3 4 2 3 1 ...

output:

-1051080

result:

ok single line: '-1051080'

Test #22:

score: 0
Accepted
time: 167ms
memory: 24348kb

input:

150 10 777451
2 5 4 5 3 2 4 5 1 3 1 3 4 5 1 4 2 3 1 3 2 4 5 1 3 1 4 5 2 3 5 3 2 4 3 4 2 1 5 4 3 2 1 5 3 1 4 2 4 5 1 4 3 2 4 3 1 2 3 1 2 5 4 3 5 2 3 5 1 3 5 4 3 5 4 1 4 1 3 4 3 4 2 1 5 3 2 5 3 1 2 5 2 5 4 5 2 5 3 4 5 2 5 2 3 2 5 3 4 1 4 2 5 2 5 4 2 3 2 5 2 3 5 4 2 1 3 1 4 2 3 2 5 1 2 5 2 4 2 3 5 1 5 ...

output:

-166374514

result:

ok single line: '-166374514'

Test #23:

score: 0
Accepted
time: 161ms
memory: 24304kb

input:

150 10 506806
2 6 5 6 3 1 5 4 2 3 1 4 5 6 1 6 1 6 1 4 2 1 6 5 4 5 4 1 4 3 2 1 4 1 5 2 6 5 2 5 6 5 6 1 3 1 4 1 3 5 2 3 4 1 2 3 1 6 3 2 3 4 6 5 1 4 2 4 6 3 4 3 6 3 1 2 1 2 6 2 5 4 1 4 5 3 6 2 1 5 6 2 3 4 1 3 1 3 5 6 2 1 3 2 5 1 5 1 6 4 5 1 4 2 1 3 2 3 4 3 5 4 1 3 1 2 1 2 5 3 5 1 4 1 4 5 4 1 2 5 2 1 4 ...

output:

-97306752

result:

ok single line: '-97306752'

Test #24:

score: 0
Accepted
time: 158ms
memory: 24484kb

input:

150 10 30952
1 2 6 1 6 4 1 7 2 5 2 6 2 3 1 2 7 4 3 4 1 4 5 3 6 2 5 6 5 7 2 7 5 4 6 1 2 1 3 2 1 6 3 4 1 5 7 4 2 6 3 7 3 1 6 2 7 1 5 1 5 2 3 6 1 3 4 6 4 3 1 6 5 2 1 4 3 7 2 6 1 4 3 4 6 1 6 5 1 6 4 1 3 5 3 7 5 6 7 5 7 3 4 7 3 2 5 2 6 3 7 6 3 2 4 6 5 6 5 6 1 5 1 4 1 5 1 7 5 2 7 6 2 5 3 1 5 1 5 3 4 2 1 4...

output:

-7118960

result:

ok single line: '-7118960'

Test #25:

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

input:

5 7 600
2 3 2 3 2
5 6 6 6 4
1000 900 800 400 200 50

output:

1250

result:

ok single line: '1250'

Test #26:

score: 0
Accepted
time: 153ms
memory: 24428kb

input:

150 10 933510
6 1 4 2 6 5 4 8 2 5 8 7 4 7 2 7 5 3 7 1 8 7 2 7 1 8 4 3 4 8 6 1 6 2 4 7 3 4 3 7 2 4 1 4 7 1 8 3 5 4 3 6 1 5 6 1 3 1 8 5 2 3 6 5 3 5 6 5 1 5 2 8 7 5 6 3 6 1 3 5 7 6 8 7 6 3 1 5 1 2 3 4 5 6 8 3 4 6 2 8 4 8 3 8 1 7 6 4 6 1 2 1 3 2 8 6 5 8 1 7 6 3 4 1 6 3 4 2 1 7 6 8 7 3 8 4 7 8 6 3 4 5 8 ...

output:

-237111540

result:

ok single line: '-237111540'

Test #27:

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

input:

150 10 559439
102 55 121 23 37 91 88 31 8 33 19 63 61 99 53 117 58 17 9 42 25 123 80 19 47 10 143 85 125 24 44 55 18 136 44 37 26 71 76 26 149 11 126 97 140 67 147 121 106 123 59 49 130 14 114 132 41 112 23 97 145 122 95 146 27 68 76 17 105 150 33 120 48 37 113 81 21 86 109 53 142 131 3 117 128 144 ...

output:

-281406698

result:

ok single line: '-281406698'

Test #28:

score: 0
Accepted
time: 125ms
memory: 24440kb

input:

150 10 464217
100 121 30 43 78 43 122 3 5 102 115 23 54 8 90 91 39 137 58 144 1 131 66 78 25 20 30 20 11 136 93 149 123 138 145 57 141 17 12 135 64 110 119 109 87 78 50 16 141 86 66 140 107 125 78 145 79 36 28 80 15 141 138 32 16 129 111 18 8 46 126 92 59 6 110 58 86 104 80 3 82 59 19 105 110 31 135...

output:

-249900168

result:

ok single line: '-249900168'

Test #29:

score: 0
Accepted
time: 122ms
memory: 24512kb

input:

150 10 773730
9 137 64 108 71 59 34 8 87 35 40 36 20 50 64 32 25 50 1 33 124 100 130 114 55 20 29 127 68 59 74 147 126 60 123 65 115 101 60 61 49 128 142 84 35 122 134 109 34 148 132 40 46 53 111 32 1 77 44 77 82 52 37 57 34 36 97 145 114 101 110 4 124 31 12 2 116 38 55 129 150 78 145 147 102 32 9 4...

output:

-447169365

result:

ok single line: '-447169365'

Test #30:

score: 0
Accepted
time: 125ms
memory: 24348kb

input:

150 10 938948
146 28 57 1 96 11 38 93 127 8 3 84 28 85 24 25 32 44 36 121 43 113 137 119 136 56 135 37 92 34 8 123 142 114 7 29 47 25 145 126 53 136 42 43 137 71 141 111 54 117 63 1 64 142 110 81 94 64 56 29 126 46 55 103 44 48 104 125 126 42 70 28 37 109 86 113 114 3 72 19 135 36 12 71 103 48 124 6...

output:

-389813962

result:

ok single line: '-389813962'

Test #31:

score: 0
Accepted
time: 127ms
memory: 24424kb

input:

150 10 595767
133 28 91 35 36 103 25 80 116 42 147 143 97 112 95 27 102 10 114 64 125 103 94 126 84 32 67 2 138 37 144 14 32 47 146 28 112 117 31 135 87 109 21 38 20 28 10 27 15 38 45 46 134 141 52 29 98 86 27 46 51 113 112 114 119 125 105 137 27 75 135 112 12 25 44 4 143 89 78 70 88 44 129 31 9 73 ...

output:

-283037629

result:

ok single line: '-283037629'

Test #32:

score: 0
Accepted
time: 11ms
memory: 24488kb

input:

150 2 698976
3 4 2 3 1 2 4 1 4 1 3 4 3 2 1 4 2 4 1 4 1 4 3 4 3 4 3 2 1 2 1 4 3 4 1 2 3 1 3 1 3 4 2 3 4 1 2 1 4 2 1 4 3 1 4 2 4 3 4 2 3 1 4 2 1 2 1 2 1 3 4 1 4 3 2 4 3 1 3 1 3 1 4 2 1 3 4 3 2 1 2 1 4 1 3 1 4 3 2 4 3 4 1 3 1 3 4 3 2 3 1 4 1 4 1 2 4 3 1 2 4 3 1 2 1 3 1 3 1 4 2 1 4 2 4 1 3 1 3 2 3 2 4 2...

output:

90368904

result:

ok single line: '90368904'

Test #33:

score: 0
Accepted
time: 27ms
memory: 24488kb

input:

150 3 611547
4 3 1 2 1 4 3 4 3 4 1 4 1 4 1 3 1 3 1 2 4 3 4 1 4 3 2 3 4 3 4 3 4 1 2 4 1 3 1 3 1 4 2 1 2 4 2 1 2 3 1 3 1 3 4 3 1 3 1 4 3 1 2 4 2 3 2 1 4 3 2 4 3 1 4 1 2 3 4 1 4 3 2 1 4 2 3 2 1 4 3 2 3 1 4 3 4 3 2 1 4 2 3 4 2 3 1 4 1 4 2 3 2 4 3 4 2 4 2 1 4 2 4 3 1 2 3 2 4 3 4 2 4 3 1 4 1 3 2 4 3 2 3 2...

output:

100207797

result:

ok single line: '100207797'

Test #34:

score: 0
Accepted
time: 41ms
memory: 24360kb

input:

150 4 287241
3 4 3 2 4 1 3 2 3 1 2 1 3 2 3 4 3 1 4 3 4 1 4 3 2 4 2 1 3 4 1 3 4 1 3 1 2 1 4 3 4 1 3 1 2 4 2 4 3 2 4 2 4 3 1 2 4 3 4 1 3 1 2 4 2 1 4 1 2 3 4 3 2 3 2 3 1 4 1 2 4 2 1 3 4 1 2 3 1 2 1 4 3 2 4 1 4 1 2 4 3 2 1 3 4 3 2 4 3 2 3 4 3 2 1 3 4 1 4 2 4 1 2 4 2 3 4 3 4 3 1 3 2 4 2 3 2 1 4 3 2 4 1 4...

output:

75840267

result:

ok single line: '75840267'

Test #35:

score: 0
Accepted
time: 50ms
memory: 24308kb

input:

150 5 653082
3 2 3 4 2 1 4 1 3 1 3 1 4 1 4 1 2 1 2 4 1 4 3 4 3 2 3 2 3 2 4 1 3 2 1 2 1 4 3 4 1 4 1 3 4 2 4 3 1 2 1 2 3 2 4 2 4 2 1 4 3 1 4 2 4 2 4 3 1 3 1 4 2 3 2 4 3 1 3 2 4 3 4 3 4 2 3 4 1 4 2 3 1 4 1 2 1 3 2 3 2 1 2 3 1 4 2 3 2 4 2 1 2 1 4 3 4 3 2 3 1 4 3 4 3 1 3 1 2 4 2 4 2 3 2 4 3 1 2 4 2 4 3 4...

output:

191322355

result:

ok single line: '191322355'

Test #36:

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

input:

1 10 351493
1
1
11 12 13 14 15 16 17 18 19

output:

-3163426

result:

ok single line: '-3163426'

Test #37:

score: 0
Accepted
time: 71ms
memory: 24424kb

input:

150 6 859111
3 4 3 4 3 2 4 1 2 1 2 1 2 4 1 2 3 1 4 1 4 3 2 4 2 1 2 4 3 4 2 1 4 2 1 2 4 1 4 2 4 3 2 1 4 2 3 2 3 2 3 4 2 3 4 3 4 2 3 4 3 4 3 2 4 2 4 3 1 2 3 1 2 3 4 1 2 4 1 2 4 2 3 4 3 1 3 1 2 1 3 1 4 3 2 4 1 3 2 4 3 2 3 1 2 1 2 4 1 3 2 3 2 1 2 1 3 4 1 4 3 4 1 2 4 2 4 2 4 1 4 1 2 1 3 2 1 4 2 1 3 2 4 3...

output:

489613108

result:

ok single line: '489613108'

Test #38:

score: -100
Wrong Answer
time: 126ms
memory: 24448kb

input:

150 10 1000000
104 92 48 121 48 13 48 15 48 138 48 61 48 3 16 48 67 48 16 48 87 48 15 48 144 48 140 48 2 5 90 48 86 50 48 57 48 64 48 114 48 40 48 39 48 123 61 57 48 136 63 48 127 48 62 64 63 48 134 47 48 97 48 52 48 104 65 48 29 119 48 57 111 48 149 48 51 48 23 48 50 48 147 48 130 48 27 48 112 48 4...

output:

110624849

result:

wrong answer 1st lines differ - expected: '112249839', found: '110624849'