#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 7;
int nn, comp, used[N];
set < int > cmp[N];
void rec( int v, vector<std::vector<int>> p ) {
//cout << v << endl;
cmp[ comp ].insert(v);
used[v] = 1;
for ( int i = 0; i < nn; i++ ) {
if ( p[v][i] && !used[i] ) {
rec( i, p );
}
}
}
int construct(std::vector<std::vector<int>> p) {
nn = p.size();
std::vector<std::vector<int>> answer;
for (int i = 0; i < nn; i++) {
std::vector<int> row;
row.resize(nn);
answer.push_back(row);
}
for ( int i = 0; i < nn; i++ ) {
if ( used[i] ) {
continue;
}
comp++;
rec( i, p );
}
for ( int i = 1; i <= comp; i++ ) {
vector < int > vc;
for ( auto j: cmp[i] ) {
vc.push_back( j );
}
for ( int i = 0; i < (int)vc.size() - 1; i++ ) {
answer[ vc[i] ][ vc[i + 1] ] = 1;
answer[ vc[i + 1] ][ vc[i] ] = 1;
}
for ( auto x1: vc ) {
for ( auto x2: vc ) {
if ( !p[x1][x2] ) {
return 0;
}
}
}
}
build(answer);
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
32 ms |
33844 KB |
Output is correct |
7 |
Execution timed out |
1160 ms |
1696652 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
32 ms |
33844 KB |
Output is correct |
7 |
Execution timed out |
1160 ms |
1696652 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Incorrect |
1 ms |
384 KB |
Answer gives possible 1 while actual possible 0 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Incorrect |
1 ms |
384 KB |
Too few ways to get from 0 to 1, should be 2 found 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
32 ms |
33844 KB |
Output is correct |
7 |
Execution timed out |
1160 ms |
1696652 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
32 ms |
33844 KB |
Output is correct |
7 |
Execution timed out |
1160 ms |
1696652 KB |
Time limit exceeded |