QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#713175#9563. 人间应又雪hos_lyric#37 702ms70644kbC++143.1kb2024-11-05 18:26:372024-11-05 18:26:39

Judging History

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

  • [2024-11-05 18:26:39]
  • 评测
  • 测评结果:37
  • 用时:702ms
  • 内存:70644kb
  • [2024-11-05 18:26:37]
  • 提交

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 <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#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; }
#define COLOR(s) ("\x1b[" s "m")


int TID;
int N, M, C;
vector<int> A;

namespace brute {
/*
  yanhe : x[0],...,x[k]
  tianyi: y[N-1],...,y[k]
  s := \sum x[i]
  t := \sum y[i]
  fix t ~> x[0],...,x[k-1]: greedy
  fix s ~> y[N-1],...,y[k+1]: greedy
*/
int pre[4010][4010];
int suf[4010][4010];
int run() {
  for (int t = 0; t <= M; ++t) {
    pre[t][0] = 0;
    for (int i = 0; i < N; ++i) {
      const int x = (max(A[i] - pre[t][i] - t, 0) + (C+1) - 1) / (C+1);
      pre[t][i + 1] = pre[t][i] + x;
    }
  }
  for (int s = 0; s <= M; ++s) {
    suf[s][N] = 0;
    for (int i = N; --i >= 0; ) {
      const int y = (max(A[i] - s - suf[s][i + 1], 0) + (C+1) - 1) / (C+1);
      suf[s][i] = y + suf[s][i + 1];
    }
  }
  int ans = M;
  for (int i = 0; i < N; ++i) {
    /*
    for (int s = 0; s <= M; ++s) for (int t = 0; t <= M; ++t) {
      const int x = s - pre[t][i];
      const int y = t - suf[s][i + 1];
      if (x >= 0 && y >= 0 && C * (x + y) >= A[i] - s - t) {
        chmin(ans, s + t);
      }
    }
    */
    for (int s = 0; s <= M; ++s) {
      int lo = -1, hi = M + 1;
      for (; lo + 1 < hi; ) {
        const int t = (lo + hi) / 2;
        const int x = s - pre[t][i];
        const int y = t - suf[s][i + 1];
        ((x >= 0 && y >= 0 && C * (x + y) >= A[i] - s - t) ? hi : lo) = t;
      }
      chmin(ans, s + hi);
    }
  }
  return ans;
}
}  // brute

int main() {
  for (int numCases; ~scanf("%d%d", &numCases, &TID); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
    scanf("%d%d%d", &N, &M, &C);
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%d", &A[i]);
    }
    
    int ans;
    if (C == 0) {
      ans = *max_element(A.begin(), A.end());
    } else {
assert(N<=4000);
assert(M<=4000);
      ans = brute::run();
    }
    printf("%d\n", ans);
  }
#ifndef LOCAL
  break;
#endif
  }
  return 0;
}

詳細信息

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 1ms
memory: 3816kb

input:

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

output:

8
8
9
9
10
8
9
8
9
10
8
5
10
9
8
8
7
10
8
10
8
10
9
8
10
6
10
8
8
6
7
8
9
7
9
8
8
8
5
8
9
10
5
8
10
8
10
7
9
9
9
8
8
7
9
9
8
9
8
8
7
8
8
7
10
9
10
9
9
8
8
9
7
8
9
7
7
9
6
10
8
7
8
8
9
9
9
9
9
8
8
5
7
8
8
9
6
8
8
9
8
9
8
9
9
10
8
9
8
8
7
8
7
8
7
7
7
10
9
10
9
9
8
9
8
10
10
8
7
10
8
10
8
8
8
7
10
10
8...

result:

ok 1000 lines

Test #2:

score: 2
Accepted
time: 58ms
memory: 7452kb

input:

2 1
499998 499999 0
301138 174092 254294 217002 447568 498904 49075 373725 308244 252462 370947 392908 319430 488362 86682 68848 435192 169516 29640 369208 128139 213960 159766 44498 322235 240582 283451 176399 270410 120552 173820 121114 197080 354767 283489 398040 13031 432699 251631 352577 264788...

output:

499999
499997

result:

ok 2 lines

Subtask #2:

score: 0
Runtime Error

Test #3:

score: 3
Accepted
time: 1ms
memory: 5824kb

