Submission #1075965

#TimeUsernameProblemLanguageResultExecution timeMemory
1075965raphaelpCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
vector<vector<int>> AR;
int pos = 0;
int start(int N, int A[500][500])
{
    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);
            }
        }
    }
    for (int i = 0; i < N; i++)
    {
        vector<int> occ(N);
        queue<int> Q;
        occ[i] = 2;
        for (int j = 0; j < AR[i].size(); j++)
        {
            int x = AR[i][j];
            occ[x] = x;
            for (int k = 0; k < AR[x].size(); k++)
            {
                if (occ[AR[x][k]])
                    occ[AR[x][k]] = -1;
                else
                    occ[AR[x][k]] = x;
            }
        }
        for (int j = 0; j < N; j++)
            if (occ[j] != j && occ[j] != 0 && occ[j] != -1)
                Q.push(j);
        while (!Q.empty())
        {
            int x = Q.front();
            Q.pop();
            for (int j = 0; j < AR[x].size(); j++)
            {
                if (occ[AR[x][j]] != 0 && occ[AR[x][j]] != occ[x])
                    return -1;
                occ[AR[x][j]] = occ[x];
                Q.push(AR[x][j]);
            }
        }
    }
    return 1;
}
int nextMove(int R)
{
    return -1;
}

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, int (*)[500])':
coprobber.cpp:25:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for (int j = 0; j < AR[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~~
coprobber.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for (int k = 0; k < AR[x].size(); k++)
      |                             ~~^~~~~~~~~~~~~~
coprobber.cpp:44:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |             for (int j = 0; j < AR[x].size(); j++)
      |                             ~~^~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccODVwve.o: in function `main':
grader.cpp:(.text.startup+0x16c): undefined reference to `start(int, bool (*) [500])'
collect2: error: ld returned 1 exit status