제출 #603754

#제출 시각아이디문제언어결과실행 시간메모리
603754lcj슈퍼트리 잇기 (IOI20_supertrees)C++17
46 / 100
192 ms22092 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef pair<int, int> pii; #include "supertrees.h" #define con(a, b) answer[a][b] = 1;answer[b][a] = 1; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>> answer(n, vector<int>(n, 0)); vector<vector<int>> groups; vector<bool> assigned(n, 0); for (int i = 0; i < n; i++) { if (assigned[i]) continue; vector<int> cgroup; for (int j = 0; j < n; j++) { if (p[i][j] == 0) continue; if (assigned[j]) { return 0; } cgroup.push_back(j); assigned[j] = 1; } groups.push_back(cgroup); } for (auto &g : groups) { vector<vector<int>> branches; vector<bool> br(n, 0); for (int i : g) { if (br[i]) continue; vector<int> branch; for (int j : g) { if (p[i][j] == 2) continue; if (br[j]) return 0; branch.push_back(j); br[j] = 1; } branches.push_back(branch); } for (int i = 0; i < branches.size(); i++) { if (branches.size() != 1) { con(branches[i][0], branches[(i+1)%branches.size()][0]) } for (int j = 0; j < branches[i].size()-1; j++) { con(branches[i][j], branches[i][j+1]) } } } build(answer); return 1; }

컴파일 시 표준 에러 (stderr) 메시지

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:47:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |         for (int i = 0; i < branches.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~~
supertrees.cpp:52:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |             for (int j = 0; j < branches[i].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...