Submission #329568

#TimeUsernameProblemLanguageResultExecution timeMemory
329568pggpConnecting Supertrees (IOI20_supertrees)C++14
11 / 100
248 ms22232 KiB
#include <bits/stdc++.h> #include "supertrees.h" using namespace std; vector< vector < int > > comp; int comp_id[1005]; //void build(vector< vector < int > > p){ // } int construct(vector< vector < int > > p){ int n = p.size(); for (int i = 0; i < n; ++i) { bool added = false; // sprawdzamy do której składowej należy i for(int j = 0; j < comp.size(); j++){ if(p[i][comp[j][0]] != 0){ comp[j].push_back(i); comp_id[i] = j; added = true; break; } } if(!added){ vector < int > v; v.push_back(i); comp_id[i] = comp.size(); comp.push_back(v); } } vector < vector < int > > b; b.resize(n); for (int i = 0; i < n; ++i) { b[i].resize(n); for (int j = 0; j < n; ++j) { if(p[i][j] == 0 and comp_id[i] == comp_id[j]){ return 0; } b[i][j] = 0; } } for(int i = 0; i < comp.size(); i++){ for (int j = 1; j < comp[i].size(); ++j) { b[comp[i][j]][comp[i][j - 1]] = 1; b[comp[i][j - 1]][comp[i][j]] = 1; } } build(b); return 1; }

Compilation message (stderr)

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