제출 #404152

#제출 시각아이디문제언어결과실행 시간메모리
404152ly20친구 (IOI14_friend)C++17
0 / 100
65 ms25384 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 1123; int marc[MAXN]; int val[MAXN]; vector <int> grafo[MAXN]; // Find out best sample int br, pt; void dfs(int v) { if(marc[v] == 0) br += val[v]; else pt += val[v]; for(int i = 0; i < grafo[v].size(); i++) { int viz = grafo[v][i]; if(marc[viz] != -1) { continue; } marc[viz] = 1 - marc[v]; dfs(viz); } } int findSample(int n,int confidence[],int host[],int protocol[]){ int tot = 0; int mx = 0; for(int i = 0; i < n; i++) { marc[i] = -1; val[i] = confidence[i]; mx = max(mx, val[i]); } for(int i = 1; i < n - 1; i++) { int cur = host[i]; if(protocol[i] == 0 || protocol[i] == 2) { grafo[i].push_back(cur); grafo[cur].push_back(i); } if(protocol[i] == 1 || protocol[i] == 2) { for(int j = 0; j < grafo[cur].size(); j++) { int viz = grafo[cur][j]; grafo[i].push_back(viz); grafo[viz].push_back(i); } } } int resp = 0; for(int i = 0; i < n; i++) { if(marc[i] == -1) { br = 0; pt = 0; marc[i] = 0; dfs(i); resp += max(br, pt); tot += br + pt; } } return mx; }

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

friend.cpp: In function 'void dfs(int)':
friend.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < grafo[v].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~~
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:38:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int j = 0; j < grafo[cur].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...