Submission #1363115

#TimeUsernameProblemLanguageResultExecution timeMemory
1363115aaaaaaaaGame (APIO22_game)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "game.h"

using namespace std;

const int mxN = 30055;
vector <int> g[mxN], rg[mxN];
int mn[mxN], mx[mxN];


void init (int n, int k) {
    for (int i = 0; i < n; ++i) {
        mn[i] = mxN, mx[i] = -mxN;
        if (i < k) mn[i] = mx[i] = i;
    }
    for (int i = 0; i < k - 1; ++i) {
        g[i].push_back(i + 1);
        rg[i + 1].push_back(i);
    }
}

void upd_mn (int u, int c) {
    if (mn[u] < c) return;
    mn[u] = c;
    for (auto v : rg[u]) {
        if (mn[v] > c) {
            upd_mn(v, c);
        }
    }
}

void upd_mx (int u, int c) {
    if (mx[u] > c) return;
    mx[u] = mn;
    for (auto v : g[u]) {
        if (mx[v] < c) {
            upd_mx(v, c);
        }
    }
}

int add_teleporter (int u, int v) {
  g[u].push_back(v);
  rg[v].push_back(u);
  upd_mn(a, mn[b]);
  upd_mx(b, mx[a]);
  return mx[a] >= mn[b];
}

Compilation message (stderr)

game.cpp: In function 'void upd_mx(int, int)':
game.cpp:34:13: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   34 |     mx[u] = mn;
      |             ^~
      |             |
      |             int*
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:45:10: error: 'a' was not declared in this scope
   45 |   upd_mn(a, mn[b]);
      |          ^
game.cpp:45:16: error: 'b' was not declared in this scope
   45 |   upd_mn(a, mn[b]);
      |                ^