This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "supertrees.h"
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
using namespace std;
const int MAXN = 1e3+10;
const double SMALL = 1e-6;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
int n;
bool tag[MAXN], done[MAXN];
vector <vector<int>> adj;
void bd(int x, int y){
adj[x][y] = 1; adj[y][x] = 1;
}
int construct(vector<vector<int>> p) {
n = p.size();
vector <int> te(n);
for(int i=0; i<n; i++) adj.pb(te);
for(int i = 0; i < n; i++) {
if(done[i]) continue;
for(int x=0; x<n; x++) tag[x] = 0;
vector <int> vec; vec.pb(i); tag[i] = 1;
for(int j=i+1; j < n; j++){
if(p[i][j] == 1){
vec.pb(j); tag[j] = 1;
}
}
//for(auto in : vec) cout << in << "pp\n";
for(auto in : vec){
//cout << in << " in\n";
for(int x=0; x<n; x++){
if(tag[x] && p[in][x] != 1) return 0; //harusnya 1
if(!tag[x] && p[in][x] == 1) return 0;
}
}
for(auto x : vec){ // build
done[x] = 1;
for(auto y : vec){
if(x==y) continue;
bd(x, y);
}
}
}
for(int i=0; i<n; i++) adj[i][i] = 0;
build(adj);
return 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |