Submission #638497

# Submission time Handle Problem Language Result Execution time Memory
638497 2022-09-06T09:35:08 Z Nelt Game (APIO22_game) C++17
0 / 100
1 ms 336 KB
#include "game.h"
#include <bits/stdc++.h>
#define S second
#define F first
#define ll long long
#define ull unsigned long long
#define ld long double
#define npos ULLONG_MAX
#define INF LLONG_MAX
#define elif else if
#define vv(a) vector<a>
#define pp(a, b) pair<a, b>
#define pq(a) priority_queue<a>
#define qq(a) queue<a>
#define ss(a) set<a>
#define mm(a, b) map<a, b>
#define ump(a, b) unordered_map<a, b>
#define pb push_back
#define sync                    \
  ios_base::sync_with_stdio(0); \
  cin.tie();                    \
  cout.tie();
#define endl "\n"
#define allc(a) begin(a), end(a)
#define all(a) a, a + sizeof(a) / sizeof(a[0])
#define mpr make_pair
#define ins insert
using namespace std;
using namespace __cxx11;
typedef char chr;
typedef basic_string<chr> str;
ll n, k;
const ll sz = 1005;
vv(ll) g[sz];
ll used[sz];
bool ok = false;
void dfs(ll v, ll par = 0)
{
  used[v] = 1;
  for (ll to : g[v])
  {
      if (used[to] and to != par)
      {
        ok = true;
        return;
      }
      elif (!used[to])
        dfs(to, v);
  }
}
void init(int n1, int k1)
{
  n = n1;
  k = k1;
  for (ll i = 1; i < k; i++)
    g[i].pb(i + 1);
}
int add_teleporter(int u, int v)
{
  u++, v++;
  g[u].pb(v);
  for (ll i = 1; i <= n; i++)
    used[i] = 0;
  ok = false;
  dfs(1);
  return ok;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 0 ms 208 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -