제출 #404189

#제출 시각아이디문제언어결과실행 시간메모리
404189ly20친구 (IOI14_friend)C++17
11 / 100
31 ms3972 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 15; vector <int> grafo[MAXN]; int val[MAXN]; int tb[MAXN][MAXN]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 0; i < n; i++) { val[i] = confidence[i]; } for(int i = 1; i < n; i++) { int cur = host[i]; if(protocol[i] == 1 || protocol[i] == 2) { for(int j = 0; j < grafo[cur].size(); j++) { int viz = grafo[cur][j]; grafo[viz].push_back(i); grafo[i].push_back(viz); } } if(protocol[i] == 0 || protocol[i] == 2) { grafo[i].push_back(cur); grafo[cur].push_back(i); } } for(int i = 0; i < n; i++) { for(int j = 0; j < grafo[i].size(); j++) { int viz = grafo[i][j]; tb[i][viz] = 1; tb[viz][i] = 1; } } int resp = 0; for(int i = 0; i < (1 << n); i++) { int at = 0; vector <int> temp; for(int j = 0; j < n; j++) { if((1 << j) & i) { at += val[j]; temp.push_back(j); } } bool vl = true; for(int j = 0; j < temp.size(); j++) { for(int k = j + 1; k < temp.size(); k++) { if(tb[temp[j]][temp[k]] == 1) vl = false; } } if(vl && at > resp) resp = at; } return resp; }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:16:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |             for(int j = 0; j < grafo[cur].size(); j++) {
      |                            ~~^~~~~~~~~~~~~~~~~~~
friend.cpp:28:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for(int j = 0; j < grafo[i].size(); j++) {
      |                        ~~^~~~~~~~~~~~~~~~~
friend.cpp:44:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(int j = 0; j < temp.size(); j++) {
      |                        ~~^~~~~~~~~~~~~
friend.cpp:45:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |             for(int k = j + 1; k < temp.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...