Submission #885866

# Submission time Handle Problem Language Result Execution time Memory
885866 2023-12-10T22:45:14 Z Maaxle Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
1 ms 4444 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<int>> adj;
vector<int> memo;

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

  int mini, smini;
  mini = smini = (1 << 30);
  for (int k : adj[i]) {
    int x;
    x = (memo[k] == (1 << 30) ? 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;
  }
  return dfs(0);
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:35:26: warning: overflow in conversion from 'long long int' to 'std::vector<int>::value_type' {aka 'int'} changes value from '1152921504606846976' to '0' [-Woverflow]
   35 |   memo.resize(N, ((ll) 1 << 60));
      |                  ~~~~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -