QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#32209 | #2569. Kill All Termites | RobeZH# | WA | 5ms | 6104kb | C++ | 496b | 2022-05-18 01:38:59 | 2022-05-18 01:39:38 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
typedef vector<int> vi;
const int N = (int)1e5 + 50;
int n;
vi G[N];
int deg[N];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
rep(i, 1, n) {
int p;
cin >> p; p--;
deg[p]++;
deg[i]++;
}
int res = 0;
rep(i, 0, n) res += deg[i] > 2;
res = max(res, 1);
cout << res << '\n';
}
详细
Test #1:
score: 100
Accepted
time: 4ms
memory: 5952kb
input:
1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 5936kb
input:
2 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 4ms
memory: 5980kb
input:
8 1 1 2 1 2 3 2
output:
2
result:
ok 1 number(s): "2"
Test #4:
score: 0
Accepted
time: 4ms
memory: 6004kb
input:
3 1 1
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 4ms
memory: 5956kb
input:
4 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 1ms
memory: 6016kb
input:
5 1 1 1 1
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 5932kb
input:
6 1 2 2 2 1
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 4ms
memory: 5948kb
input:
7 1 2 1 4 3 4
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 2ms
memory: 6104kb
input:
9 1 1 2 3 1 4 2 7
output:
2
result:
ok 1 number(s): "2"
Test #10:
score: 0
Accepted
time: 5ms
memory: 5956kb
input:
10 1 2 3 3 1 2 3 7 9
output:
2
result:
ok 1 number(s): "2"
Test #11:
score: -100
Wrong Answer
time: 0ms
memory: 5924kb
input:
11 1 1 2 1 5 6 7 3 3 2
output:
3
result:
wrong answer 1st numbers differ - expected: '2', found: '3'