# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1046589 | gry3125 | September (APIO24_september) | C++17 | 120 ms | 10452 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 solve(int N, int M, vector<int> F, vector<vector<int>> S) {
vector<int> leafs(N);
for (int i = 1; i < N; i++) {
leafs[F[i]] += M;
}
set<int> uwu, hasleaf;
int size = 0;
int k = 0;
for (int i = 0; i < N-1; i++) {
size++;
for (int j = 0; j < M; j++) {
uwu.insert(S[j][i]);
hasleaf.insert(S[j][i]);
leafs[F[S[j][i]]]--;
if (leafs[S[j][i]] == 0) {
hasleaf.erase(S[j][i]);
}
if (leafs[F[S[j][i]]] == 0) {
hasleaf.erase(F[S[j][i]]);
}
}
if (uwu.size() == size && hasleaf.size() == 0) {
size = 0;
uwu.clear();
k++;
}
}
return k;
}
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... |