QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587857#9184. Team Codingtree31 71ms34860kbC++143.0kb2024-09-24 22:03:292024-09-24 22:03:29

Judging History

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

  • [2024-09-24 22:03:29]
  • 评测
  • 测评结果:31
  • 用时:71ms
  • 内存:34860kb
  • [2024-09-24 22:03:29]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

const int N = 1e5 + 5, B = 320;

int _sum, dep[N], dfn[N], tot, n, k, cnt[N], c[N], sum[N], ans[N], xa, xb, End[N], pp, _cnt[N], p[N], u;
vector<int>v1[N], v2[N], g[N], e[N];

void Mr(vector<int>&a, vector<int>&b){
  if(b.size() > a.size()){
    swap(a, b);
  }
  for(int i = 0; i < b.size(); i++){
    a[a.size() - i - 1] = a[a.size() - i - 1] + b[b.size() - i - 1];
  }
}

void dfs(int x, int fa){
  v1[x].clear(), v2[x].clear();
  for(auto v : g[x]){
    dfs(v, x);
    Mr(v1[x], v1[v]);
  }
  v1[x].push_back(1);
  if(cnt[c[x]] <= B){
    pp = 0;
    vector<int>ev;
    for(auto v : e[c[x]]){
      if(dfn[v] >= dfn[x] && dfn[v] <= End[x]){
       pp++;
      }
      if(dep[v] >= dep[x]){
        ev.push_back(dep[v]);
        _cnt[dep[v]]++;
      }
    }
    sort(ev.begin(), ev.end());
    ev.erase(unique(ev.begin(), ev.end()), ev.end());
    _sum = 0;
    for(auto v : ev){
      if(v1[x].size() - (v - dep[x]) - 1 >= 0){
        _sum += min(_cnt[v], v1[x][int(v1[x].size()) - (v - dep[x]) - 1]);
      }
      _cnt[v] = 0;
    }
    if(_sum > xa || _sum == xa && xb > _sum - pp){
      xa = _sum, xb = _sum - pp;
    }
  }
}

void DFS(int x, int id){
  v1[x].clear(), v2[x].clear(), sum[x] = 0, ans[x] = 0;
  for(auto v : g[x]){
    DFS(v, id);
    if(v1[x].size() < v1[v].size()){
      swap(v1[x], v1[v]);
      swap(v2[x], v2[v]);
      swap(ans[x], ans[v]);
      swap(sum[x], sum[v]);
    }
    for(int i = 0; i < v1[v].size(); i++){
      ans[x] -= v1[x][int(v1[x].size()) - i - 1] - v2[x][int(v1[x].size()) - i - 1];
      sum[x] -= v1[x][int(v1[x].size()) - i - 1];
    }
    for(int i = 0; i < v1[v].size(); i++){
      v1[x][int(v1[x].size()) - i - 1] = min(v1[x][int(v1[x].size()) - i - 1] + v1[v][int(v1[v].size()) - i - 1], p[dep[x] + i + 1]);
      v2[x][int(v1[x].size()) - i - 1] += v2[v][int(v1[v].size()) - i - 1];
    }
    for(int i = 0; i < v1[v].size(); i++){
      ans[x] += v1[x][int(v1[x].size()) - i - 1] - v2[x][int(v1[x].size()) - i - 1];
      sum[x] += v1[x][int(v1[x].size()) - i - 1];
    }
  }
  v1[x].push_back(min(1, p[dep[x]]));
  v2[x].push_back(c[x] == id);
  ans[x] += v1[x].back() - v2[x].back();
  sum[x] += v1[x].back();
  if((c[x] == id) && (sum[x] > xa || sum[x] == xa && xb > ans[x])){
    xa = sum[x], xb = ans[x];
  }
}

void Dfs(int x, int fa){
  dep[x] = dep[fa] + 1;
  dfn[x] = ++tot;
  for(auto v : g[x]){
    Dfs(v, x);
  }
  End[x] = tot;
}

signed main(){
  cin >> n >> k;
  for(int i = 1; i <= n; ++i){
    cin >> c[i];
    c[i]++;
    cnt[c[i]]++;
    e[c[i]].push_back(i);
  }
  for(int i = 2; i <= n; ++i){
    cin >> u;
    g[u + 1].push_back(i);
  }
  Dfs(1, 0);
  dfs(1, 0);
  for(int i = 1; i <= k; ++i){
    if(cnt[i] > B){
      for(auto v : e[i]){
        p[dep[v]]++;
      }
      DFS(1, i);
      for(auto v : e[i]){
        p[dep[v]] = 0;
      }
    }
  }
  cout << xa << ' ' << xb << '\n';
  return 0;
}

詳細信息

Subtask #1:

score: 12
Accepted

Test #1:

score: 12
Accepted
time: 0ms
memory: 14868kb

input:

1 1
0

output:

1 0

result:

ok single line: '1 0'

Test #2:

score: 12
Accepted
time: 0ms
memory: 15412kb

input:

5 2
0 1 0 0 0
0
1
2
3

output:

4 0

result:

ok single line: '4 0'

Test #3:

score: 12
Accepted
time: 0ms
memory: 14616kb

input:

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

output:

3 0

result:

ok single line: '3 0'

Test #4:

score: 12
Accepted
time: 3ms
memory: 15852kb

input:

15 8
3 6 7 6 7 6 6 0 6 7 3 6 2 3 3
0
1
2
3
4
5
6
7
8
9
10
11
12
13

output:

6 0

result:

ok single line: '6 0'

Test #5:

score: 12
Accepted
time: 0ms
memory: 16028kb

input:

7 3
1 1 1 2 1 0 1
0
1
2
3
4
5

output:

5 0

result:

ok single line: '5 0'

Test #6:

score: 12
Accepted
time: 2ms
memory: 14832kb

input:

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

output:

2 0

result:

ok single line: '2 0'

Test #7:

score: 12
Accepted
time: 3ms
memory: 15600kb

input:

100 97
73 42 17 20 20 71 6 52 18 93 34 27 96 35 77 27 46 62 23 83 12 13 91 61 82 0 59 82 6 67 24 37 4 61 2 6 31 12 21 37 47 39 44 85 92 16 66 39 48 69 57 62 75 7 87 68 89 44 77 69 12 6 19 31 30 2 14 90 30 37 67 5 88 53 59 3 1 45 75 82 59 27 51 0 85 65 57 75 74 53 35 44 87 86 77 52 35 23 87 87
0
1
2
...

output:

4 0

result:

ok single line: '4 0'

Test #8:

score: 12
Accepted
time: 4ms
memory: 15568kb

input:

2000 28
13 0 11 21 0 3 7 0 2 10 25 17 13 21 19 12 9 17 21 12 12 17 9 2 21 11 0 13 9 4 6 18 4 14 22 26 20 24 18 5 0 27 13 15 4 8 9 27 17 24 13 4 27 3 6 11 24 18 10 5 22 8 7 4 26 22 18 27 1 0 1 21 23 1 10 2 1 21 7 25 24 21 25 23 22 0 14 5 3 6 19 8 7 4 7 27 27 19 26 18 17 3 1 12 8 1 10 18 22 23 25 14 2...

output:

85 0

result:

ok single line: '85 0'

Test #9:

score: 12
Accepted
time: 54ms
memory: 32016kb

input:

100000 59066
10203 30163 14221 32641 57632 52742 51576 33938 17167 56268 10461 37834 58393 19522 10361 4859 50498 54209 40282 44610 7141 54240 58622 15568 57813 20977 23646 51685 16859 23152 37761 20080 6279 48735 39054 5181 35803 38656 7011 54044 4665 29269 39955 44267 6927 1328 56776 24684 2653 10...

output:

10 0

result:

ok single line: '10 0'

Test #10:

score: 12
Accepted
time: 0ms
memory: 16344kb

input:

100 2
0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1
0
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...

output:

50 0

result:

ok single line: '50 0'

Test #11:

score: 12
Accepted
time: 3ms
memory: 16468kb

input:

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

output:

1001 0

