#include "supertrees.h"
#include <iostream>
#include <vector>
using namespace std;
const int N=1001;
vector<vector<int>>b;
int n,componente[N],cnt,root[N],modes[N][N];
bool viz[N];
void fa_dfs(int i)
{
viz[i]=true;
componente[i]=cnt;
for(int j=0; j<n; j++)
{
if(viz[j]==true)
continue;
if(modes[i][j]==1)
{
b[i][j]=1;
b[j][i]=1;
fa_dfs(j);
}
}
}
int construct(vector<vector<int>>p)
{
n=p.size();
b.resize(n);
for(int i=0;i<n;i++)
b[i].resize(n);
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
modes[i][j]=p[i][j];
for(int i=0; i<n; i++)
{
if(viz[i]==false)
{
cnt++;
viz[i]=true;
componente[i]=cnt;
fa_dfs(i);
}
}
build(b);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
3408 KB |
Output is correct |
7 |
Correct |
130 ms |
27976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
3408 KB |
Output is correct |
7 |
Correct |
130 ms |
27976 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
11 ms |
3408 KB |
Output is correct |
13 |
Correct |
118 ms |
27976 KB |
Output is correct |
14 |
Incorrect |
1 ms |
336 KB |
Answer gives possible 1 while actual possible 0 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Incorrect |
1 ms |
336 KB |
Answer gives possible 1 while actual possible 0 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Incorrect |
1 ms |
336 KB |
Too few ways to get from 0 to 1, should be 2 found 0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
3408 KB |
Output is correct |
7 |
Correct |
130 ms |
27976 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
11 ms |
3408 KB |
Output is correct |
13 |
Correct |
118 ms |
27976 KB |
Output is correct |
14 |
Incorrect |
1 ms |
336 KB |
Answer gives possible 1 while actual possible 0 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
3408 KB |
Output is correct |
7 |
Correct |
130 ms |
27976 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
11 ms |
3408 KB |
Output is correct |
13 |
Correct |
118 ms |
27976 KB |
Output is correct |
14 |
Incorrect |
1 ms |
336 KB |
Answer gives possible 1 while actual possible 0 |
15 |
Halted |
0 ms |
0 KB |
- |