Submission #910899

# Submission time Handle Problem Language Result Execution time Memory
910899 2024-01-18T09:05:11 Z efedmrlr Game (APIO22_game) C++17
30 / 100
4000 ms 3156 KB
#include "game.h"

// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;


#define lli long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int i = 0; (i) < (n); (i)++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()


void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


const double EPS = 0.00001;
const int INF = 1e9+500;
const int ALPH = 26;
const int LGN = 25;
constexpr int MOD = 1e9+7;
int N,K;
vector<vector<int> > adj;
vector<int> vis;
bool res = 0;
void init(int n, int k) {
  N = n; K = k;
  adj.resize(n + 1, vector<int>());
  
}

void dfs(int node, int t) {
  if(node < t || (node == t && vis[node])) {
    res = 1;
    return;
  } 

  if(vis[node]) return;
  vis[node] = 1;
  for(auto c : adj[node]) {
    dfs(c, t);
  }
  
}

int add_teleporter(int u, int v) {
  vis.assign(N + 1, 0);
  adj[u].pb(v);
  res = 0;
  for(int i = K - 1; i>=0; i--) {
    dfs(i, i);
    if(res) return 1;
  }
  
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 27 ms 856 KB Output is correct
26 Correct 37 ms 612 KB Output is correct
27 Correct 39 ms 868 KB Output is correct
28 Correct 17 ms 724 KB Output is correct
29 Correct 32 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 27 ms 856 KB Output is correct
26 Correct 37 ms 612 KB Output is correct
27 Correct 39 ms 868 KB Output is correct
28 Correct 17 ms 724 KB Output is correct
29 Correct 32 ms 600 KB Output is correct
30 Correct 654 ms 2004 KB Output is correct
31 Correct 172 ms 2172 KB Output is correct
32 Correct 615 ms 2620 KB Output is correct
33 Correct 600 ms 2688 KB Output is correct
34 Correct 1523 ms 3156 KB Output is correct
35 Execution timed out 4014 ms 2280 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 404 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 3 ms 852 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 27 ms 856 KB Output is correct
26 Correct 37 ms 612 KB Output is correct
27 Correct 39 ms 868 KB Output is correct
28 Correct 17 ms 724 KB Output is correct
29 Correct 32 ms 600 KB Output is correct
30 Correct 654 ms 2004 KB Output is correct
31 Correct 172 ms 2172 KB Output is correct
32 Correct 615 ms 2620 KB Output is correct
33 Correct 600 ms 2688 KB Output is correct
34 Correct 1523 ms 3156 KB Output is correct
35 Execution timed out 4014 ms 2280 KB Time limit exceeded
36 Halted 0 ms 0 KB -