input:

1000 2
10 2 3
1 2 1 2 1 2 2 1 0 1
10 2 0
0 0 0 0 0 0 0 0 0 0
10 2 3
0 0 1 1 0 1 0 0 0 1
10 2 3
0 0 0 0 0 0 0 0 0 0
10 2 1
1 0 2 2 0 0 1 0 1 1
10 2 3
0 1 1 0 2 0 1 2 2 2
10 2 0
0 0 0 0 0 0 0 0 0 0
10 2 0
0 0 0 1 1 1 0 0 0 1
10 2 1
1 1 0 2 0 0 0 0 0 0
10 2 1
1 1 2 0 0 2 0 2 1 0
10 2 1
0 0 0 0 0 0 0 0 ...

output:

2
0
1
0
2
2
0
1
1
2
0
1
0
1
0
0
2
2
0
0
2
0
1
2
1
1
2
0
2
1
0
0
2
1
0
1
2
1
0
1
2
2
2
0
1
2
1
2
2
2
1
2
2
2
1
0
1
2
2
1
0
1
0
1
0
2
2
2
2
2
0
1
2
2
2
2
1
2
2
1
2
0
0
1
2
2
1
2
2
1
0
2
2
2
1
0
0
0
1
2
0
2
2
0
0
2
2
0
2
2
0
1
1
2
0
0
1
2
1
2
1
2
2
2
1
1
2
0
0
2
2
0
2
2
2
0
2
1
1
0
2
2
2
2
0
0
1
0
0
1
...

result:

ok 1000 lines

Test #4:

score: 3
Accepted
time: 8ms
memory: 5960kb

input:

100 2
1000 2 2
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...

output:

0
1
1
2
1
0
1
1
2
0
0
0
0
0
0
1
0
2
2
2
1
2
1
1
1
2
2
2
0
2
1
1
2
0
0
1
2
0
0
0
0
2
2
2
1
1
2
2
0
0
2
1
2
1
2
2
0
2
0
0
0
2
2
0
2
0
0
2
1
2
1
2
0
1
0
2
1
1
2
2
2
2
2
2
0
2
2
1
2
2
0
1
2
1
1
0
0
0
0
2

result:

ok 100 lines

Test #5:

score: 0
Runtime Error

input:

2 2
500000 2 1
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...

output:


result:


Subtask #3:

score: 5
Accepted

Test #6:

score: 5
Accepted
time: 1ms
memory: 5956kb

input:

10 3
5 5 3
4 1 5 1 4
4 5 4
2 2 3 4
5 5 0
1 1 5 3 4
4 4 2
2 1 0 1
3 5 3
0 2 3
5 4 2
3 2 4 1 4
3 4 4
3 2 2
3 4 5
4 0 2
3 5 3
1 0 5
5 4 0
2 0 4 1 3

output:

3
2
5
1
2
3
2
2
2
4

result:

ok 10 lines

Test #7:

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

input:

10 3
5 5 4
2 2 1 0 0
5 5 5
5 3 1 0 1
5 5 5
0 3 2 0 0
5 5 1
1 5 2 5 2
5 5 3
4 5 0 1 5
5 5 5
2 3 3 4 3
5 5 4
5 4 5 2 5
5 5 1
3 0 2 2 3
5 5 5
1 3 1 1 4
5 5 3
1 3 4 5 1

output:

2
2
2
4
3
3
4
2
2
3

result:

ok 10 lines

Test #8:

score: 5
Accepted
time: 1ms
memory: 5960kb

input:

10 3
5 5 4
1 5 2 2 1
5 5 5
0 1 1 1 4
5 5 2
1 1 2 3 4
5 5 3
1 3 5 4 2
5 5 5
1 1 5 4 3
5 5 5
0 3 4 4 5
5 5 1
0 0 1 2 5
5 5 3
0 0 1 2 4
5 5 3
3 5 3 3 3
5 5 4
2 5 5 4 3

output:

2
1
3
3
3
3
3
2
3
4

result:

ok 10 lines

Test #9:

score: 5
Accepted
time: 1ms
memory: 5960kb

input:

