Submission #885860

# Submission time Handle Problem Language Result Execution time Memory
885860 2023-12-10T22:13:54 Z Maaxle Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
20 ms 9044 KB
#include "crocodile.h"
#include <bits/stdc++.h>

#define range(it, a, b) for (ll it = a; it < b; it++)
#define all(x) begin(x), end(x)
#define ll long long
#define ull unsigned long long
#define uset unordered_set
#define umap unordered_map 

using namespace std;

vector<vector<ll>> adj;
vector<ll> memo;

int dfs (ll i) {
  if (memo[i] != ((ll) 1 << 60)) return memo[i];

  ll mini, smini;
  mini = smini = ((ll) 1 << 60);
  for (ll k : adj[i]) {
    ll x;
    x = (memo[k] == ((ll) 1 << 60) ? dfs(k) : memo[k]);
    if (x < mini) {
      smini = mini;
      mini = x;
    }
    else smini = min(x, smini);
  }
  return (memo[i] = smini);
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
  adj.resize(N);
  memo.resize(N, ((ll) 1 << 60));

  range(i, 0, M) {
    adj[R[i][0]].push_back(R[i][1]);
    adj[R[i][1]].push_back(R[i][0]);
  }

  range(i, 0, K) {
    memo[P[i]] = 0;
  }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:45:1: warning: no return statement in function returning non-void [-Wreturn-type]
   45 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 9044 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 9044 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 9044 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -