제출 #1000775

#제출 시각아이디문제언어결과실행 시간메모리
1000775imarn9월 (APIO24_september)C++17
0 / 100
1 ms2652 KiB
#include<bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC target("avx2") #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define plx pair<ll,int> #define f first #define s second #define pb push_back #define all(x) x.begin(),x.end() #define vi vector<int> #define vl vector<ll> #define vvi vector<vi> using namespace std; const int mxn=1e5+5; vector<int>g[mxn]; bool vis[mxn]{0}; int cnt[6]{0}; void dfs(int u){ vis[u]=1; for(int i=0;i<5;i++)cnt[i]++; for(auto v:g[u]){ if(!vis[v])dfs(v); } } int solve(int N, int M, std::vector<int> F, std::vector<std::vector<int>> S){ for(int i=1;i<N;i++)g[F[i]].pb(i); int ans=0; for(int i=0;i<N-1;i++){ for(int j=0;j<M;j++){ if(!vis[S[j][i]])dfs(S[j][i]); if(vis[S[j][i]])cnt[j]--; }bool ch=0; for(int j=0;j<M;j++)if(cnt[j]!=0)ch=1; if(!ch)ans++; } return ans; }
#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...