10 3
5 5 5
5 3 2 1 1
5 5 4
3 3 1 2 2
5 5 4
5 5 4 0 1
5 5 4
5 4 4 0 0
5 5 4
5 3 3 1 0
5 5 1
4 2 2 3 4
5 5 2
4 3 3 2 1
5 5 3
5 2 2 1 1
5 5 3
5 4 3 3 0
5 5 4
5 1 1 2 4

output:

2
2
3
3
3
3
3
2
3
2

result:

ok 10 lines

Test #10:

score: 5
Accepted
time: 1ms
memory: 5960kb

input:

10 3
5 5 2
4 2 4 4 5
5 5 1
2 0 2 3 4
5 5 2
2 5 4 1 1
5 5 3
1 5 5 5 5
5 5 5
5 1 1 5 3
5 5 5
3 3 5 1 5
5 5 1
3 4 1 3 2
5 5 5
5 5 5 2 2
5 5 4
5 5 1 1 5
5 5 5
5 5 2 2 5

output:

4
3
3
4
3
3
3
3
3
3

result:

ok 10 lines

Test #11:

score: 5
Accepted
time: 1ms
memory: 5952kb

input:

10 3
5 5 1
5 5 3 5 1
5 5 3
0 0 4 1 1
5 5 5
5 1 1 1 1
5 5 4
5 1 1 5 0
5 5 1
0 2 1 5 5
5 5 5
1 1 5 1 1
5 5 3
2 5 0 0 0
5 5 1
3 3 5 0 0
5 5 3
2 2 5 4 0
5 5 5
0 5 1 1 1

output:

4
1
1
2
4
2
2
3
2
1

result:

ok 10 lines

Test #12:

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

input:

10 3
5 5 2
5 5 4 5 4
5 5 1
5 5 5 5 4
5 5 3
4 4 4 5 5
5 5 5
4 4 5 5 4
5 5 5
5 4 5 4 4
5 5 1
5 4 4 5 4
5 5 4
4 4 5 5 5
5 5 3
4 5 5 5 4
5 5 2
5 5 5 4 5
5 5 4
4 4 4 5 5

output:

4
5
4
4
4
4
4
4
5
4

result:

ok 10 lines

Subtask #4:

score: 10
Accepted

Dependency #3:

100%
Accepted

Test #13:

score: 10
Accepted
time: 1ms
memory: 5996kb

input:

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

output:

6
7
4
5
4
6
8
3
7
5
2
5
5
6
4
5
5
6
4
5

result:

ok 20 lines

Test #14:

score: 10
Accepted
time: 0ms
memory: 8084kb

input:

4 4
50 50 2
27 29 4 40 18 13 32 22 48 50 46 38 9 45 3 22 41 35 24 33 23 15 11 1 39 2 33 44 20 22 35 17 26 31 35 49 21 22 13 46 30 3 44 21 40 1 28 3 50 5
50 50 1
6 15 26 15 20 9 43 13 17 17 44 19 10 44 48 15 20 32 22 6 38 5 33 37 26 23 50 17 19 15 18 35 39 32 12 36 50 0 1 39 23 46 43 12 8 0 48 28 46 ...

output:

45
48
45
46

result:

ok 4 lines

Test #15:

score: 10
Accepted
time: 0ms
memory: 6208kb

input:

4 4
50 50 27
0 2 2 3 3 5 6 6 6 6 6 7 7 7 10 12 13 14 16 19 21 21 22 23 24 25 26 49 49 49 49 48 48 45 42 41 40 39 38 37 36 36 36 35 34 34 33 33 33 32
50 50 8
1 3 4 4 5 7 7 7 8 9 10 10 11 12 12 13 14 15 15 16 18 19 20 22 23 25 25 26 27 28 29 30 30 30 32 32 34 36 36 36 37 41 41 41 42 43 43 43 45 47
50 ...

output:

26
34
41
32

result:

ok 4 lines

Test #16:

score: 10
Accepted
time: 1ms
memory: 8188kb

input:

4 4
50 50 16
49 47 45 45 42 41 40 40 39 39 0 1 1 1 2 2 4 5 6 10 12 13 14 16 16 18 18 18 19 20 24 26 26 26 27 27 30 31 32 32 33 34 34 35 35 36 36 38 38 38
50 50 10
49 48 47 44 42 42 42 41 41 40 40 38 36 34 34 33 32 31 31 29 28 28 27 27 26 26 25 25 23 21 19 18 16 16 16 15 14 14 0 2 4 4 6 6 7 7 7 8 11 ...

