답안 #974035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
974035 2024-05-02T15:45:10 Z Tuanlinh123 게임 (APIO22_game) C++17
60 / 100
528 ms 9560 KB
// #include "grader.cpp"
#include "game.h"
#include<bits/stdc++.h>
#define ll int
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define sz(a) ((ll)(a).size())
using namespace std;

const ll maxn=30005, maxk=1024;
ll n, k;
vector <ll> A[maxn];
bitset <maxn> check[maxk];

void init(int N, int K)
{
    n=N, k=K;
    for (ll i=0; i<k; i++)
        for (ll j=i+1; j<k; j++)
            check[i][j]=1;
}

int add_teleporter(int u, int v) 
{
    A[u].pb(v);
    for (ll i=0; i<k; i++)
    {
        if ((!check[i][u] && u!=i) || check[i][v]) continue;
        queue <ll> q; q.push(v), check[i][v]=1;
        while (sz(q))
        {
            ll x=q.front(); q.pop();
            if (x==i) return 1;
            for (ll y:A[x])
                if (!check[i][y])
                    check[i][y]=1, q.push(y);
        }
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 4696 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 4696 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 1 ms 2648 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 1 ms 2900 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2988 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 4696 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 1 ms 2648 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 1 ms 2900 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2988 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 1 ms 4696 KB Output is correct
22 Correct 1 ms 4908 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 4696 KB Output is correct
25 Correct 5 ms 5208 KB Output is correct
26 Correct 4 ms 4972 KB Output is correct
27 Correct 11 ms 4696 KB Output is correct
28 Correct 5 ms 4952 KB Output is correct
29 Correct 8 ms 5432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 4696 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 1 ms 2648 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 1 ms 2900 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2988 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 1 ms 4696 KB Output is correct
22 Correct 1 ms 4908 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 4696 KB Output is correct
25 Correct 5 ms 5208 KB Output is correct
26 Correct 4 ms 4972 KB Output is correct
27 Correct 11 ms 4696 KB Output is correct
28 Correct 5 ms 4952 KB Output is correct
29 Correct 8 ms 5432 KB Output is correct
30 Correct 19 ms 5980 KB Output is correct
31 Correct 31 ms 5204 KB Output is correct
32 Correct 23 ms 6232 KB Output is correct
33 Correct 10 ms 4192 KB Output is correct
34 Correct 478 ms 5608 KB Output is correct
35 Correct 409 ms 5844 KB Output is correct
36 Correct 58 ms 6508 KB Output is correct
37 Correct 398 ms 6024 KB Output is correct
38 Correct 418 ms 6052 KB Output is correct
39 Correct 468 ms 6000 KB Output is correct
40 Correct 528 ms 6472 KB Output is correct
41 Correct 388 ms 5832 KB Output is correct
42 Correct 326 ms 6480 KB Output is correct
43 Correct 476 ms 6100 KB Output is correct
44 Correct 274 ms 6452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 4696 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 4696 KB Output is correct
6 Correct 1 ms 4696 KB Output is correct
7 Correct 1 ms 4696 KB Output is correct
8 Correct 1 ms 2648 KB Output is correct
9 Correct 1 ms 2648 KB Output is correct
10 Correct 1 ms 2648 KB Output is correct
11 Correct 1 ms 2648 KB Output is correct
12 Correct 1 ms 2648 KB Output is correct
13 Correct 1 ms 2648 KB Output is correct
14 Correct 1 ms 2648 KB Output is correct
15 Correct 1 ms 2648 KB Output is correct
16 Correct 1 ms 2900 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2988 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2648 KB Output is correct
21 Correct 1 ms 4696 KB Output is correct
22 Correct 1 ms 4908 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 4696 KB Output is correct
25 Correct 5 ms 5208 KB Output is correct
26 Correct 4 ms 4972 KB Output is correct
27 Correct 11 ms 4696 KB Output is correct
28 Correct 5 ms 4952 KB Output is correct
29 Correct 8 ms 5432 KB Output is correct
30 Correct 19 ms 5980 KB Output is correct
31 Correct 31 ms 5204 KB Output is correct
32 Correct 23 ms 6232 KB Output is correct
33 Correct 10 ms 4192 KB Output is correct
34 Correct 478 ms 5608 KB Output is correct
35 Correct 409 ms 5844 KB Output is correct
36 Correct 58 ms 6508 KB Output is correct
37 Correct 398 ms 6024 KB Output is correct
38 Correct 418 ms 6052 KB Output is correct
39 Correct 468 ms 6000 KB Output is correct
40 Correct 528 ms 6472 KB Output is correct
41 Correct 388 ms 5832 KB Output is correct
42 Correct 326 ms 6480 KB Output is correct
43 Correct 476 ms 6100 KB Output is correct
44 Correct 274 ms 6452 KB Output is correct
45 Runtime error 6 ms 9560 KB Execution killed with signal 11
46 Halted 0 ms 0 KB -