Submission #724336

# Submission time Handle Problem Language Result Execution time Memory
724336 2023-04-15T06:04:00 Z MohamedAliSaidane Game (APIO22_game) C++17
30 / 100
538 ms 5576 KB
#include<bits/stdc++.h>
#include "game.h"
#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpi;

#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(),(x).end()

const ll MOD = 1e9 + 7, INF = 1e18;
ll mod(ll x, ll m = MOD) {return (x + m) % m;}

const int nax = 3e4 ;
const int kax = 1000;


int n, k;
bitset<nax> g[kax];
vi rev_adj[nax];
void init(int N, int K)
{
    n = N, k = K;
    for(int i = 0; i < k; i++)
    {

         for(int j =0 ; j <= i; j++)
            g[i][j] = 1;
     }

}

int add_teleporter(int u, int v)
{
    if(u < k && v <= u)
        return 1;
    if(v == u)
        return 0;
    if(u < v && v < k)
        return 0;
    for(int i = 0; i < k; i++)
    {
        if(g[i][v])
        {
            queue<int> q;
            q.push(u);
            g[i][u] = 1;
            while(!q.empty())
            {
                int node = q.front();
                q.pop();
                if(node < k && node >= i)
                    return 1;
                for(auto e: rev_adj[node])
                {
                    if(g[i][e])
                        continue;
                    g[i][e] = 1;
                    q.push(e);
                }
            }
        }
    }
    rev_adj[v].pb(u);
    return 0;
}
/*
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, m, k;
    cin >> n >> m >> k;
    init(n, k);
    while(m--)
    {
        int u, v;
        cin >> u >> v;
        cout << add_teleporter(u, v) << endl;
    }
}
*/

# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 0 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 0 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2864 KB Output is correct
25 Correct 15 ms 2080 KB Output is correct
26 Correct 4 ms 1360 KB Output is correct
27 Correct 8 ms 2852 KB Output is correct
28 Correct 17 ms 2772 KB Output is correct
29 Correct 22 ms 2784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 0 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2864 KB Output is correct
25 Correct 15 ms 2080 KB Output is correct
26 Correct 4 ms 1360 KB Output is correct
27 Correct 8 ms 2852 KB Output is correct
28 Correct 17 ms 2772 KB Output is correct
29 Correct 22 ms 2784 KB Output is correct
30 Correct 18 ms 1836 KB Output is correct
31 Correct 28 ms 4840 KB Output is correct
32 Correct 19 ms 2252 KB Output is correct
33 Correct 17 ms 1960 KB Output is correct
34 Incorrect 538 ms 5576 KB Wrong Answer[1]
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Correct 1 ms 976 KB Output is correct
3 Correct 1 ms 1360 KB Output is correct
4 Correct 1 ms 1104 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 0 ms 976 KB Output is correct
9 Correct 1 ms 976 KB Output is correct
10 Correct 1 ms 976 KB Output is correct
11 Correct 1 ms 976 KB Output is correct
12 Correct 1 ms 976 KB Output is correct
13 Correct 1 ms 976 KB Output is correct
14 Correct 1 ms 1104 KB Output is correct
15 Correct 1 ms 976 KB Output is correct
16 Correct 1 ms 976 KB Output is correct
17 Correct 1 ms 1104 KB Output is correct
18 Correct 1 ms 1104 KB Output is correct
19 Correct 1 ms 1104 KB Output is correct
20 Correct 1 ms 976 KB Output is correct
21 Correct 1 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 1 ms 976 KB Output is correct
24 Correct 7 ms 2864 KB Output is correct
25 Correct 15 ms 2080 KB Output is correct
26 Correct 4 ms 1360 KB Output is correct
27 Correct 8 ms 2852 KB Output is correct
28 Correct 17 ms 2772 KB Output is correct
29 Correct 22 ms 2784 KB Output is correct
30 Correct 18 ms 1836 KB Output is correct
31 Correct 28 ms 4840 KB Output is correct
32 Correct 19 ms 2252 KB Output is correct
33 Correct 17 ms 1960 KB Output is correct
34 Incorrect 538 ms 5576 KB Wrong Answer[1]
35 Halted 0 ms 0 KB -