Submission #434131

#TimeUsernameProblemLanguageResultExecution timeMemory
434131OdaveyGame (IOI14_game)C++17
0 / 100
6 ms9140 KiB
//
// ~oisín~ C++ Template
//

#include                <bits/stdc++.h>
#define MX_N            5001
#define mp              make_pair
#define mod7            1000000007
#define modpi           314159
#define PI              3.141592653589793238
#define pb              push_back
#define FastIO          ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define All(a)          a.begin(),a.end()
#define fi              first
#define se              second
#define ll              long long int
#define ull             unsigned long long int

int kx[8]  =            {+2, +2, -2, -2, +1, +1, -1, -1};
int ky[8]  =            {+1, -1, +1, -1, +2, -2, +2, -2};
int d9x[9] =            {+1, +1, +1, +0, +0, +0, -1, -1, -1};
int d9y[9] =            {+1, +0, -1, +1, +0, -1, +1, +0, -1};
int dx4[4] =            {+0, +0, +1, -1};
int dy4[4] =            {+1, -1, +0, +0};

ll gcd(ull a, ull b){
    return (a==0)?b:gcd(b%a,a);
}

ll lcm(ull a, ull b){
    return a*(b/gcd(a,b));
}

const long long INF = 1e18;

using namespace std;

int V;

int AM[1501][1501];
int connections[1501];
int edges[1501];

void initialize(int n){
    memset(AM, -1, sizeof(AM));
    memset(edges, 0, sizeof(edges));
    memset(connections, 0, sizeof(connections));
    V = n;
    return;
}

int hasEdge(int u, int v){
    if(AM[u][v] != -1){
        return AM[u][v];
    }
    if(edges[u] == V-2 || edges[v] == V-2){
        AM[u][v] = 1;
        ++connections[u];
        ++connections[v];
    }else{
        AM[u][v] = 0;
    }
    ++edges[u];
    ++edges[v];
    return AM[u][v];
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...