답안 #638485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
638485 2022-09-06T09:01:45 Z Nelt 게임 (APIO22_game) C++17
2 / 100
1 ms 320 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] == 1 and to != par)
      {
        ok = true;
        return;
      }
      elif (!used[to])
        dfs(to, v);
  }
  used[v] = 2;
}
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB Wrong Answer[1]
12 Halted 0 ms 0 KB -