Submission #918014

# Submission time Handle Problem Language Result Execution time Memory
918014 2024-01-29T11:37:13 Z zhasyn Game (IOI14_game) C++14
42 / 100
1000 ms 5336 KB
#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
using namespace std;
#define F first
#define S second
typedef long long ll;
#define pii pair <int, int>
#define pll pair <ll, ll>
typedef long double ld;
const ll N = 1500 + 10, M = 30;
const ll mod = 998244353;
int g;
bool block[N][N], was[N], pred[N][N];
void initialize(int n){
  g = n;
}
void dfs(int v){
  was[v] = true;
  for(int i = 0; i < g; i++){
    if(was[i] || block[i][v] == true) continue;
    dfs(i);
  }
}
int hasEdge(int u, int v){
  if(pred[u][v]) return block[u][v];
  
  pred[u][v] = pred[v][u] = true;
  block[u][v] = block[v][u] = true;
  dfs(0);
  int cnt = 0;
  for(int i = 0; i < g; i++){
    if(was[i]) cnt++;
    was[i] = false;
  }
  
  if(cnt != g) block[u][v] = block[v][u] = false;
  return 1 - block[u][v];
}

// int main(){
//   int n;
//   cin >> n;
//   initialize(n);
//   for(int i = 0, a, b; i < ((n + 1) * n) / 2; i++){
//     cin >> a >> b;
//     cout << hasEdge(a, b) << endl;
//   }
//   return 0;
// }
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4536 KB Output is correct
6 Correct 1 ms 4540 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 2 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4440 KB Output is correct
16 Correct 1 ms 4440 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4440 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4440 KB Output is correct
5 Correct 1 ms 4440 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4536 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4544 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4440 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4440 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4540 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4440 KB Output is correct
21 Correct 1 ms 4440 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 2 ms 4444 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4444 KB Output is correct
28 Correct 2 ms 4540 KB Output is correct
29 Correct 2 ms 4444 KB Output is correct
30 Correct 2 ms 4444 KB Output is correct
31 Correct 2 ms 4444 KB Output is correct
32 Correct 2 ms 4444 KB Output is correct
33 Correct 1 ms 4548 KB Output is correct
34 Correct 23 ms 4444 KB Output is correct
35 Correct 25 ms 4444 KB Output is correct
36 Correct 24 ms 4444 KB Output is correct
37 Correct 21 ms 4672 KB Output is correct
38 Correct 22 ms 4444 KB Output is correct
39 Correct 21 ms 4444 KB Output is correct
40 Correct 25 ms 4680 KB Output is correct
41 Correct 21 ms 4444 KB Output is correct
42 Correct 23 ms 4444 KB Output is correct
43 Correct 24 ms 4676 KB Output is correct
44 Correct 35 ms 4652 KB Output is correct
45 Correct 35 ms 4444 KB Output is correct
46 Correct 24 ms 4444 KB Output is correct
47 Correct 25 ms 4444 KB Output is correct
48 Correct 24 ms 4440 KB Output is correct
49 Correct 22 ms 4676 KB Output is correct
50 Correct 22 ms 4680 KB Output is correct
51 Correct 22 ms 4440 KB Output is correct
52 Correct 37 ms 4444 KB Output is correct
53 Correct 22 ms 4444 KB Output is correct
54 Correct 22 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4440 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4444 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4544 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4536 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4544 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 2 ms 4440 KB Output is correct
26 Correct 2 ms 4444 KB Output is correct
27 Correct 2 ms 4444 KB Output is correct
28 Correct 2 ms 4440 KB Output is correct
29 Correct 2 ms 4444 KB Output is correct
30 Correct 2 ms 4600 KB Output is correct
31 Correct 2 ms 4528 KB Output is correct
32 Correct 2 ms 4444 KB Output is correct
33 Correct 2 ms 4444 KB Output is correct
34 Correct 21 ms 4444 KB Output is correct
35 Correct 21 ms 4444 KB Output is correct
36 Correct 21 ms 4548 KB Output is correct
37 Correct 23 ms 4444 KB Output is correct
38 Correct 21 ms 4440 KB Output is correct
39 Correct 21 ms 4444 KB Output is correct
40 Correct 22 ms 4444 KB Output is correct
41 Correct 22 ms 4444 KB Output is correct
42 Correct 25 ms 4440 KB Output is correct
43 Correct 23 ms 4444 KB Output is correct
44 Correct 21 ms 4444 KB Output is correct
45 Correct 22 ms 4696 KB Output is correct
46 Correct 24 ms 4664 KB Output is correct
47 Correct 22 ms 4660 KB Output is correct
48 Correct 24 ms 4444 KB Output is correct
49 Correct 22 ms 4444 KB Output is correct
50 Correct 25 ms 4440 KB Output is correct
51 Correct 23 ms 4656 KB Output is correct
52 Correct 26 ms 4672 KB Output is correct
53 Correct 23 ms 4448 KB Output is correct
54 Correct 21 ms 4648 KB Output is correct
55 Execution timed out 1055 ms 5336 KB Time limit exceeded
56 Halted 0 ms 0 KB -