제출 #722674

#제출 시각아이디문제언어결과실행 시간메모리
722674bin9638수천개의 섬 (IOI22_islands)C++17
10.85 / 100
37 ms7496 KiB
#include <bits/stdc++.h> #ifndef SKY #include "islands.h" #endif // SKY using namespace std; #define N 100010 #define ll long long #define fs first #define sc second #define ii pair<int,int> #define pb push_back int n,m,ktr[N]; vector<int>g[N]; void DFS(int u) { ktr[u]=1; for(auto v:g[u]) if(ktr[v]==0) DFS(v); } #ifdef SKY vector<int> #endif // SKY #ifndef SKY variant<bool, vector<int>> #endif // SKY find_journey(int NNN, int MMM, vector<int> canh_fs, vector<int> canh_sc) { n=NNN; m=MMM; for(int i=0;i<m;i++) { int u=canh_fs[i],v=canh_sc[i]; g[u].pb(v); } if(n==2) { if(g[0].size()>=2&&g[1].size()>=1) { return #ifdef SKY {1}; #endif // SKY #ifndef SKY true; #endif // SKY }else { return #ifdef SKY {0}; #endif // SKY #ifndef SKY false; #endif // SKY } } if(g[0].size()>=2) { return #ifdef SKY {1}; #endif // SKY #ifndef SKY true; #endif // SKY } DFS(0); for(int i=1;i<n;i++) if(ktr[i]==1&&g[i].size()>=3) { return #ifdef SKY {1}; #endif // SKY #ifndef SKY true; #endif // SKY } return #ifdef SKY {0}; #endif // SKY #ifndef SKY false; #endif // SKY } #ifdef SKY int main() { freopen("A.inp","r",stdin); freopen("A.out","w",stdout); ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); return 0; } #endif
#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...