제출 #432321

#제출 시각아이디문제언어결과실행 시간메모리
432321arayi슈퍼트리 잇기 (IOI20_supertrees)C++17
56 / 100
283 ms23996 KiB
#include "supertrees.h" #include <bits/stdc++.h> #define ad push_back using namespace std; const int N = 1111; int col[N], sm[N], i1 = 1; vector <vector <int> > b; int n; int construct(std::vector<std::vector<int>> p) { n = p.size(); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if(p[i][j] > 3) return 0; for (int i = 0; i < n; i++) { if(sm[i]) { for (int j = 0; j < n; j++) { if(p[i][j] && sm[i] != sm[j]) return 0; if(p[i][j] == 0 && sm[i] == sm[j]) return 0; } } else { for (int j = 0; j < n; j++) if(p[i][j]) sm[j] = i1; } i1++; } b.resize(n); for (int i = 0; i < n; i++) b[i].resize(n); for (int i = 1; i < i1; i++) { vector<int> fp; for (int j = 0; j < n; j++) if(sm[j] == i) fp.ad(j); int nx = -1; for (int j = 0; j < fp.size(); j++) { if(col[fp[j]]) continue; if(nx != -1) b[nx][fp[j]] = b[fp[j]][nx] = 1; nx = fp[j]; col[fp[j]] = 1; for (int k = j + 1; k < fp.size(); k++) if(p[fp[j]][fp[k]] == 1) b[fp[j]][fp[k]] = b[fp[k]][fp[j]] = 1, col[fp[k]] = 1; } if(nx != -1 && nx != fp[0]) b[nx][fp[0]] = b[fp[0]][nx] = 1; } build(b); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:40:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |   for (int j = 0; j < fp.size(); j++)
      |                   ~~^~~~~~~~~~~
supertrees.cpp:46:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |    for (int k = j + 1; k < fp.size(); k++)
      |                        ~~^~~~~~~~~~~
#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...