Submission #441924

#TimeUsernameProblemLanguageResultExecution timeMemory
441924PiejanVDCConnecting Supertrees (IOI20_supertrees)C++17
0 / 100
1 ms292 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>>v(n,vector<int>(n,0)); for(int i = 0 ; i < n-1 ; i++) { for(int j = i+1 ; j < n ; j++) { if(p[i][j]) { bool ok=true; stack<pair<int,int>>s; s.push({i,-1}); while(!s.empty()) { if(s.top().first == j) ok=false; break; for(int k = 0 ; k < n ; k++) { if(k==s.top().first||k==s.top().second) continue; if(v[s.top().first][k]) { s.push({k,s.top().first}); } } } if(ok) { v[i][j]=1,v[j][i]=1; } } } } for(int i = 0 ; i < n ; i++) { for(int j = i+1 ; j < n ; j++) { if(!p[i][j]) { bool ok=true; stack<pair<int,int>>s; s.push({i,-1}); while(!s.empty()) { if(s.top().first == j) ok=false; break; for(int k = 0 ; k < n ; k++) { if(k==s.top().first||k==s.top().second) continue; if(v[s.top().first][k]) { s.push({k,s.top().first}); } } } if(!ok) { return 0; } } } } build(v); return 1; }

Compilation message (stderr)

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:15:21: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   15 |                     if(s.top().first == j)
      |                     ^~
supertrees.cpp:16:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   16 |                         ok=false; break;
      |                                   ^~~~~
supertrees.cpp:37:21: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   37 |                     if(s.top().first == j)
      |                     ^~
supertrees.cpp:38:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   38 |                         ok=false; break;
      |                                   ^~~~~
#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...