output:

31
34
35
31

result:

ok 4 lines

Test #17:

score: 10
Accepted
time: 0ms
memory: 6148kb

input:

4 4
50 50 18
16 34 15 50 15 34 16 16 16 16 35 17 35 16 16 16 50 36 18 18 18 36 36 18 50 35 17 50 16 34 15 15 15 15 15 34 34 15 15 15 15 15 50 34 35 35 50 32 32 14
50 50 2
6 6 8 5 5 5 5 5 5 5 5 5 5 5 5 5 8 6 6 6 6 6 6 9 7 7 7 7 7 7 11 8 6 6 6 8 7 4 4 4 4 4 4 4 4 4 4 6 3 3
50 50 6
0 0 0 0 0 0 0 0 7 1 ...

output:

29
9
1
38

result:

ok 4 lines

Test #18:

score: 10
Accepted
time: 1ms
memory: 9912kb

input:

4 4
50 50 2
6 6 6 12 8 8 8 8 8 8 8 8 8 13 8 8 8 18 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
50 50 18
5 5 5 5 5 5 5 5 5 5 50 23 23 23 23 23 23 23 23 23 23 23 23 23 23 50 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26
50 50 1
14 14 14 14 14 14 14 14 14 1...

output:

9
26
17
30

result:

ok 4 lines

Test #19:

score: 10
Accepted
time: 1ms
memory: 8076kb

input:

4 4
50 50 46
49 50 49 50 50 50 49 50 49 50 49 49 49 50 49 50 49 50 49 50 50 50 50 50 49 50 50 50 49 49 49 50 49 49 49 50 49 49 50 49 49 50 50 50 50 49 50 49 50 49
50 50 11
50 50 49 50 50 49 49 49 50 49 50 49 50 49 50 50 49 50 50 49 50 50 49 49 50 50 50 49 49 49 49 49 49 49 49 49 49 49 50 49 49 50 49...

output:

49
50
49
49

result:

ok 4 lines

Subtask #5:

score: 10
Accepted

Dependency #4:

100%
Accepted

Test #20:

score: 10
Accepted
time: 1ms
memory: 6044kb

input:

30 5
20 18 2
11 1 4 8 18 16 15 13 13 10 3 4 5 9 10 11 2 4 4 8
19 20 0
6 17 17 15 3 16 2 8 7 11 0 14 14 6 12 15 19 2 9
19 20 10
19 10 0 7 14 8 5 7 20 4 10 16 9 3 5 10 12 4 3
18 20 4
8 9 17 0 1 15 15 4 12 13 10 12 8 17 17 16 18 6
19 18 10
17 1 17 10 0 5 13 5 16 12 8 18 0 8 12 12 5 3 9
20 19 3
16 6 17 ...

output:

13
19
10
13
11
15
15
14
15
13
10
11
18
20
13
11
12
10
11
20
10
12
14
12
18
15
13
14
11
11

result:

ok 30 lines

Test #21:

score: 10
Accepted
time: 6ms
memory: 12296kb

input:

3 5
200 200 18
76 132 130 37 139 121 171 152 22 23 194 5 181 174 96 3 71 109 143 20 144 114 157 195 109 99 120 132 110 50 101 103 37 186 71 193 157 22 65 136 84 96 123 13 154 26 66 161 200 60 93 45 48 137 18 81 77 45 37 145 100 57 130 54 20 38 28 135 16 132 85 6 18 117 26 129 57 172 10 7 198 152 26 ...

output:

157
135
131

result:

ok 3 lines

Test #22:

score: 10
Accepted
time: 4ms
memory: 16332kb

input:

2 5
300 300 52
0 1 2 2 4 6 7 7 9 10 10 11 12 12 12 13 14 14 17 18 21 21 23 24 24 24 24 24 24 26 26 26 27 29 32 32 33 33 36 37 37 39 39 40 40 40 41 42 43 44 45 46 46 47 47 47 50 50 51 53 54 54 57 57 57 60 65 65 66 71 72 72 74 74 74 74 75 75 75 78 80 81 81 81 82 82 83 83 84 85 86 91 91 93 93 94 94 94 ...

output:

217
189

result:

ok 2 lines

