| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1366414 | hihi0908 | September (APIO24_september) | C++20 | 104 ms | 16096 KiB |
#include "september.h"
#include <bits/stdc++.h>
using namespace std;
void dfs(int u, vector<vector<int>> &G, vector<int> &mn, vector<int> &pos){
mn[u] = pos[u];
for(int &v : G[u]){
dfs(v, G, mn, pos);
mn[u] = max(mn[u], mn[v]);
}
}
int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S) {
vector<vector<int>> G(N);
for(int i = 0; i < N; i++){
if(F[i] == -1) continue;
G[F[i]].push_back(i);
}
int cnt = 0;
vector<int> pos(N, 0);
vector<int> mn(N);
for(int i = 0; i < M; i++){
for(int j = 0; j < N - 1; j++) pos[S[i][j]] = max(pos[S[i][j]], j);
}
dfs(0, G, mn, pos);
int r = 0;
for(int i = 0; i < N - 1; i++){
int t = N;
for(int j = 0; j < M; j++){
t = min(t, mn[S[j][i]]);
}
r = max(r, t);
if(r <= i) cnt++;
}
return cnt;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
