제출 #73273

#제출 시각아이디문제언어결과실행 시간메모리
73273nvmdava친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; vector<int> p[1001]; int ans[1001][2]; inline void go(int v){ for(auto x : p){ go(x); ans[v][0] += max(ans[x][1], ans[x][0]); ans[v][1] += ans[x][0]; } } int findSample(int n,int confidence[],int host[],int protocol[]){ ans[0][1] = confidence[0]; for(int i = 1; i < n; i++){ p[host[i]].push_back(i); ans[i][1] = confidence[i]; } go(i); return max(ans[i][0], ans[i][0]); }

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

friend.cpp: In function 'void go(int)':
friend.cpp:10:7: error: cannot convert 'std::vector<int>' to 'int' for argument '1' to 'void go(int)'
   go(x);
       ^
friend.cpp:11:23: error: no match for 'operator[]' (operand types are 'int [1001][2]' and 'std::vector<int>')
   ans[v][0] += max(ans[x][1], ans[x][0]);
                       ^
friend.cpp:11:34: error: no match for 'operator[]' (operand types are 'int [1001][2]' and 'std::vector<int>')
   ans[v][0] += max(ans[x][1], ans[x][0]);
                                  ^
friend.cpp:12:19: error: no match for 'operator[]' (operand types are 'int [1001][2]' and 'std::vector<int>')
   ans[v][1] += ans[x][0];
                   ^
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:23:5: error: 'i' was not declared in this scope
  go(i);
     ^