제출 #26612

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
266122017-07-03 12:50:17Bruteforceman구슬과 끈 (APIO14_beads)C++11
100 / 100
500 ms38888 KiB
#include <bits/stdc++.h>
using namespace std;
int n;
vector <int> g[200010];
vector <int> c[200010];
long long dp[200010][2][2];
const long long inf = 1e16;
void dfs(int x, int par, int parCost) {
for(size_t i = 0; i < g[x].size(); i++) {
int y = g[x][i];
int w = c[x][i];
if(y == par) continue;
dfs(y, x, w);
}
long long sum;
vector <long long> best;
// solves 10 case when node x is a middle node
sum = 0;
long long t1 = -inf;
long long t2 = -inf;
for(size_t i = 0; i < g[x].size(); i++) {
int y = g[x][i];
int cost = c[x][i];
if(y == par) continue;
long long add = max(dp[y][0][1], dp[y][0][0]);
sum += add;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

beads.cpp: In function 'void dfs(int, int, int)':
beads.cpp:26:7: warning: unused variable 'cost' [-Wunused-variable]
   int cost = c[x][i];
       ^~~~
beads.cpp:48:7: warning: unused variable 'cost' [-Wunused-variable]
   int cost = c[x][i];
       ^~~~
beads.cpp:106:7: warning: unused variable 'cost' [-Wunused-variable]
   int cost = c[x][i];
       ^~~~
beads.cpp: In function 'int main()':
beads.cpp:117:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
beads.cpp:120:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &p, &q, &r);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...