Submission #613341

# Submission time Handle Problem Language Result Execution time Memory
613341 2022-07-30T04:40:05 Z talant117408 Cop and Robber (BOI14_coprobber) C++17
16 / 100
223 ms 262144 KB
#include "coprobber.h"
#ifndef EVAL
#include "grader.cpp"
#endif

#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define long                unsigned long 
#define pb                  push_back
#define mp                  make_pair
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define lb                  lower_bound
#define ub                  upper_bound
#define sz(v)               int((v).size())
#define do_not_disturb      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                '\n'
#define PI                  2*acos(0.0)

const int MAXN = 503;
int n;
vector <int> graph[MAXN];
int grundy[MAXN][MAXN][2]; // cop, robber, whose move
int parent[MAXN], pos = 0;

void dfs(int v, int p) {
    parent[v] = p;
    for (auto to : graph[v]) {
        if (to == parent[v]) continue;
        dfs(to, v);
    }
}

int start(int N, bool A[MAX_N][MAX_N]) {
    n = N;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (A[i][j]) {
                graph[i].pb(j);
            }
        }
    }
    dfs(0, 0);
    
    return 0;
}

int nextMove(int R) {
    if (R == pos) return pos;
    while (parent[R] != pos) {
        R = parent[R];
    }
    pos = R;
    return R;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 51 ms 1744 KB Output is correct
5 Correct 10 ms 960 KB Output is correct
6 Correct 56 ms 1496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 223 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 0 ms 336 KB Output is correct
4 Runtime error 174 ms 262144 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 336 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 51 ms 1744 KB Output is correct
5 Correct 10 ms 960 KB Output is correct
6 Correct 56 ms 1496 KB Output is correct
7 Runtime error 223 ms 262144 KB Execution killed with signal 9
8 Halted 0 ms 0 KB -