Submission #300460

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3004602020-09-17 07:32:29mohammadConnecting Supertrees (IOI20_supertrees)C++14
40 / 100
299 ms22392 KiB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
int root[1020] , de[1020] , use[1020] , r[1020];
ll find(int u){
if(root[u] == u) return u;
return root[u] = find(root[u]);
}
int construct(vector<vector<int>> p) {
int n = p.size();
vector<vector<int>> answer(n , vector<int>(n , 0));
for(int i = 0 ; i < n ; ++i){
if(p[i][i] != 1) return 0 ;
root[i] = i ;
}
for(int i = 0 ; i < n; ++i)
for(int j = 0 ; j < n; ++j){
if(p[i][j] == 2 || p[i][j] == 0) r[i]++ ;
if(!p[i][j]) continue ;
root[find(i)] = find(j);
}
for(int i = 0 ; i < n ; ++i) {
if(r[i] == n - 1) de[i] = 1;
else de[i] = 0 ;
find(i);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...