# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1078937 | Hanksburger | September (APIO24_september) | C++17 | 104 ms | 10344 KiB |
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 "september.h"
#include <bits/stdc++.h>
using namespace std;
int deg[100005];
set<int> s;
int solve(int n, int m, vector<int> p, vector<vector<int> > a)
{
for (int i=0; i<n; i++)
deg[i]=0;
for (int i=1; i<n; i++)
deg[p[i]]++;
int cnt=0;
for (int i=0; i<a[0].size(); i++)
{
int u=a[0][i];
if (!deg[u])
{
deg[p[u]]--;
while (!deg[p[u]] && s.find(p[u])!=s.end())
{
u=p[u];
s.erase(u);
deg[p[u]]--;
}
}
else
s.insert(u);
if (s.empty())
cnt++;
}
return cnt;
}
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |