| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1334436 | x93bd0 | 9월 (APIO24_september) | C++20 | 1 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) {
int D[N], CC[N];
for (uint x = 0; x < N; x++)
D[x] = -1, CC[x] = 0;
D[0] = 0;
function<uint(uint)> dist = [&](uint n) -> uint {
if (D[n] != -1) return D[n];
CC[F[n]]++;
return D[n] = 1 + dist(F[n]);
};
for (uint x = 1; x < N; x++)
dist(x);
int K = 0;
vector<uint> C;
map<uint, uint> FLL;
set<uint> PR;
uint i = 0;
uint badfflst = 0, kilfs = 0;
while (i + 1 < N) {
for (uint x = 0; x < M; x++) {
if (!FLL[S[x][i]]) {
PR.insert(S[x][i]), badfflst++;
uint n = S[x][i];
while (PR.count(n)) {
CC[F[n]]--;
if (!CC[n])
kilfs++, n = F[n];
else break;
}
}
FLL[S[x][i]]++;
if (FLL[S[x][i]] == M) badfflst--;
}
if (!badfflst && kilfs == PR.size()) {
kilfs = 0;
PR.clear();
K++;
}
i++;
}
return K;
}| # | 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... | ||||
