# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
29789 | TAMREF | Ronald (COCI17_ronald) | C++11 | 63 ms | 3020 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mx=1005;
bool G[mx][mx];
int rep[mx<<1], sz[mx<<1], V, E;
inline int f(int x){return x==rep[x]?x:rep[x]=f(rep[x]);}
void c(int x,int y){
x=f(x), y=f(y);
if(sz[x]<sz[y]) swap(x,y);
sz[x]+=sz[y];
rep[y]=x;
}
void input(){
scanf("%d%d",&V,&E);
for(int i=0,a,b;i<E;i++){
scanf("%d%d",&a,&b);
G[a][b]=G[b][a]=true;
}
for(int i=1;i<=(V<<1);i++) rep[i]=i, sz[i]=1;
}
void unite(){
for(int i=1;i<=V;i++){
for(int j=1;j<i;j++){
if(G[i][j]){
c(i,j);
c(V+i,V+j);
}else{
c(i,V+j);
c(V+i,j);
}
}
}
}
bool det(){
for(int i=1;i<=V;i++) if(f(i)==f(V+i)) return false;
return true;
}
int main(){
input();
unite();
puts(det()?"DA":"NE");
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |