Submission #836987

#TimeUsernameProblemLanguageResultExecution timeMemory
836987aZvezdaCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> const ll MAX_N = 1e3 + 10; const ll MAX_K = 100; typedef long double ld; ld dist[MAX_N][MAX_K]; std::vector<std::pair<ll, ll> > g[MAX_N]; bool used[MAX_N]; void dfs(ll x) { if(used[x]) { return; } used[x] = true; for(const auto &it : g[x]) { dfs(it.first); } } double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) { for(ll i = 0; i < M; i ++) { g[x[i]].push_back({y[i], c[i]}); g[y[i]].push_back({x[i], c[i]}); } dfs(0); std::priority_queue<std::pair<ld, std::pair<ll, ll> > > pq; for(ll i = 0; i < N; i ++) { for(ll j = 0; j <= K; j ++) { dist[i][j] = 1e18; } } for(ll i = 0; i < N; i ++) { if(arr[i] == 0 || i == 0) { dist[i][0] = 0; pq.push({0, {0, i}}); } } while(!pq.empty()) { auto curr = pq.top(); pq.pop(); curr.first *= -1; if(curr.first > dist[curr.second.second][curr.second.first]) { continue; } for(const auto &it : g[curr.second.second]) { ld new_dist = curr.first + it.second; if(new_dist < dist[it.first][curr.second.first]) { dist[it.first][curr.second.first] = new_dist; pq.push({-new_dist, {curr.second.first, it.first}}); } if(arr[it.first] == 2 && curr.second.first < K) { new_dist /= 2; if(new_dist < dist[it.first][curr.second.first + 1]) { dist[it.first][curr.second.first + 1] = new_dist; pq.push({-new_dist, {curr.second.first + 1, it.first}}); } } } } ld ret = 1e18; for(ll i = 0; i <= K; i ++) { ret = std::min(ret, dist[N - 1][i]); } return ret; }

Compilation message (stderr)

cyberland.cpp:5:7: error: 'll' does not name a type
    5 | const ll MAX_N = 1e3 + 10;
      |       ^~
cyberland.cpp:6:7: error: 'll' does not name a type
    6 | const ll MAX_K = 100;
      |       ^~
cyberland.cpp:10:9: error: 'MAX_N' was not declared in this scope
   10 | ld dist[MAX_N][MAX_K];
      |         ^~~~~
cyberland.cpp:10:16: error: 'MAX_K' was not declared in this scope
   10 | ld dist[MAX_N][MAX_K];
      |                ^~~~~
cyberland.cpp:12:23: error: 'll' was not declared in this scope; did you mean 'ld'?
   12 | std::vector<std::pair<ll, ll> > g[MAX_N];
      |                       ^~
      |                       ld
cyberland.cpp:12:27: error: 'll' was not declared in this scope; did you mean 'ld'?
   12 | std::vector<std::pair<ll, ll> > g[MAX_N];
      |                           ^~
      |                           ld
cyberland.cpp:12:29: error: template argument 1 is invalid
   12 | std::vector<std::pair<ll, ll> > g[MAX_N];
      |                             ^
cyberland.cpp:12:29: error: template argument 2 is invalid
cyberland.cpp:12:31: error: template argument 1 is invalid
   12 | std::vector<std::pair<ll, ll> > g[MAX_N];
      |                               ^
cyberland.cpp:12:31: error: template argument 2 is invalid
cyberland.cpp:12:35: error: 'MAX_N' was not declared in this scope
   12 | std::vector<std::pair<ll, ll> > g[MAX_N];
      |                                   ^~~~~
cyberland.cpp:14:11: error: 'MAX_N' was not declared in this scope
   14 | bool used[MAX_N];
      |           ^~~~~
cyberland.cpp:16:6: error: variable or field 'dfs' declared void
   16 | void dfs(ll x) {
      |      ^~~
cyberland.cpp:16:10: error: 'll' was not declared in this scope; did you mean 'ld'?
   16 | void dfs(ll x) {
      |          ^~
      |          ld
cyberland.cpp:25:14: error: 'double solve' redeclared as different kind of entity
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |              ^~
In file included from cyberland.cpp:1:
cyberland.h:3:8: note: previous declaration 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
    3 | double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr);
      |        ^~~~~
cyberland.cpp:25:14: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |              ^~
      |              ld
cyberland.cpp:25:20: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                    ^~
      |                    ld
cyberland.cpp:25:26: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                          ^~
      |                          ld
cyberland.cpp:25:32: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                ^~
      |                                ld
cyberland.cpp:25:50: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                  ^~
      |                                                  ld
cyberland.cpp:25:52: error: template argument 1 is invalid
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                    ^
cyberland.cpp:25:52: error: template argument 2 is invalid
cyberland.cpp:25:69: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                     ^~
      |                                                                     ld
cyberland.cpp:25:71: error: template argument 1 is invalid
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                       ^
cyberland.cpp:25:71: error: template argument 2 is invalid
cyberland.cpp:25:88: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                                        ^~
      |                                                                                        ld
cyberland.cpp:25:90: error: template argument 1 is invalid
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                                          ^
cyberland.cpp:25:90: error: template argument 2 is invalid
cyberland.cpp:25:107: error: 'll' was not declared in this scope; did you mean 'ld'?
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                                                           ^~
      |                                                                                                           ld
cyberland.cpp:25:109: error: template argument 1 is invalid
   25 | double solve(ll N, ll M, ll K, ll H, std::vector<ll> x, std::vector<ll> y, std::vector<ll> c, std::vector<ll> arr) {
      |                                                                                                             ^
cyberland.cpp:25:109: error: template argument 2 is invalid