result:

ok single line: '1001 0'

Test #12:

score: 12
Accepted
time: 41ms
memory: 34860kb

input:

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

output:

50198 0

result:

ok single line: '50198 0'

Test #13:

score: 12
Accepted
time: 3ms
memory: 14744kb

input:

100 100
14 93 75 59 44 2 61 56 89 75 70 53 50 78 16 1 48 32 52 21 84 12 75 52 39 89 88 29 71 69 18 0 19 20 66 23 55 99 42 63 46 2 93 23 40 13 64 32 51 47 34 13 95 48 23 55 20 21 87 46 62 7 69 98 66 77 66 16 85 70 2 51 9 9 37 89 85 72 59 13 14 69 4 78 56 84 63 40 35 90 93 44 66 32 25 80 93 99 40 39
0...

output:

4 0

result:

ok single line: '4 0'

Test #14:

score: 12
Accepted
time: 0ms
memory: 15556kb

input:

2000 2000
68 392 1223 140 162 1107 45 1894 1544 255 840 1756 173 1277 1932 1230 1774 932 1637 935 1554 1296 917 158 707 1350 297 1763 1374 1778 637 1079 726 1514 485 678 288 1595 1529 296 414 1803 816 1419 962 1234 521 277 1353 1679 1472 249 1083 1539 442 1925 442 114 116 790 1246 649 15 145 1622 36...

output:

6 0

result:

ok single line: '6 0'

Test #15:

score: 12
Accepted
time: 42ms
memory: 32720kb

input:

100000 100000
41728 93320 38571 44676 59528 37978 81336 71690 19433 62851 10920 32382 57235 11051 54769 96948 26321 8339 26066 61016 79074 40324 13106 94743 16700 60377 60008 60349 77853 65660 4887 16582 91933 4573 43258 30974 68341 21985 25073 6706 28676 32064 29269 78970 28685 53456 23597 67768 65...

output:

8 0

result:

ok single line: '8 0'

Test #16:

score: 12
Accepted
time: 0ms
memory: 14572kb

input:

5 3
0 1 2 2 1
0
1
2
3

output:

2 0

result:

ok single line: '2 0'

Subtask #2:

score: 19
Accepted

Test #17:

score: 19
Accepted
time: 0ms
memory: 15648kb

input:

1 1
0

output:

1 0

result:

ok single line: '1 0'

Test #18:

score: 19
Accepted
time: 2ms
memory: 15272kb

input:

5 2
0 1 0 0 0
0
1
2
3

output:

4 0

result:

ok single line: '4 0'

Test #19:

score: 19
Accepted
time: 0ms
memory: 15264kb

input:

100 2
0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1
0
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...

output:

50 0

result:

ok single line: '50 0'

Test #20:

score: 19
Accepted
time: 3ms
memory: 16028kb

input:

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

output:

1001 0

result:

ok single line: '1001 0'

Test #21:

score: 19
Accepted
time: 31ms
memory: 34656kb

input:

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

output:

50198 0

result:

ok single line: '50198 0'

Test #22:

score: 19
Accepted
time: 4ms
memory: 15980kb

input:

99 2
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
65
53
0
0
41
0
59
26
87
78
62
23
52
0
97
0
0
90
0
4
77
55
0
73
45
0
19
92
32
0
0
0
82
48
60
54
72...

output:

2 0

result:

ok single line: '2 0'

Test #23:

score: 19
Accepted
time: 3ms
memory: 15428kb

input:

1999 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 0 0 0...

output:

2 0

result:

ok single line: '2 0'

Test #24:

score: 19
Accepted
time: 42ms
memory: 23128kb

input:

99999 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 0 0 ...

output:

2 0

result:

ok single line: '2 0'

Test #25:

score: 19
Accepted
time: 3ms
memory: 14680kb

input:

100 2
1 1 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 1 1 0 1 0
68
34
15
37
60
98
14
80
81
1
94
60
1
45
55
5
29
93
55
41
54
54
96
70
2
32
62
94
15
37
41
90
68...

output:

51 0

result:

ok single line: '51 0'

Test #26:

score: 19
Accepted
time: 0ms
memory: 16636kb

input:

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

output:

1001 0

result:

ok single line: '1001 0'

Test #27:

score: 19
Accepted
time: 59ms
memory: 30624kb

input:

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

output:

50001 0

result:

ok single line: '50001 0'

Test #28:

score: 19
Accepted
time: 20ms
memory: 22940kb

input:

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

output:

7 2

result:

ok single line: '7 2'

Test #29:

score: 19
Accepted
time: 0ms
memory: 15700kb

input:

10 2
1 1 1 1 0 1 1 1 1 0
8
8
8
3
9
0
9
0
0

output:

8 0

result:

ok single line: '8 0'

Test #30:

score: 19
Accepted
time: 0ms
memory: 15912kb

input:

100 2
0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 0 1 1 0 1 0 1
27
11
39
3
90
87
91
49
39
95
91
49
89
15
64
27
85
38
43
86
51
28
51
64
54
28
69
87
4
54
27
24
...

output:

46 0

result:

ok single line: '46 0'

Test #31:

score: 19
Accepted
time: 62ms
memory: 23716kb

input:

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

output:

50040 0

result:

ok single line: '50040 0'

Test #32:

score: 19
Accepted
time: 71ms
memory: 23856kb

input:

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

output:

50006 0

result:

ok single line: '50006 0'

Test #33:

score: 19
Accepted
time: 0ms
memory: 16092kb

input:

100 2
1 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1
47
84
42
64
90
84
0
84
7
56
35
59
80
98
16
73
56
7
47
33
6
16
24
70
97
3
22
8
19
18
97
7
84
79...

output:

47 12

result:

ok single line: '47 12'

Test #34:

score: 19
Accepted
time: 0ms
memory: 14892kb

input:

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

output:

1127 147

result:

ok single line: '1127 147'

Test #35:

score: 19
Accepted
time: 57ms
memory: 23836kb

input:

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

output:

39105 5115

result:

ok single line: '39105 5115'

Test #36:

score: 19
Accepted
time: 64ms
memory: 23544kb

input:

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

output:

61321 12576

result:

ok single line: '61321 12576'

Test #37:

score: 19
Accepted
time: 65ms
memory: 23972kb

input:

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

output:

75885 8789

result:

ok single line: '75885 8789'

Test #38:

score: 19
Accepted
time: 3ms
memory: 16628kb

input:

4 2
0 1 0 0
0
0
1

output:

3 0

result:

ok single line: '3 0'

Subtask #3:

score: 0
Wrong Answer

Test #39:

score: 27
Accepted
time: 4ms
memory: 16192kb

input:

1 1
0

output:

1 0

result:

ok single line: '1 0'

Test #40:

score: 27
Accepted
time: 3ms
memory: 14856kb

input:

5 2
0 1 0 0 0
0
1
2
3

output:

4 0

result:

ok single line: '4 0'

Test #41:

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

input:

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

output:

3 0

result:

ok single line: '3 0'

Test #42:

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

input:

15 8
3 6 7 6 7 6 6 0 6 7 3 6 2 3 3
0
1
2
3
4
5
6
7
8
9
10
11
12
13

output:

6 0

result:

ok single line: '6 0'

Test #43:

score: 27
Accepted
time: 3ms
memory: 15936kb

input:

7 3
1 1 1 2 1 0 1
0
1
2
3
4
5

output:

5 0

result:

ok single line: '5 0'

Test #44:

score: 27
Accepted
time: 3ms
memory: 15792kb

input:

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

output:

2 0

result:

ok single line: '2 0'

Test #45:

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

input:

100 97
73 42 17 20 20 71 6 52 18 93 34 27 96 35 77 27 46 62 23 83 12 13 91 61 82 0 59 82 6 67 24 37 4 61 2 6 31 12 21 37 47 39 44 85 92 16 66 39 48 69 57 62 75 7 87 68 89 44 77 69 12 6 19 31 30 2 14 90 30 37 67 5 88 53 59 3 1 45 75 82 59 27 51 0 85 65 57 75 74 53 35 44 87 86 77 52 35 23 87 87
0
1
2
...

output:

4 0

result:

ok single line: '4 0'

Test #46:

score: 27
Accepted
time: 56ms
memory: 32100kb

input:

100000 59066
10203 30163 14221 32641 57632 52742 51576 33938 17167 56268 10461 37834 58393 19522 10361 4859 50498 54209 40282 44610 7141 54240 58622 15568 57813 20977 23646 51685 16859 23152 37761 20080 6279 48735 39054 5181 35803 38656 7011 54044 4665 29269 39955 44267 6927 1328 56776 24684 2653 10...

output:

10 0

result:

ok single line: '10 0'

Test #47:

score: 27
Accepted
time: 3ms
memory: 15308kb

input:

100 100
14 93 75 59 44 2 61 56 89 75 70 53 50 78 16 1 48 32 52 21 84 12 75 52 39 89 88 29 71 69 18 0 19 20 66 23 55 99 42 63 46 2 93 23 40 13 64 32 51 47 34 13 95 48 23 55 20 21 87 46 62 7 69 98 66 77 66 16 85 70 2 51 9 9 37 89 85 72 59 13 14 69 4 78 56 84 63 40 35 90 93 44 66 32 25 80 93 99 40 39
0...

output:

4 0

result:

ok single line: '4 0'

Test #48:

score: 27
Accepted
time: 2ms
memory: 16696kb

input:

2000 2000
68 392 1223 140 162 1107 45 1894 1544 255 840 1756 173 1277 1932 1230 1774 932 1637 935 1554 1296 917 158 707 1350 297 1763 1374 1778 637 1079 726 1514 485 678 288 1595 1529 296 414 1803 816 1419 962 1234 521 277 1353 1679 1472 249 1083 1539 442 1925 442 114 116 790 1246 649 15 145 1622 36...

output:

6 0

result:

ok single line: '6 0'

Test #49:

score: 27
Accepted
time: 59ms
memory: 32356kb

input:

100000 100000
41728 93320 38571 44676 59528 37978 81336 71690 19433 62851 10920 32382 57235 11051 54769 96948 26321 8339 26066 61016 79074 40324 13106 94743 16700 60377 60008 60349 77853 65660 4887 16582 91933 4573 43258 30974 68341 21985 25073 6706 28676 32064 29269 78970 28685 53456 23597 67768 65...

output:

8 0

result:

ok single line: '8 0'

Test #50:

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

input:

10 2
1 1 1 1 0 1 1 1 1 0
8
8
8
3
9
0
9
0
0

output:

8 0

result:

ok single line: '8 0'

Test #51:

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

input:

12 8
1 4 0 5 4 1 7 1 2 6 3 1
0
10
9
10
11
7
0
2
0
0
10

output:

4 0

result:

ok single line: '4 0'

Test #52:

score: 27
Accepted
time: 2ms
memory: 14992kb

input:

11 7
2 2 5 0 6 2 5 5 5 5 4
2
10
5
0
7
10
0
7
10
0

output:

3 0

result:

ok single line: '3 0'

Test #53:

score: 27
Accepted
time: 3ms
memory: 15568kb

input:

2000 1214
94 1026 161 676 277 317 994 521 763 1177 1070 228 1083 290 423 642 328 179 713 1180 730 234 70 170 1092 1198 796 819 119 488 743 526 1011 1010 1181 804 994 386 991 1027 739 266 218 1171 697 569 682 891 40 560 377 946 996 653 42 270 43 359 107 771 389 208 419 44 559 870 562 673 451 955 61 1...

output:

7 6

result:

ok single line: '7 6'

Test #54:

score: 27
Accepted
time: 4ms
memory: 15648kb

input:

2000 367
240 338 214 215 327 33 32 206 53 269 186 47 319 131 343 20 146 101 324 327 213 183 148 96 44 2 305 114 170 199 278 4 285 272 108 96 265 284 123 84 285 343 174 52 363 211 62 200 182 192 189 204 22 291 129 131 43 177 36 144 346 356 74 336 258 107 363 259 203 356 32 142 301 284 73 362 257 28 2...

output:

9 6

result:

ok single line: '9 6'

Test #55:

score: 27
Accepted
time: 4ms
memory: 16176kb

input:

2000 1709
1485 645 329 201 238 168 1571 1439 1324 326 889 1583 529 384 621 412 1318 1440 867 1455 944 1383 850 862 376 1565 747 631 1115 1358 676 1599 673 261 1461 1078 205 110 133 938 368 618 1097 771 1085 840 124 873 19 1692 653 1145 1347 225 380 1581 475 758 1190 645 1163 1529 862 423 292 1467 14...

output:

4 3

result:

ok single line: '4 3'

Test #56:

score: 0
Wrong Answer
time: 70ms
memory: 21572kb

input:

100000 75391
6003 72241 28741 19704 62287 24690 41725 29510 57883 38477 33470 4992 35443 46446 51948 19117 63206 70119 59682 17977 17585 63767 27706 24382 5246 12260 21715 30157 71722 52898 17011 8901 11539 24958 24021 62637 49016 39312 43249 47312 34246 42988 54094 15067 35673 17443 54173 74045 177...

output:

6 5

result:

wrong answer 1st lines differ - expected: '5 4', found: '6 5'

Subtask #4:

score: 0
Wrong Answer

Test #76:

score: 23
Accepted
time: 4ms
memory: 15496kb

input:

1 1
0

output:

1 0

result:

ok single line: '1 0'

Test #77:

score: 23
Accepted
time: 4ms
memory: 16156kb

input:

5 2
0 1 0 0 0
0
1
2
3

output:

4 0

result:

ok single line: '4 0'

Test #78:

score: 23
Accepted
time: 0ms
memory: 15728kb

input:

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

output:

3 0

result:

ok single line: '3 0'

Test #79:

score: 23
Accepted
time: 3ms
memory: 15412kb

input:

15 8
3 6 7 6 7 6 6 0 6 7 3 6 2 3 3
0
1
2
3
4
5
6
7
8
9
10
11
12
13

output:

6 0

result:

ok single line: '6 0'

Test #80:

score: 23
Accepted
time: 0ms
memory: 14632kb

input:

7 3
1 1 1 2 1 0 1
0
1
2
3
4
5

output:

5 0

result:

ok single line: '5 0'

Test #81:

score: 23
Accepted
time: 2ms
memory: 14972kb

input:

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

output:

2 0

result:

ok single line: '2 0'

Test #82:

score: 23
Accepted
time: 0ms
memory: 16264kb

input:

100 97
73 42 17 20 20 71 6 52 18 93 34 27 96 35 77 27 46 62 23 83 12 13 91 61 82 0 59 82 6 67 24 37 4 61 2 6 31 12 21 37 47 39 44 85 92 16 66 39 48 69 57 62 75 7 87 68 89 44 77 69 12 6 19 31 30 2 14 90 30 37 67 5 88 53 59 3 1 45 75 82 59 27 51 0 85 65 57 75 74 53 35 44 87 86 77 52 35 23 87 87
0
1
2
...

output:

4 0

result:

ok single line: '4 0'

Test #83:

score: 23
Accepted
time: 4ms
memory: 15372kb

input:

2000 28
13 0 11 21 0 3 7 0 2 10 25 17 13 21 19 12 9 17 21 12 12 17 9 2 21 11 0 13 9 4 6 18 4 14 22 26 20 24 18 5 0 27 13 15 4 8 9 27 17 24 13 4 27 3 6 11 24 18 10 5 22 8 7 4 26 22 18 27 1 0 1 21 23 1 10 2 1 21 7 25 24 21 25 23 22 0 14 5 3 6 19 8 7 4 7 27 27 19 26 18 17 3 1 12 8 1 10 18 22 23 25 14 2...

output:

85 0

result:

ok single line: '85 0'

Test #84:

score: 23
Accepted
time: 0ms
memory: 16160kb

input:

100 2
0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 1 1 0 1
0
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...

output:

50 0

result:

ok single line: '50 0'

Test #85:

score: 23
Accepted
time: 0ms
memory: 14900kb

input:

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

output:

1001 0

result:

ok single line: '1001 0'

Test #86:

score: 23
Accepted
time: 3ms
memory: 15904kb

input:

100 100
14 93 75 59 44 2 61 56 89 75 70 53 50 78 16 1 48 32 52 21 84 12 75 52 39 89 88 29 71 69 18 0 19 20 66 23 55 99 42 63 46 2 93 23 40 13 64 32 51 47 34 13 95 48 23 55 20 21 87 46 62 7 69 98 66 77 66 16 85 70 2 51 9 9 37 89 85 72 59 13 14 69 4 78 56 84 63 40 35 90 93 44 66 32 25 80 93 99 40 39
0...

output:

4 0

result:

ok single line: '4 0'

Test #87:

score: 23
Accepted
time: 0ms
memory: 15848kb

input:

2000 2000
68 392 1223 140 162 1107 45 1894 1544 255 840 1756 173 1277 1932 1230 1774 932 1637 935 1554 1296 917 158 707 1350 297 1763 1374 1778 637 1079 726 1514 485 678 288 1595 1529 296 414 1803 816 1419 962 1234 521 277 1353 1679 1472 249 1083 1539 442 1925 442 114 116 790 1246 649 15 145 1622 36...

output:

6 0

result:

ok single line: '6 0'

Test #88:

score: 23
Accepted
time: 0ms
memory: 15228kb

input:

99 2
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
65
53
0
0
41
0
59
26
87
78
62
23
52
0
97
0
0
90
0
4
77
55
0
73
45
0
19
92
32
0
0
0
82
48
60
54
72...

output:

2 0

result:

ok single line: '2 0'

Test #89:

score: 23
Accepted
time: 0ms
memory: 16492kb

input:

1999 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 0 0 0...

output:

2 0

result:

ok single line: '2 0'

Test #90:

score: 23
Accepted
time: 3ms
memory: 14948kb

input:

100 2
1 1 1 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 0 1 0 0 1 1 1 1 0 1 0
68
34
15
37
60
98
14
80
81
1
94
60
1
45
55
5
29
93
55
41
54
54
96
70
2
32
62
94
15
37
41
90
68...

output:

51 0

result:

ok single line: '51 0'

Test #91:

score: 23
Accepted
time: 0ms
memory: 16492kb

input:

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

output:

1001 0

result:

ok single line: '1001 0'

Test #92:

score: 23
Accepted
time: 2ms
memory: 15424kb

input:

10 2
1 1 1 1 0 1 1 1 1 0
8
8
8
3
9
0
9
0
0

output:

8 0

result:

ok single line: '8 0'

Test #93:

score: 23
Accepted
time: 0ms
memory: 16400kb

input:

100 2
0 0 1 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 0 0 1 0 0 0 0 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 0 1 1 0 1 0 1
27
11
39
3
90
87
91
49
39
95
91
49
89
15
64
27
85
38
43
86
51
28
51
64
54
28
69
87
4
54
27
24
...

output:

46 0

result:

ok single line: '46 0'

Test #94:

score: 23
Accepted
time: 3ms
memory: 14648kb

input:

100 2
1 1 0 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 0 1
47
84
42
64
90
84
0
84
7
56
35
59
80
98
16
73
56
7
47
33
6
16
24
70
97
3
22
8
19
18
97
7
84
79...

output:

47 12

result:

ok single line: '47 12'

Test #95:

score: 23
Accepted
time: 0ms
memory: 16468kb

input:

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

output:

1127 147

result:

ok single line: '1127 147'

Test #96:

score: 23
Accepted
time: 2ms
memory: 14592kb

input:

12 8
1 4 0 5 4 1 7 1 2 6 3 1
0
10
9
10
11
7
0
2
0
0
10

output:

4 0

result:

ok single line: '4 0'

Test #97:

score: 23
Accepted
time: 3ms
memory: 16400kb

input:

11 7
2 2 5 0 6 2 5 5 5 5 4
2
10
5
0
7
10
0
7
10
0

output:

3 0

result:

ok single line: '3 0'

Test #98:

score: 23
Accepted
time: 0ms
memory: 15932kb

input:

2000 1214
94 1026 161 676 277 317 994 521 763 1177 1070 228 1083 290 423 642 328 179 713 1180 730 234 70 170 1092 1198 796 819 119 488 743 526 1011 1010 1181 804 994 386 991 1027 739 266 218 1171 697 569 682 891 40 560 377 946 996 653 42 270 43 359 107 771 389 208 419 44 559 870 562 673 451 955 61 1...

output:

7 6

result:

ok single line: '7 6'

Test #99:

score: 23
Accepted
time: 0ms
memory: 16056kb

input:

2000 367
240 338 214 215 327 33 32 206 53 269 186 47 319 131 343 20 146 101 324 327 213 183 148 96 44 2 305 114 170 199 278 4 285 272 108 96 265 284 123 84 285 343 174 52 363 211 62 200 182 192 189 204 22 291 129 131 43 177 36 144 346 356 74 336 258 107 363 259 203 356 32 142 301 284 73 362 257 28 2...

output:

9 6

result:

ok single line: '9 6'

Test #100:

score: 23
Accepted
time: 0ms
memory: 14924kb

input:

2000 1709
1485 645 329 201 238 168 1571 1439 1324 326 889 1583 529 384 621 412 1318 1440 867 1455 944 1383 850 862 376 1565 747 631 1115 1358 676 1599 673 261 1461 1078 205 110 133 938 368 618 1097 771 1085 840 124 873 19 1692 653 1145 1347 225 380 1581 475 758 1190 645 1163 1529 862 423 292 1467 14...

output:

4 3

result:

ok single line: '4 3'

Test #101:

score: 23
Accepted
time: 4ms
memory: 15392kb

input:

1998 669
546 478 393 533 544 272 556 644 418 224 101 256 640 356 503 299 319 13 256 422 107 502 137 364 553 141 383 20 629 111 83 415 107 226 576 634 473 508 429 191 479 270 492 608 534 622 329 10 56 192 603 148 198 125 140 266 449 437 385 169 275 182 306 391 21 231 453 99 518 252 82 371 599 231 129...

output:

2 1

result:

ok single line: '2 1'

Test #102:

score: 23
Accepted
time: 2ms
memory: 15712kb

input:

2000 1290
328 751 977 533 1230 32 440 804 902 68 1058 32 47 25 390 1177 943 977 1010 811 1031 59 942 394 331 57 814 683 547 589 33 1262 862 380 709 1127 430 749 888 749 813 43 844 606 590 980 70 868 708 337 1099 1079 1086 708 684 1279 1129 55 365 433 966 461 1184 263 1165 489 512 183 402 930 886 850...

output:

6 0

result:

ok single line: '6 0'

Test #103:

score: 23
Accepted
time: 4ms
memory: 15744kb

input:

2000 1371
1036 382 1132 1054 337 509 1027 490 1363 135 782 1204 136 976 1132 1299 683 611 1226 235 706 166 7 808 1310 1245 528 148 513 830 1033 883 1170 248 947 857 1000 864 1103 121 717 231 954 1261 1199 341 837 1101 1065 48 392 1117 1014 8 233 840 582 91 1073 405 251 44 1283 193 924 356 379 468 13...

output:

5 4

result:

ok single line: '5 4'

Test #104:

score: 0
Wrong Answer
time: 3ms
memory: 15076kb

input:

2000 1911
1372 1087 544 1695 405 1466 1459 1528 1728 424 99 791 1717 788 1117 1652 627 1393 1432 1562 920 1406 744 61 1516 1758 439 762 1822 1640 1834 507 938 1658 1495 1533 425 510 1392 873 1370 1370 755 696 943 1709 1558 115 695 194 409 808 976 32 306 515 429 408 281 1532 702 1060 627 1289 598 600...

output:

5 4

result:

wrong answer 1st lines differ - expected: '4 2', found: '5 4'

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%