Submission #1036987

#TimeUsernameProblemLanguageResultExecution timeMemory
1036987vaneaGame (IOI14_game)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h>
#include "game.h"
using namespace std;
using ll = long long;

const int mxN = 2e3+10;

int cnt[mxN];
int n, past = 0;

int hasEdge(int u, int v) {
    ++cnt[u]; ++cnt[v];
    if(cnt[u] == n-1 || cnt[v] == n-1) {--past; return 1;}
    if((cnt[u] == n-2 || cnt[v] == n-2) && past) {
        if(cnt[u] == n-2) cnt[u] = n;
        else cnt[v] = n;
        return 1;
    }
    if(cnt[u] == n-2)++past;
    if(cnt[v] == n-2)++past;
    return 0;
}

void initialize(int N) {
    n = N;
}

/*
int main()
{
    initialize(4);
    cout << hasEdge(0, 3) << hasEdge(1, 0) << hasEdge(0, 2) << hasEdge(3, 1);
    cout << hasEdge(1, 2) << hasEdge(2, 3);
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...