제출 #800475

#제출 시각아이디문제언어결과실행 시간메모리
800475APROHACK슈퍼트리 잇기 (IOI20_supertrees)C++17
21 / 100
227 ms28096 KiB
#include "supertrees.h" #include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pb push_back using namespace std; vector<vector<int>>P; bool vis[1003]; int n; int construct(std::vector<std::vector<int>> p) { n = p.size(); P = p; memset(vis, false, sizeof vis); vector<std::vector<int>> answer; vector<int> row; for(int j = 0 ; j < n ; j ++)row.pb(0); for (int i = 0; i < n; i++) { answer.push_back(row); } bool isInG[n+1]; memset(isInG, false, sizeof isInG); for(int i = 0 ; i < n ; i ++){ if(vis[i])continue; set<int>grupo1; for(int j = 0 ; j < n ; j ++){ if(p[i][j] == 1){ grupo1.insert(j); isInG[j] = true; } } vector<int>g; for(auto j :grupo1){ g.pb(j); } for(auto j : g){ for(int x = 0 ; x < n ; x ++){ if(p[j][x] == 1 and !isInG[x])return 0; if(p[j][x] == 0 and isInG[x])return 0; } } for(auto j : g){ isInG[j] = false; vis[j] = true; } for(int j = 1 ; j < g.size() ; j ++){ answer[g[j-1]][g[j]] = 1; answer[g[j]][g[j-1]] = 1; } } build(answer); return 1; }

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

supertrees.cpp: In function 'int construct(std::vector<std::vector<int> >)':
supertrees.cpp:51:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |   for(int j = 1 ; j < g.size() ; 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...