Submission #1075806

#TimeUsernameProblemLanguageResultExecution timeMemory
1075806raphaelpCop and Robber (BOI14_coprobber)C++14
0 / 100
3082 ms1672 KiB
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
vector<vector<int>> AR;
int pos = 0;
int start(int N, bool A[MAX_N][MAX_N])
{
    AR.assign(N, {});
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (A[i][j])
            {
                AR[i].push_back(j);
                AR[j].push_back(i);
            }
        }
    }
    return 0;
}
bool dfs(int x, int p, int R)
{
    if (x == R)
        return 1;
    for (int i = 0; i < AR[x].size(); i++)
    {
        if (AR[x][i] == p)
            continue;
        if (dfs(AR[x][i], x, R))
            return 1;
    }
    return 0;
}
int nextMove(int R)
{
    for (int i = 0; i < AR[pos].size(); i++)
    {
        if (dfs(AR[pos][i], pos, R))
        {
            pos = AR[pos][i];
            return pos;
        }
    }
    return 0;
}

Compilation message (stderr)

coprobber.cpp: In function 'bool dfs(int, int, int)':
coprobber.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int i = 0; i < AR[x].size(); i++)
      |                     ~~^~~~~~~~~~~~~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for (int i = 0; i < AR[pos].size(); i++)
      |                     ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...