Submission #725304

# Submission time Handle Problem Language Result Execution time Memory
725304 2023-04-17T08:13:31 Z Nahian9696 Game (APIO22_game) C++17
12 / 100
4000 ms 448 KB
#include "game.h"


#include <bits/stdc++.h>

using namespace std;

// #define int          long long

#define f0(i, n)      for(int i = 0; i <  (n); i++)
#define f1(i, n)      for(int i = 1; i <= (n); i++)
#define ff first
#define ss second
#define pb push_back



int n, k;
vector<vector<int>> grph;


void init(int a, int b) {
    n = a;
    k = b;
    vector<int> node;
    grph.resize(n, node);
    f1(u, k-1) {
        grph[u-1].pb(u);
    }
}

int add_teleporter(int a, int b) {

    if(a >= b) if (a < k) return 1;

    grph[a].pb(b);


    f0(u, k) {
        bool vis[n] = {0};
        queue<int> q;
        q.push(u);
        // vis[u] = 1;
        while(!q.empty()) {
            int cur = q.front();
            q.pop();
            for(int nxt: grph[cur]) {
                if(vis[nxt]) continue;
                if(nxt <= u) return 1;
                q.push(nxt);
                vis[nxt] = 1;
            }
        }
    }


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 26 ms 208 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 28 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 26 ms 208 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 28 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 2 ms 208 KB Output is correct
17 Correct 10 ms 208 KB Output is correct
18 Correct 4 ms 288 KB Output is correct
19 Correct 5 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 26 ms 208 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 28 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 2 ms 208 KB Output is correct
17 Correct 10 ms 208 KB Output is correct
18 Correct 4 ms 288 KB Output is correct
19 Correct 5 ms 208 KB Output is correct
20 Correct 4 ms 336 KB Output is correct
21 Correct 10 ms 208 KB Output is correct
22 Correct 69 ms 344 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2032 ms 324 KB Output is correct
25 Execution timed out 4080 ms 448 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 26 ms 208 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 28 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 2 ms 208 KB Output is correct
17 Correct 10 ms 208 KB Output is correct
18 Correct 4 ms 288 KB Output is correct
19 Correct 5 ms 208 KB Output is correct
20 Correct 4 ms 336 KB Output is correct
21 Correct 10 ms 208 KB Output is correct
22 Correct 69 ms 344 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2032 ms 324 KB Output is correct
25 Execution timed out 4080 ms 448 KB Time limit exceeded
26 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 27 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 26 ms 208 KB Output is correct
6 Correct 27 ms 208 KB Output is correct
7 Correct 28 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 3 ms 208 KB Output is correct
15 Correct 3 ms 208 KB Output is correct
16 Correct 2 ms 208 KB Output is correct
17 Correct 10 ms 208 KB Output is correct
18 Correct 4 ms 288 KB Output is correct
19 Correct 5 ms 208 KB Output is correct
20 Correct 4 ms 336 KB Output is correct
21 Correct 10 ms 208 KB Output is correct
22 Correct 69 ms 344 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2032 ms 324 KB Output is correct
25 Execution timed out 4080 ms 448 KB Time limit exceeded
26 Halted 0 ms 0 KB -