제출 #587114

#제출 시각아이디문제언어결과실행 시간메모리
587114hibiki친구 (IOI14_friend)C++11
8 / 100
1 ms348 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; #define pb push_back // Find out best sample int ans = 0; int l[1005], best[1005]; vector<int> v[1005]; int dp[1005][2]; int fi(int idx) { if(l[idx] == idx) return idx; return l[idx] = fi(l[idx]); } void uni(int la, int lb) { if(la != lb) ans -= min(best[la], best[la]); best[lb] = max(best[la], best[lb]); l[la] = lb; } void dfs(int nw, int fa) { dp[nw][0] = dp[nw][1] = 0; for(auto go: v[nw]) { } } int findSample(int n,int c[],int h[],int p[]){ int ty; for(int i = 1; i < n; i++) ty = p[i]; // if(n < 20) ty = 3; if(ty == 0) { for(int i = 1; i < n; i++) v[h[i]].pb(i), v[i].pb(h[i]); } else if(ty == 1) { for(int i = 0; i < n; i++) ans += c[i]; } else if(ty == 2) { for(int i = 0; i < n; i++) ans += c[i]; for(int i = 0; i < n; i++) l[i] = i, best[i] = c[i]; for(int i = 1; i < n; i++) uni(fi(h[i]), fi(i)); } else { } return ans; }

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

friend.cpp: In function 'void dfs(int, int)':
friend.cpp:30:11: warning: unused variable 'go' [-Wunused-variable]
   30 |  for(auto go: v[nw])
      |           ^~
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:46:7: warning: 'ty' may be used uninitialized in this function [-Wmaybe-uninitialized]
   46 |  else if(ty == 1)
      |       ^~
#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...