Test #23:

score: 10
Accepted
time: 9ms
memory: 16692kb

input:

2 5
300 300 2
300 299 299 299 299 298 298 297 289 289 288 288 286 286 286 286 285 284 283 282 280 279 279 278 278 278 276 275 275 275 275 274 274 273 273 272 271 270 270 270 266 265 264 262 261 260 259 257 257 256 256 254 254 251 249 249 245 244 244 244 240 236 236 236 234 233 233 227 227 227 226 22...

output:

289
204

result:

ok 2 lines

Test #24:

score: 10
Accepted
time: 9ms
memory: 14304kb

input:

2 5
300 300 12
46 34 34 34 34 47 35 35 48 49 37 61 35 35 35 35 35 35 47 34 47 35 35 48 36 36 36 36 36 36 36 36 49 37 50 38 38 38 38 38 38 38 38 38 38 38 38 38 38 51 39 39 39 39 39 39 52 40 40 40 40 40 40 40 53 41 41 41 41 41 41 41 41 66 41 54 42 42 42 54 41 41 53 40 40 40 40 53 54 55 55 42 42 42 42 ...

output:

59
172

result:

ok 2 lines

Test #25:

score: 10
Accepted
time: 10ms
memory: 16400kb

input:

2 5
300 300 39
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 132 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14...

output:

15
2

result:

ok 2 lines

Test #26:

score: 10
Accepted
time: 5ms
memory: 16420kb

input:

2 5
300 300 82
300 299 300 299 299 299 300 299 300 299 300 299 299 299 300 299 299 300 299 299 300 300 300 300 300 299 300 299 300 299 299 300 299 299 300 300 300 299 300 299 300 300 300 300 299 300 299 300 299 300 300 299 299 300 300 299 300 300 300 299 299 300 299 300 299 300 299 300 300 300 299 2...

output:

300
299

result:

ok 2 lines

Subtask #6:

score: 10
Accepted

Dependency #5:

100%
Accepted

Test #27:

score: 10
Accepted
time: 10ms
memory: 8340kb

input:

40 6
100 100 55
21 89 57 40 63 86 81 67 27 21 93 86 92 67 55 18 98 31 76 24 54 92 84 57 40 19 65 57 8 54 3 11 77 72 43 23 41 77 28 49 95 77 92 11 53 34 7 47 48 96 14 35 46 92 14 28 14 11 79 29 15 45 84 22 39 24 83 58 36 16 69 45 25 60 95 79 72 85 69 50 28 43 10 80 70 73 69 22 20 87 30 25 45 4 81 0 2...

output:

55
68
55
60
51
77
62
88
66
59
67
58
55
55
54
75
71
69
68
88
55
55
56
56
53
60
57
57
54
58
61
53
71
70
56
51
86
69
56
52

result:

ok 40 lines

Test #28:

score: 10
Accepted
time: 667ms
memory: 67896kb

input:

2 6
2000 2000 62
2 2 4 4 5 7 7 8 8 9 11 11 13 13 13 14 14 18 19 19 20 21 22 24 25 25 27 27 27 28 29 30 30 31 32 33 34 34 37 37 40 40 42 44 45 46 47 48 49 52 58 59 60 61 61 62 62 64 65 65 65 65 65 66 66 67 67 69 70 71 72 72 73 74 74 75 75 78 80 80 81 81 83 84 84 84 88 89 90 90 91 94 94 96 96 98 98 98...

output:

1837
1609

result:

ok 2 lines

Test #29:

score: 10
Accepted
time: 635ms
memory: 68064kb

input:

2 6
2000 2000 471
2000 1997 1997 1996 1996 1992 1992 1992 1990 1989 1988 1988 1987 1985 1984 1981 1979 1978 1977 1977 1977 1976 1976 1973 1973 1972 1972 1971 1970 1968 1968 1967 1966 1963 1962 1961 1958 1957 1956 1955 1954 1953 1953 1952 1951 1951 1949 1949 1946 1945 1944 1944 1944 1942 1941 1939 19...

output:

1390
1559

result:

ok 2 lines

Test #30:

score: 10
Accepted
time: 583ms
memory: 69580kb

input:

