제출 #1311149

#제출 시각아이디문제언어결과실행 시간메모리
1311149vanguard9월 (APIO24_september)C++20
0 / 100
1 ms568 KiB
#include "september.h" #include <vector> int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) { std::vector<int> seen_count(N, 0); std::vector<int> child_count(N, 0); for (int i = 1; i < N; i++) { child_count[F[i]]++; } int unresolved = 0; int day_count = 0; for (int i = 0; i < N - 1; i++) { for (int j = 0; j < M; j++) { int node = S[j][i]; seen_count[node]++; if (seen_count[node] == 1) unresolved++; if (seen_count[node] == M) { unresolved--; int curr = node; while (curr != 0) { int parent = F[curr]; child_count[parent]--; if (child_count[parent] == 0 && (parent == 0 || seen_count[parent] == M)) { curr = parent; } else { break; } } } } if (unresolved == 0) { day_count++; } } return day_count; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...