Submission #847023

#TimeUsernameProblemLanguageResultExecution timeMemory
84702312345678Connecting Supertrees (IOI20_supertrees)C++17
0 / 100
1 ms348 KiB
#include "supertrees.h" #include <bits/stdc++.h> using namespace std; const int nx=1e3+5; int gc; bool vs[nx]; vector<vector<int>> g(nx); int construct(std::vector<std::vector<int>> p) { int n = p.size(); vector<vector<int>> answer(n, vector<int> (n, 0)); for (int i=0; i<n; i++) { if (!vs[i]) { queue<int> q; q.push(i); vs[i]=1; while (!q.empty()) { int x=q.front(); q.pop(); g[gc].push_back(x); for (int j=0; j<n; j++) if (p[x][j]==2&&!vs[j]) q.push(j), vs[j]=1; for (int j=0; j<n; j++) if (p[j][x]==2&&!vs[j]) q.push(j), vs[j]=1; } for (auto x:g[gc]) for (auto y:g[gc]) if (p[x][y]==0) return 0; int s=g[gc].size(); if (s==1) { gc++; continue; } for (int j=0; j<g[gc].size(); j++) answer[g[gc][j]][g[gc][(j+1)%s]]=answer[g[gc][(j+1)%s]][g[gc][j]]=1; gc++; } } build(answer); return 1; }

Compilation message (stderr)

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