2 6
2000 2000 169
955 1805 1130 1301 1132 1131 1131 962 962 962 1301 1132 1302 1132 1131 961 1130 1468 959 1297 957 1296 1126 956 1126 1127 1128 959 1299 1130 1129 1469 1132 1302 1302 963 963 963 1132 1131 1130 1636 1296 958 958 958 1128 959 1297 1297 1129 1129 1298 959 1129 1130 1299 959 959 959 95...

output:

1312
890

result:

ok 2 lines

Test #31:

score: 10
Accepted
time: 578ms
memory: 70576kb

input:

2 6
2000 2000 153
8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ...

output:

12
1488

result:

ok 2 lines

Test #32:

score: 10
Accepted
time: 702ms
memory: 70644kb

input:

2 6
2000 2000 1865
1999 1999 1999 1999 1999 1999 2000 1999 2000 1999 2000 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 2000 1999 2000 2000 2000 1999 2000 1999 1999 1999 1999 1999 1999 2000 2000 2000 1999 2000 1999 2000 1999 2000 1999 2000 1999 2000 2000 2000 2000 1999 2000 1999 1999 2000 2...

output:

1999
1999

result:

ok 2 lines

Subtask #7:

score: 0
Runtime Error

Test #33:

score: 20
Accepted
time: 46ms
memory: 6040kb

input:

5000 7
19 19 16
4 12 5 15 12 11 9 0 3 1 8 4 17 2 19 3 5 4 1
18 20 19
18 14 12 16 7 14 2 3 13 4 4 6 8 1 16 19 10 20
20 19 3
15 7 5 16 19 0 1 19 10 19 13 17 18 5 1 13 9 4 8 15
19 20 6
8 3 0 12 4 13 19 2 6 4 11 8 17 6 8 13 11 8 20
18 19 19
3 15 19 12 17 11 11 2 4 4 16 13 10 12 15 14 3 10
19 20 20
12 15...

output:

9
10
16
11
11
12
13
12
14
12
10
19
10
9
12
18
10
15
11
9
9
11
9
11
9
11
10
9
18
12
16
11
10
18
9
10
9
14
12
17
9
13
15
11
10
13
11
11
13
11
13
10
9
9
14
10
10
11
12
10
14
12
11
13
10
12
9
13
18
13
11
16
13
15
10
10
13
10
11
12
9
11
11
11
11
18
12
10
10
11
19
11
9
16
11
10
10
10
17
9
16
10
12
10
12
1...

result:

ok 5000 lines

Test #34:

score: 20
Accepted
time: 53ms
memory: 6040kb

input:

5000 7
20 20 17
8 13 3 20 11 14 0 16 9 4 6 12 10 19 17 18 6 12 10 4
20 20 13
20 20 0 8 18 19 0 6 12 12 11 12 6 9 20 13 16 20 16 18
20 20 15
6 16 1 6 2 9 15 4 14 1 14 18 14 13 1 4 19 16 5 16
20 20 14
6 16 0 9 18 16 11 16 2 9 2 9 0 15 10 5 14 18 19 12
20 20 16
11 16 20 15 20 4 18 12 20 1 20 11 13 15 1...

output:

12
12
11
11
14
10
14
13
12
11
15
11
11
12
11
11
10
13
10
12
13
13
12
12
8
14
14
11
14
11
12
18
14
10
12
12
11
12
12
11
13
11
10
12
13
10
14
9
10
10
12
17
10
13
12
15
11
11
12
10
11
11
11
10
10
17
12
13
10
14
14
8
10
12
16
12
16
9
11
14
10
11
12
14
13
11
12
10
11
18
10
12
12
9
10
9
11
15
10
11
9
14
1...

result:

ok 5000 lines

Test #35:

score: 0
Runtime Error

input:

2 7
50000 50000 13
14372 18626 2882 156 873 21151 14082 1047 948 5262 23982 17851 3525 45524 36586 13870 5948 12786 22417 48991 16686 3022 26756 27407 35381 1439 1732 31854 48953 2459 28941 6550 19617 8044 43294 42701 20930 33877 11580 1246 1164 30125 6870 9257 20119 28306 13881 7577 5889 4194 5365 ...

output:


result:


Subtask #8:

score: 0
Skipped

Dependency #6:

100%
Accepted

Dependency #7:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #7:

0%

Subtask #10:

score: 0
Skipped

Dependency #2:

0%