이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "supertrees.h"
#include<bits/stdc++.h>
using namespace std;
int a,c,d,e,i,j,ii,jj,zx,xc,msh[1009],ka[1009];
int bo[1009],k[1009][1009],cnt;
int B[1009][1009];
vector <int> v[1009],vv[1009];
vector <vector <int> > ans;
int fnd(int q){
if(msh[q]==-1) return q; else msh[q]=fnd(msh[q]);
}
void mrg(int q, int w){
q=fnd(q);w=fnd(w);
if(q==w) return;
if(ka[q]<ka[w]) swap(q,w);
msh[w]=q;
if(ka[q]==ka[w]) ka[q]++;
}
int construct(vector <vector <int> > A) {
a = A.size();
for(i=0; i<a; i++){
for(j=0; j<a; j++){
if(A[i][j]==3){
return 0;
}
}
}
for(i=0; i<a; i++){
msh[i]=-1;ka[i]=1;
}
for(i=0; i<a; i++){
for(j=i+1; j<a; j++){
if(A[i][j]==1){
mrg(i,j);
}
}
}
/*for(i=0; i<a; i++){
fnd(i);
if(i!=msh[i]){
B[i][msh[i]]=1;
B[msh[i]][i]=1;
v[i].push_back(msh[i]);
v[msh[i]].push_back(i);
}
}/*
/*for(i=0; i<a; i++){
msh2[i]=i;zm2[i]=1;
}
for(i=0; i<a; i++){
for(j=i+1; j<a; j++){
if(A[i][j]==2){
mrg2(msh[i],msh[j]);
}
}
}
for(i=0; i<a; i++){
fnd2(i);
vv[msh2[i]].push_back(i);
}
for(i=0; i<a; i++){
if(vv[i].size()>1){
for(j=0; j<vv[i].size(); j++){
jj=j-1;if(jj<0) jj=vv[i].size()-1;
B[vv[i][j]][vv[i][jj]]=1;
B[vv[i][jj]][vv[i][j]]=1;
v[vv[i][j]].push_back(vv[i][jj]);
v[vv[i][jj]].push_back(vv[i][j]);
}
}
}
for(i=0; i<a; i++){
cnt++;
dfs(i);
for(j=0; j<a; j++){
if(k[i][j]!=A[i][j]){
return 0;
}
}
}*/
for(i=0; i<a; i++){
vector <int> va;
for(j=0; j<a; j++){
if((i==0&&j!=0)||(i!=0&&j==0)){
B[i][j]=1;
}else{
B[i][j]=0;
}
va.push_back(B[i][j]);
}
ans.push_back(va);
}
build(ans);
return 1;
}
컴파일 시 표준 에러 (stderr) 메시지
supertrees.cpp:46:3: warning: "/*" within comment [-Wcomment]
46 | }/*
|
supertrees.cpp:47:2: warning: "/*" within comment [-Wcomment]
47 | /*for(i=0; i<a; i++){
|
supertrees.cpp: In function 'int fnd(int)':
supertrees.cpp:10:38: warning: control reaches end of non-void function [-Wreturn-type]
10 | if(msh[q]==-1) return q; else msh[q]=fnd(msh[q]);
| ~~~~~~^~~~~~~~~~~~
# | 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... |