QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#586141 | #9184. Team Coding | appear | 12 | 15ms | 34420kb | C++14 | 2.8kb | 2024-09-24 07:13:49 | 2024-09-24 07:13:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 2e3 + 5;
vector<int> g[N];
int n, k, id, mx, ans, maxx, col[N], f[N], dep[N], siz[N], dfn[N], c[M][M], d[M][M], cc[N], nw[M];
void dfs(int x, int fa){
c[dep[x]][col[x]]++;
mx = max(mx, dep[x]);
dfn[x] = ++id, siz[x] = 1;
for(int v : g[x]){
if(v != fa){
dep[v] = dep[x] + 1;
dfs(v, x);
siz[x] += siz[v];
}
}
}
void DFS(int x, int fa){
for(int v : g[x]){
if(v != fa) DFS(v, x);
}
for(int i = dep[x]; i <= mx; i++) nw[i] = 0;
for(int i = 1; i <= n; i++){
d[dep[i]][col[i]] = 0;
}
for(int i = 1; i <= n; i++){
if(dfn[i] >= dfn[x] && dfn[i] <= dfn[x] + siz[x] - 1){
nw[dep[i]]++;
d[dep[i]][col[i]]++;
}
}
int now = 1, sec = 0;
for(int i = dep[x] + 1; i <= mx; i++){
now += d[i][col[x]];
int tmp = min(nw[i], c[i][col[x]]) - d[i][col[x]];
now += tmp, sec += tmp;
}
if(now > ans) ans = now, maxx = sec;
else if(now == ans) maxx = min(maxx, sec);
}
bool Check(){
for(int i = 2; i <= n; i++){
if(f[i] != i - 1) return 0;
}
return 1;
}
vector<int> ttt19;
bool Check2(){
for(int i = 0; i <= k + 1; i++) ttt19.push_back(0);
for(int i = 1; i <= n; i++){
ttt19[col[i]]++;
if(ttt19[col[i]] > 50) return 0;
}
return 1;
}
vector<int> dd[N], ccc[N];
void DD(int x, int fa){
dep[x] = dep[fa] + 1;
dfn[x] = ++id, siz[x] = 1;
dd[dep[x]].push_back(dfn[x]);
ccc[col[x]].push_back(x);
for(int v : g[x]){
if(v != fa){
DD(v, x);
siz[x] += siz[v];
}
}
}
int query(int id, int l, int r){
return upper_bound(dd[id].begin(), dd[id].end(), r) - lower_bound(dd[id].begin(), dd[id].end(), l);
}
int t64[N];
void Solve(){
DD(1, 0);
ans = -1;
for(int i = 0; i <= k; i++){
for(int u : ccc[i]){
int now = 0, sec = 0;
for(int v : ccc[i]){
t64[dep[v]] = query(dep[v], dfn[u], dfn[u] + siz[u] - 1);
}
for(int v : ccc[i]){
if(t64[dep[v]]){
now++;
if(dfn[v] < dfn[u] || dfn[v] > dfn[u] + siz[u] - 1) t64[dep[v]]--, sec++;
}
}
if(now > ans) ans = now, maxx = sec;
else if(now == ans) maxx = min(maxx, sec);
}
}
cout << ans << ' ' << maxx;
}
int main(){
ios::sync_with_stdio(0), cin.tie(0);
cin >> n >> k;
for(int i = 1; i <= n; i++) cin >> col[i];
for(int i = 2; i <= n; i++){
cin >> f[i];
g[++f[i]].push_back(i);
}
if(Check()){
for(int i = n; i >= 1; i--){
cc[col[i]]++;
ans = max(ans, cc[col[i]]);
}
cout << ans << ' ' << 0;
return 0;
}
if(Check2()){
Solve();
return 0;
}
ans = -1;
dfs(1, 0);
DFS(1, 0);
cout << ans << ' ' << maxx;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 12
Accepted
Test #1:
score: 12
Accepted
time: 0ms
memory: 13612kb
input:
1 1 0
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 12
Accepted
time: 3ms
memory: 13664kb
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: 3ms
memory: 13664kb
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: 13640kb
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: 2ms
memory: 11604kb
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: 0ms
memory: 13720kb
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: 0ms
memory: 13732kb
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: 3ms
memory: 13796kb
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: 15ms
memory: 14820kb
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: 3ms
memory: 13664kb
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: 11748kb
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: 14ms
memory: 16844kb
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: 0ms
memory: 13724kb
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: 3ms
memory: 13712kb
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: 11ms
memory: 16996kb
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: 3ms
memory: 13732kb
input:
5 3 0 1 2 2 1 0 1 2 3
output:
2 0
result:
ok single line: '2 0'
Subtask #2:
score: 0
Time Limit Exceeded
Test #17:
score: 19
Accepted
time: 0ms
memory: 13776kb
input:
1 1 0
output:
1 0
result:
ok single line: '1 0'
Test #18:
score: 19
Accepted
time: 3ms
memory: 13736kb
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: 3ms
memory: 13732kb
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: 0ms
memory: 13840kb
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: 10ms
memory: 16792kb
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: 0ms
memory: 15700kb
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: 6ms
memory: 15824kb
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: 0
Time Limit Exceeded
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:
result:
Subtask #3:
score: 0
Wrong Answer
Test #39:
score: 27
Accepted
time: 3ms
memory: 13784kb
input:
1 1 0
output:
1 0
result:
ok single line: '1 0'
Test #40:
score: 27
Accepted
time: 3ms
memory: 13752kb
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: 13712kb
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: 13932kb
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: 13728kb
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: 0ms
memory: 13732kb
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: 2ms
memory: 13764kb
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: 7ms
memory: 16860kb
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: 0ms
memory: 13732kb
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: 3ms
memory: 13784kb
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: 7ms
memory: 16988kb
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: 13664kb
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: 3ms
memory: 15936kb
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: 0
Wrong Answer
time: 0ms
memory: 13664kb
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:
4 2
result:
wrong answer 1st lines differ - expected: '3 0', found: '4 2'
Subtask #4:
score: 0
Wrong Answer
Test #76:
score: 23
Accepted
time: 2ms
memory: 11680kb
input:
1 1 0
output:
1 0
result:
ok single line: '1 0'
Test #77:
score: 23
Accepted
time: 0ms
memory: 13664kb
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: 13716kb
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: 13732kb
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: 3ms
memory: 13780kb
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: 3ms
memory: 13724kb
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: 14100kb
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: 3ms
memory: 14064kb
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: 3ms
memory: 11680kb
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: 11676kb
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: 13832kb
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: 13796kb
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: 17832kb
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: 9ms
memory: 18176kb
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: 4ms
memory: 17816kb
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: 8ms
memory: 34420kb
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: 0ms
memory: 13732kb
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: 3ms
memory: 15788kb
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: 0ms
memory: 18032kb
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: 7ms
memory: 17856kb
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: 0ms
memory: 13724kb
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: 0
Wrong Answer
time: 3ms
memory: 13716kb
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:
4 2
result:
wrong answer 1st lines differ - expected: '3 0', found: '4 2'
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%