Submission #709118

#TimeUsernameProblemLanguageResultExecution timeMemory
709118ono_de206Crocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include "crocodile.h" #include<bits/stdc++.h> using namespace std; const inf = 1e9 + 10; const int mxn = 1e5 + 10; int a[mxn], is[mxn], n; vector<pair<int, int>> g[mxn]; int solve(int x) { if(mp.find(x) != mp.end()) return mp[x]; vector<int> tmp; int &ret = mp[x]; ret = inf; for(auto [y, t] : g[x]) { tmp.pb(solve(y) + t); } sort(all(tmp)); ret = tmp[1]; return ret; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { n = N; for(int i = 0; i < M; i++) { int x = R[i][0]; int y = R[i][1]; g[x].pb({y, L[i]}); g[y].pb({x, L[i]}); } for(int i = 0; i < k; i++) { is[P[i]] = 1; } return solve(0); }

Compilation message (stderr)

crocodile.cpp:5:7: error: 'inf' does not name a type; did you mean 'ynf'?
    5 | const inf = 1e9 + 10;
      |       ^~~
      |       ynf
crocodile.cpp: In function 'int solve(int)':
crocodile.cpp:11:6: error: 'mp' was not declared in this scope
   11 |   if(mp.find(x) != mp.end()) return mp[x];
      |      ^~
crocodile.cpp:13:14: error: 'mp' was not declared in this scope; did you mean 'tmp'?
   13 |   int &ret = mp[x];
      |              ^~
      |              tmp
crocodile.cpp:14:9: error: 'inf' was not declared in this scope; did you mean 'ynf'?
   14 |   ret = inf;
      |         ^~~
      |         ynf
crocodile.cpp:15:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   15 |   for(auto [y, t] : g[x]) {
      |            ^
crocodile.cpp:16:9: error: 'class std::vector<int>' has no member named 'pb'
   16 |     tmp.pb(solve(y) + t);
      |         ^~
crocodile.cpp:18:8: error: 'all' was not declared in this scope
   18 |   sort(all(tmp));
      |        ^~~
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:28:10: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   28 |     g[x].pb({y, L[i]});
      |          ^~
crocodile.cpp:29:10: error: 'class std::vector<std::pair<int, int> >' has no member named 'pb'
   29 |     g[y].pb({x, L[i]});
      |          ^~
crocodile.cpp:31:22: error: 'k' was not declared in this scope
   31 |   for(int i = 0; i < k; i++) {
      |                      ^