제출 #837504

#제출 시각아이디문제언어결과실행 시간메모리
837504NothingXD수천개의 섬 (IOI22_islands)C++17
1.75 / 100
27 ms7532 KiB
#include "islands.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; void debug_out(){cerr<<endl;} template<typename Head, typename... Tail> void debug_out(Head H, Tail... T){ cerr << H << ' '; debug_out(T...); } #define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__) #define F first #define S second #define all(x) x.begin(), x.end() #define MP(x, y) make_pair(x, y) const int maxn = 1e5 + 10; int n, m, h[maxn]; vector<pii> g[maxn]; bool vis[maxn]; bool dfs(int v, int p = -1){ int cnt = g[v].size(); if (p != -1) cnt--; if (cnt == 2) return true; vis[v] = true; for (auto [u, w]: g[v]){ if (!vis[u]){ h[u] = h[v] + 1; if (dfs(u, w)) return true; } else if (w != p && h[u] < h[v]){ // debug(v, u); return true; } } return false; } std::variant<bool, std::vector<int>> find_journey( int N, int M, std::vector<int> U, std::vector<int> V) { //if (n < 2) n = N, m = M; for (int i = 0; i < m; i++){ g[U[i]].push_back({V[i], i/2}); } return (g[0].size() >= 2 && g[1].size() >= 2); }
#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...