Submission #642546

# Submission time Handle Problem Language Result Execution time Memory
642546 2022-09-19T21:47:47 Z danikoynov Game (APIO22_game) C++17
0 / 100
1 ms 976 KB
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

const int maxk = 5010, maxn = 30010;
vector < int > g[maxn];
int used[maxk][maxn], tf, K;

void add_edge(int i, int u, int v)
{
    if (used[i][u] == 0)
        return;

    if (used[i][v])
    {
        if (v <= i)
            tf = 1;
        return;
    }

    queue < int > q;
    q.push(v);
    used[i][v] = 1;
    while(!q.empty())
    {
        int cur = q.front();
        ///cout << i << " :: " << cur << endl;
        q.pop();
        if (cur <= i)
            tf = 1;
            for (int nb : g[cur])
            {
                if (used[i][nb] == 0)
                {
                    used[i][nb] = 1;
                    q.push(nb);
                }
                else
                if (nb <= i)
                tf = 1;
            }

    }
}
void init(int n, int k)
{
    K = k;

    for (int i = 0; i < 1; i ++)
        for (int j = i; j < k; j ++)
        used[i][j] = 1;
}

int add_teleporter(int u, int v)
{
    g[u].push_back(v);
    for (int i = 0; i < 1; i ++)
    {
        add_edge(i, u, v);
    }
    return tf;
}

Compilation message

game.cpp: In function 'void add_edge(int, int, int)':
game.cpp:31:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   31 |         if (cur <= i)
      |         ^~
game.cpp:33:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   33 |             for (int nb : g[cur])
      |             ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 976 KB Output is correct
2 Incorrect 1 ms 976 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -