Submission #1155822

#TimeUsernameProblemLanguageResultExecution timeMemory
1155822an22inkleGame (IOI14_game)C++20
0 / 100
1 ms328 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

int N = 0, asked = 0, R = 0;
int fu = -1, fv = -1;
bool f = 0;

void initialize(int n) {
    N = n;
    R = N*(N-1)/2;
}

int hasEdge(int u, int v) {
    asked++;

    if (asked == 1) {
        fu = u;
        fv = v;
        f = 1;
        return 1;
    }

    if (f && u != fu && u != fv && v != fu && u != fv) {
        f = 0;
        return 1;
    }

    if (asked == R) {
        return 1;
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...