# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
467559 | couplefire | Izlet (COI19_izlet) | C++17 | 847 ms | 74772 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 3005;
int _, n, grid[N][N], fa[N], ans[N], top;
vector<int> adj[N]; bool vis[N];
vector<array<int, 2>> edges;
int find(int v){return v==fa[v]?v:fa[v]=find(fa[v]);}
void unite(int u, int v){
int tu = find(u), tv = find(v);
if(tu==tv) return;
fa[tu] = tv;
adj[u].push_back(v);
adj[v].push_back(u);
edges.push_back({u, v});
}
bool dfs2(int v, int p, int a, int b){
if(grid[a][v]==grid[b][v]){ans[a] = ans[v]; return 1;}
for(auto u : adj[v])
if(vis[u] && u!=p)
if(dfs2(u, v, a, b)) return 1;
return 0;
}
void dfs1(int v, int p){
vis[v] = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |