제출 #216366

#제출 시각아이디문제언어결과실행 시간메모리
216366MODDI경주 (Race) (IOI11_race)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vll vector<pll> #define vii vector<pii> using namespace std; vii G[500000]; bool dp[10000][10000]; int K; void dfs(int at, int path, int passed_cities, int prev){ if(path > K) return; for(auto next : G[at]){ if(next.first == prev) continue; else{ dp[next][passed_cities] = path + next.second; dfs(next.first, path + next.second, passed_cities + 1, at); } } } int best_path(int n, int k, int H[][2], int L[]){ for(int i = 0; i < n - 1; i++){ G[H[i][0]].push_back(make_pair(H[i][1], L[i])); G[H[i][1]].push_back(make_pair(H[i][0], L[i])); } dfs(0, 0, 0, -1); int best = 1e9; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ best = min(best, j); } } if(best == 1e9) return -1; return best; }

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

race.cpp: In function 'void dfs(int, int, int, int)':
race.cpp:20:6: error: no match for 'operator[]' (operand types are 'bool [10000][10000]' and 'std::pair<int, int>')
    dp[next][passed_cities] = path + next.second;
      ^