This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
vector<int> a[MAXN];
int par[MAXN];
int indegree[MAXN];
int outdegree[MAXN];
int n, m, k;
pair<int, int> f[MAXN];
namespace sub2{
bool check(){
for (int i = 1; i <= m; i++){
if (outdegree[f[i].second] == 0){
return false;
}
}
return true;
}
void solve(){
cout << m << '\n';
}
}
namespace sub1{
bool check(){
return n <= 20 && k <= 20;
}
void solve(){
for (int i = 1; i <= n; i++){
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
for (int i = 2; i <= n; i++){
int x;
cin >> x;
a[x].push_back(i);
outdegree[x]++;
indegree[x]++;
}
for (int i = 1; i <= m; i++){
cin >> f[i].first >> f[i].second;
}
if (sub2::check()) sub2::solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |