Submission #589625

#TimeUsernameProblemLanguageResultExecution timeMemory
589625LIFConnecting Supertrees (IOI20_supertrees)C++14
11 / 100
167 ms28028 KiB
#include "supertrees.h" #include <vector> #include<bits/stdc++.h> using namespace std; int checkx[1005][1005]; int construct(std::vector<std::vector <int> > p) { bool flag = 1; vector<vector<int> > ans; for(int i=0;i<p.size();i++) { for(int j=0;j<p[i].size();j++) { if(p[i][j] == 3) { return 0; } if(p[i][j]!=1) { flag = 0; } } } if(flag == 1) //that means all distance is 1; { for(int i=0;i<p[0].size()-1;i++) { checkx[i][i+1] = true; checkx[i+1][i] = true; } for(int i=0;i<p[0].size();i++) { vector<int> v; for(int j=0;j<p[0].size();j++) { if(i==j) { v.push_back(0); } else { if(checkx[i][j] == true) { v.push_back(1); } else { v.push_back(0); } } } ans.push_back(v); } } build(ans); return 1; }

Compilation message (stderr)

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