제출 #1062163

#제출 시각아이디문제언어결과실행 시간메모리
1062163andrei_iorgulescu게임 (IOI14_game)C++14
100 / 100
242 ms26464 KiB
#include <bits/stdc++.h>
#include "game.h"
#warning That's not FB, that's my FB

using namespace std;

int n;
int sz[1505], t[1505];
int cnt[1505][1505];

void initialize(int N)
{
    n = N;
    for (int i = 1; i <= n; i++)
        t[i] = i, sz[i] = 1;
}

int par(int x)
{
    while (x != t[x])
        x = t[x];
    return x;
}

int hasEdge(int u, int v)
{
    u++;
    v++;
    int ru = u, rv = v;
    u = par(u), v = par(v);
    if (u == v)
        assert(false);
    if (sz[u] < sz[v])
        swap(u,v);
    if (cnt[v][u] != sz[u] * sz[v] - 1)
    {
        cnt[v][u]++;
        cnt[u][v]++;
        return 0;
    }
    sz[u] += sz[v];
    t[v] = u;
    for (int x = 1; x <= n; x++)
    {
        if (t[x] == x and x != u and x != v)
        {
            cnt[x][u] += cnt[x][v];
            cnt[u][x] += cnt[v][x];
        }
    }
    return 1;
}

컴파일 시 표준 에러 (stderr) 메시지

game.cpp:3:2: warning: #warning That's not FB, that's my FB [-Wcpp]
    3 | #warning That's not FB, that's my FB
      |  ^~~~~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:29:9: warning: unused variable 'ru' [-Wunused-variable]
   29 |     int ru = u, rv = v;
      |         ^~
game.cpp:29:17: warning: unused variable 'rv' [-Wunused-variable]
   29 |     int ru = u, rv = v;
      |                 ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...