Submission #94495

# Submission time Handle Problem Language Result Execution time Memory
94495 2019-01-19T11:29:55 Z adlet Race (IOI11_race) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "race.h"

using namespace std;

#define int ll

const int INF = 1e9;
const int NN = 2e5 + 5;

int ans = INF, k;

vector < pair < int, int > > g[NN];

inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
    if (sum > k || h > ans)
        return;
    if (sum == k) {
        ans = min(ans, h);
        return;
    }
    for (auto node : g[v]) {
        int to = node.first, len = node.second;
        if (to == p)
            continue;
        dfs(to, sum + len, v, h + 1);
    }
}

int best_path(int N, int K, int H[][2], int L[]){
    k = K;
    for (int i = 0; i < N; ++i) {
        int v = H[i][0], u = H[i][1];
        g[v].push_back({u, L[i]});
        g[u].push_back({v, L[i]});
    }
    for (int i = 0; i < N; ++i)
        dfs(i);
    if (ans == INF)
        ans = -1;
    return ans;
}
/*


*/

Compilation message

race.cpp:6:13: error: 'll' does not name a type
 #define int ll
             ^
race.cpp:8:7: note: in expansion of macro 'int'
 const int INF = 1e9;
       ^~~
race.cpp:6:13: error: 'll' does not name a type
 #define int ll
             ^
race.cpp:9:7: note: in expansion of macro 'int'
 const int NN = 2e5 + 5;
       ^~~
race.cpp:6:13: error: 'll' does not name a type
 #define int ll
             ^
race.cpp:11:1: note: in expansion of macro 'int'
 int ans = INF, k;
 ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:13:17: note: in expansion of macro 'int'
 vector < pair < int, int > > g[NN];
                 ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:13:22: note: in expansion of macro 'int'
 vector < pair < int, int > > g[NN];
                      ^~~
race.cpp:13:26: error: template argument 1 is invalid
 vector < pair < int, int > > g[NN];
                          ^
race.cpp:13:26: error: template argument 2 is invalid
race.cpp:13:28: error: template argument 1 is invalid
 vector < pair < int, int > > g[NN];
                            ^
race.cpp:13:28: error: template argument 2 is invalid
race.cpp:13:32: error: 'NN' was not declared in this scope
 vector < pair < int, int > > g[NN];
                                ^~
race.cpp:13:32: note: suggested alternative: 'NAN'
 vector < pair < int, int > > g[NN];
                                ^~
                                NAN
race.cpp:6:13: error: variable or field 'dfs' declared void
 #define int ll
             ^
race.cpp:15:17: note: in expansion of macro 'int'
 inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
                 ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:15:17: note: in expansion of macro 'int'
 inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
                 ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:15:24: note: in expansion of macro 'int'
 inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
                        ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:15:37: note: in expansion of macro 'int'
 inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
                                     ^~~
race.cpp:6:13: error: 'll' was not declared in this scope
 #define int ll
             ^
race.cpp:15:49: note: in expansion of macro 'int'
 inline void dfs(int v, int sum = 0, int p = -1, int h = 0) {
                                                 ^~~
race.cpp:6:13: error: 'll' does not name a type
 #define int ll
             ^
race.cpp:30:1: note: in expansion of macro 'int'
 int best_path(int N, int K, int H[][2], int L[]){
 ^~~