Submission #586034

#TimeUsernameProblemLanguageResultExecution timeMemory
586034almothana05Connecting Supertrees (IOI20_supertrees)C++14
21 / 100
179 ms22220 KiB
#include "supertrees.h" #include <vector> #include<bits/stdc++.h> using namespace std; vector<vector<int> >erg; vector<int>cmp[2000]; int vis[2000]; int construct(vector<vector<int>> p) { int menge = p.size() , pl = 1; for(int i = 0 ; i < menge ; i++){ erg.push_back(vector<int>() ); for(int j = 0 ; j < menge ; j++){ erg[i].push_back(0); } } for(int i = 0 ; i < menge ; i++){ p[i][i] = 1; } for(int i = 0 ; i < menge ; i++){ if(vis[i] == 0){ vis[i] = pl; for(int j = 0 ; j < menge ; j++){ if(p[i][j] == 1){ cmp[pl].push_back(j); vis[j] = pl; } } int fl = 1; for(int j = 0 ; j < menge ; j++){ for(int k = 0 ; k < cmp[pl].size() ; k++){ if(p[i][j] != p[cmp[pl][k]][j]){ fl = 0; break; } } } for(int j = 0 ; j < cmp[pl].size() - 1 ; j++){ erg[cmp[pl][j]][cmp[pl][j + 1]] = 1; erg[cmp[pl][j + 1]][cmp[pl][j]] = 1; } if(fl == 0){ return 0; } pl++; } } build(erg); return 1; }

Compilation message (stderr)

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