Submission #974034

# Submission time Handle Problem Language Result Execution time Memory
974034 2024-05-02T15:41:28 Z Tuanlinh123 Game (APIO22_game) C++17
30 / 100
12 ms 2904 KB
// #include "grader.cpp"
#include "game.h"
#include<bits/stdc++.h>
#define ll long long
#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 <maxk> check[maxn];

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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2648 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 2648 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2648 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2648 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 2648 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2648 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 2648 KB Output is correct
22 Correct 1 ms 2648 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 6 ms 2648 KB Output is correct
26 Correct 4 ms 2904 KB Output is correct
27 Correct 12 ms 2648 KB Output is correct
28 Correct 5 ms 2648 KB Output is correct
29 Correct 9 ms 2900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2648 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 2648 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2648 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 2648 KB Output is correct
22 Correct 1 ms 2648 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 6 ms 2648 KB Output is correct
26 Correct 4 ms 2904 KB Output is correct
27 Correct 12 ms 2648 KB Output is correct
28 Correct 5 ms 2648 KB Output is correct
29 Correct 9 ms 2900 KB Output is correct
30 Incorrect 3 ms 2904 KB Wrong Answer[1]
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2648 KB Output is correct
2 Correct 1 ms 2648 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2648 KB Output is correct
7 Correct 1 ms 2648 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 2648 KB Output is correct
17 Correct 1 ms 2648 KB Output is correct
18 Correct 1 ms 2648 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 2648 KB Output is correct
22 Correct 1 ms 2648 KB Output is correct
23 Correct 1 ms 2648 KB Output is correct
24 Correct 3 ms 2648 KB Output is correct
25 Correct 6 ms 2648 KB Output is correct
26 Correct 4 ms 2904 KB Output is correct
27 Correct 12 ms 2648 KB Output is correct
28 Correct 5 ms 2648 KB Output is correct
29 Correct 9 ms 2900 KB Output is correct
30 Incorrect 3 ms 2904 KB Wrong Answer[1]
31 Halted 0 ms 0 KB -