Submission #856797

#TimeUsernameProblemLanguageResultExecution timeMemory
856797Trisanu_DasValley (BOI19_valley)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define pi pair<int, int> #define ll ong long #define ff first #define ss second ll n, s, q, e, a, b, w, z, r, c[100005]; vector<pi> adj[100005]; pi rs[100005]; ll dfs(ll u, ll p){ ll ans = LLONG_MAX / 3; if(u == e) return -1; for(auto v : adj[u]){ if(v.ff == rs[z].ff && u == rs[z].ss) continue; if(v.ff == rs[z].ss && u == rs[z].ff) continue; if(v.ff != p){ ll res = dfs(v.ff, u); if(res == -1) return -1; ans = min(ans, res + v.ss); } } if(c[u]) return 0; return ans; } int main(){ cin >> n >> s >> q >> e; for(ll i = 0; i < n-1; i++){ cin >> u >> v >> w; adj[u].push_back({v, w}); adj[v].push_back({u, w}); rs[i] = {u, v}; } for(ll i = 0; i < s; i++){ cin >> z; c[z] = 1; } for(ll i = 0; i < q; i++){ cin >> z >> r; z--; ll ans = dfs(r, -1); if(ans == -1) cout << "escaped\n"; else if(ans >= LLONG_MAX / 3) cout << "oo\n"; else cout << ans << '\n'; } }

Compilation message (stderr)

valley.cpp:4:12: error: 'ong' does not name a type; did you mean 'long'?
    4 | #define ll ong long
      |            ^~~
valley.cpp:8:1: note: in expansion of macro 'll'
    8 | ll n, s, q, e, a, b, w, z, r, c[100005];
      | ^~
valley.cpp:4:12: error: 'ong' does not name a type; did you mean 'long'?
    4 | #define ll ong long
      |            ^~~
valley.cpp:12:1: note: in expansion of macro 'll'
   12 | ll dfs(ll u, ll p){
      | ^~
valley.cpp: In function 'int main()':
valley.cpp:29:9: error: 'n' was not declared in this scope; did you mean 'yn'?
   29 |  cin >> n >> s >> q >> e;
      |         ^
      |         yn
valley.cpp:29:14: error: 's' was not declared in this scope; did you mean 'rs'?
   29 |  cin >> n >> s >> q >> e;
      |              ^
      |              rs
valley.cpp:29:19: error: 'q' was not declared in this scope
   29 |  cin >> n >> s >> q >> e;
      |                   ^
valley.cpp:29:24: error: 'e' was not declared in this scope
   29 |  cin >> n >> s >> q >> e;
      |                        ^
valley.cpp:4:12: error: 'ong' was not declared in this scope; did you mean 'long'?
    4 | #define ll ong long
      |            ^~~
valley.cpp:30:6: note: in expansion of macro 'll'
   30 |  for(ll i = 0; i < n-1; i++){
      |      ^~
valley.cpp:30:16: error: 'i' was not declared in this scope; did you mean 'pi'?
   30 |  for(ll i = 0; i < n-1; i++){
      |                ^
      |                pi
valley.cpp:31:10: error: 'u' was not declared in this scope
   31 |   cin >> u >> v >> w;
      |          ^
valley.cpp:31:15: error: 'v' was not declared in this scope
   31 |   cin >> u >> v >> w;
      |               ^
valley.cpp:31:20: error: 'w' was not declared in this scope
   31 |   cin >> u >> v >> w;
      |                    ^
valley.cpp:4:12: error: 'ong' was not declared in this scope; did you mean 'long'?
    4 | #define ll ong long
      |            ^~~
valley.cpp:36:6: note: in expansion of macro 'll'
   36 |  for(ll i = 0; i < s; i++){ cin >> z; c[z] = 1; }
      |      ^~
valley.cpp:36:16: error: 'i' was not declared in this scope; did you mean 'pi'?
   36 |  for(ll i = 0; i < s; i++){ cin >> z; c[z] = 1; }
      |                ^
      |                pi
valley.cpp:36:36: error: 'z' was not declared in this scope
   36 |  for(ll i = 0; i < s; i++){ cin >> z; c[z] = 1; }
      |                                    ^
valley.cpp:36:39: error: 'c' was not declared in this scope
   36 |  for(ll i = 0; i < s; i++){ cin >> z; c[z] = 1; }
      |                                       ^
valley.cpp:4:12: error: 'ong' was not declared in this scope; did you mean 'long'?
    4 | #define ll ong long
      |            ^~~
valley.cpp:37:6: note: in expansion of macro 'll'
   37 |  for(ll i = 0; i < q; i++){
      |      ^~
valley.cpp:37:16: error: 'i' was not declared in this scope; did you mean 'pi'?
   37 |  for(ll i = 0; i < q; i++){
      |                ^
      |                pi
valley.cpp:38:10: error: 'z' was not declared in this scope
   38 |   cin >> z >> r; z--;
      |          ^
valley.cpp:38:15: error: 'r' was not declared in this scope; did you mean 'rs'?
   38 |   cin >> z >> r; z--;
      |               ^
      |               rs
valley.cpp:4:16: error: expected ';' before 'long'
    4 | #define ll ong long
      |                ^~~~
valley.cpp:39:3: note: in expansion of macro 'll'
   39 |   ll ans = dfs(r, -1);
      |   ^~
valley.cpp:40:6: error: 'ans' was not declared in this scope; did you mean 'abs'?
   40 |   if(ans == -1) cout << "escaped\n";
      |      ^~~
      |      abs