제출 #404166

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

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

friend.cpp: In function 'void dfs(int, int)':
friend.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < grafo[v].size(); i++) {
      |                    ~~^~~~~~~~~~~~~~~~~
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:22:9: warning: unused variable 'tot' [-Wunused-variable]
   22 |     int tot = 0;
      |         ^~~
friend.cpp:23:9: warning: unused variable 'mx' [-Wunused-variable]
   23 |     int mx = 0;
      |         ^~
#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...