Submission #304494

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3044942020-09-21 12:23:51Leonardo_PaesConnecting Supertrees (IOI20_supertrees)C++17
56 / 100
282 ms22264 KiB
#include "supertrees.h"
#include <vector>
using namespace std;
const int maxn = 1e3+10;
int pai[maxn], sz[maxn];
int find(int x){ return pai[x] = (pai[x] == x ? x : find(pai[x])); }
void join(int a, int b){
a = find(a), b = find(b);
if(a == b) return;
if(sz[a] > sz[b]) swap(a, b);
sz[b] += sz[a];
pai[a] = b;
}
int construct(vector<vector<int> > p) {
int n = p.size();
vector<vector<int> > ans;
for(int i=0; i<n; i++){
vector<int> row;
for(int j=0; j<n; j++){
row.push_back(0);
}
ans.push_back(row);
}
for(int i=0; i<n; i++){
pai[i] = i;
sz[i] = 1;
}
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(p[i][j]) join(i, j);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:72:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |         for(int j=0; j+1<v.size(); j++){
      |                      ~~~^~~~~~~~~
#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...