제출 #1079142

#제출 시각아이디문제언어결과실행 시간메모리
10791427mody슈퍼트리 잇기 (IOI20_supertrees)C++17
0 / 100
1 ms432 KiB
#include "supertrees.h" #include <vector> #include <bits/stdc++.h> using namespace std; int construct(vector<vector<int>> p) { int n = p.size(); vector<vector<int>> answer; for (int i = 0; i < n; i++) { vector<int> row; row.resize(n); answer.push_back(row); } vector<int> arr; vector<bool> found(n); for(int i = 0; i < n;i++){ if(p[i][i] != 1) return 0; for(int j = 0; j < n;j++){ if(p[i][j] != p[j][i]) return 0; if(p[i][j] == 2){ if(!found[i]){ arr.push_back(i); found[i] = true; } if(!found[j]){ arr.push_back(j); found[j] = true; } } } } if(arr.size()) arr.push_back(arr[0]); for(int i = 0; i < arr.size() - 1;i++){ answer[i][i+1] = answer[i+1][i] = 1; } build(answer); return 1; }

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

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