Submission #420066

#TimeUsernameProblemLanguageResultExecution timeMemory
420066TricksterGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
//Suleyman Atayew

#include "game.h"
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <bitset>
#include <queue>
#include <cmath>
#include <map>
#include <set>
 
#define N 1510
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mod 1000000007
#define pii pair <int, int>
#define sz(a) (int)(a.size())
ll bigmod(ll a, ll b) { if(b==0)return 1; ll ret = bigmod(a, b/2); return ret * ret % mod * (b%2 ? a : 1) % mod; }

using namespace std;

int D[N][N], arr[N];

void initialize(int n) {
    for(int i = 0; i < n; i++) {
        arr[i] = n-1;
        for(int h = 0; h < n; h++)
            if(i != h) D[i][h] = 1;
    }
}

int hasEdge(int u, int v) {
    arr[u]--, arr[v]--;

    if(D[u][v] == 0) return 0;

    D[u][v] = D[v][u] = 0;

    if(arr[u] == 1) {
        int x = 0;
        for(int i = 0; i < n; i++) if(D[i][u]) x = i;
        arr[x]--;

        for(int i = 0; i < n; i++) {
            if(i == x) continue;

            arr[i] -= D[i][u];

            D[u][i] = D[i][u] = 0;
        }
    }
    if(arr[v] == 1) {
        int x = 0;
        for(int i = 0; i < n; i++) if(D[i][v]) x = i;
        arr[x]--;

        for(int i = 0; i < n; i++) {
            if(i == x) continue;

            arr[i] -= D[i][v];

            D[v][i] = D[i][v] = 0;
        }
    }

    if(arr[u] == 0 || arr[v] == 0)
        return 1;
    
    return 0;
}

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:46:28: error: 'n' was not declared in this scope
   46 |         for(int i = 0; i < n; i++) if(D[i][u]) x = i;
      |                            ^
game.cpp:49:28: error: 'n' was not declared in this scope
   49 |         for(int i = 0; i < n; i++) {
      |                            ^
game.cpp:59:28: error: 'n' was not declared in this scope
   59 |         for(int i = 0; i < n; i++) if(D[i][v]) x = i;
      |                            ^
game.cpp:62:28: error: 'n' was not declared in this scope
   62 |         for(int i = 0; i < n; i++) {
      |                            ^