Submission #930562

# Submission time Handle Problem Language Result Execution time Memory
930562 2024-02-20T06:48:39 Z vjudge1 Game (IOI14_game) C++17
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include "game.h"

using namespace std;

#define pb push_back

vector<vector<int>> graph;
vector<int> added, asked;

int cnt = 1;

void initialize(int n)
{
    graph.resize(n);
    added.resize(n);
    asked.resize(n);
    added[0] = 1;
}

int hasEdge(int u, int v)
{
    if ((added[u] and added[v]) or (!added[u] and !added[v]))
    {
        graph[u].pb(v);
        graph[v].pb(u);
        return 0;
    }
    if (added[v])
        swap(u, v);

    if (cnt - asked[v] == 0)
    {
        for (auto tov : graph[v])
            asked[tov]++;

        added[v] = 1;
        return 1;
    }
    return 0;
}

// int read_int()
// {
//     int x;
//     assert(scanf("%d", &x) == 1);
//     return x;
// }

// int main()
// {
//     int n, u, v;
//     n = read_int();
//     initialize(n);
//     for (int i = 0; i < n * (n - 1) / 2; i++)
//     {
//         u = read_int();
//         v = read_int();
//         printf("%d\n", hasEdge(u, v));
//     }
//     return 0;
// }
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -