이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "september.h"
#include<bits/stdc++.h>
using namespace std;
int rem=0;
struct tree{
vector<int>adj[100005];
int vis[100005];
void dfs_add(int u,int p=-1){
if(vis[u])return;
rem++;
vis[u]=1;
for(auto v:adj[u])dfs_add(v,u);
}
void remove(int u){
rem--;
}
}tr[10];
int solve(int N, int M, vector<int> F, vector<vector<int>> S) {
for(int i=0;i<M;i++){
for(int j=1;j<N;j++){
tr[i].adj[F[j]].push_back(j);
}
}
int ans=0;
for(int i=0;i<N-1;i++){
for(int j=0;j<M;j++){
tr[j].dfs_add(S[j][i]);
tr[j].remove(S[j][i]);
}
if(rem==0)ans++;
}
return ans;
}
# | 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... |