제출 #77323

#제출 시각아이디문제언어결과실행 시간메모리
77323Charis02경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
//#include "coprobber.h"
#include<iostream>
#include<vector>
#define rep(i,a,b) for(int i = a;i < b;i++)
#define MAX_N 505
#define ll long long

using namespace std;

bool can[MAX_N][MAX_N][2],vis[MAX_N][MAX_N][2];
vector < vector < ll > > graph(MAX_N);
ll curcop;

bool solve(ll cop,ll rob,ll who) // who = 0 -> cop, who = 1 -> robber
{
    if(cop == rob)
        return (who == 0);

    vis[cop][rob][who] = true;

    if(who == 0)
    {
        rep(i,0,graph[cop].size())
        {
            if(!vis[graph[cop][i]][rob][1] && !solve(graph[cop][i],rob,1))
            {
                vis[cop][rob][who] = false;
                return true;
            }
        }

        vis[cop][rob][who] = false;

        return false;
    }

    rep(i,0,graph[rob].size())
    {
        if(vis[cop][graph[rob][i]][0])
        {
            vis[cop][rob][who] = false;
            return true;
        }
    }

    vis[cop][rob][who] = false;

    return false;
}

int start(int N, bool A[MAX_N][MAX_N])
{
    rep(i,0,N)
    {
        rep(j,0,N)
        {
            if(A[i][j])
                graph[i].push_back(j);
        }
    }

    rep(i,0,N)
    {
        curcop = i;
        bool res = true;

        rep(j,0,N)
        {
            if(solve(i,j,1))
            {
                res = false;
            }
        }

        if(res)
            return curcop = i;
    }

    return -1;
}

int nextMove(int R)
{
    rep(i,0,graph[curcop].size())
    {
        if(solve(graph[curcop][i],R,0))
            return graph[curcop][i];
    }
}
/*
int main()
{
    int n;
    cin >> n;
    bool a[MAX_N][MAX_N];
    rep(i,0,n)
    {
        rep(j,0,n)
        {
            cin >> a[i][j];
        }
    }

    cout<<start(n,a) << endl;

    while(true)
    {
        int x;
        cin >> x;

        cout << nextMove(x) << endl;
    }
}
*/

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

coprobber.cpp: In function 'bool solve(long long int, long long int, long long int)':
coprobber.cpp:4:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i = a;i < b;i++)
coprobber.cpp:23:13:
         rep(i,0,graph[cop].size())
             ~~~~~~~~~~~~~~~~~~~~~   
coprobber.cpp:23:9: note: in expansion of macro 'rep'
         rep(i,0,graph[cop].size())
         ^~~
coprobber.cpp:4:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i = a;i < b;i++)
coprobber.cpp:37:9:
     rep(i,0,graph[rob].size())
         ~~~~~~~~~~~~~~~~~~~~~       
coprobber.cpp:37:5: note: in expansion of macro 'rep'
     rep(i,0,graph[rob].size())
     ^~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:4:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define rep(i,a,b) for(int i = a;i < b;i++)
coprobber.cpp:84:9:
     rep(i,0,graph[curcop].size())
         ~~~~~~~~~~~~~~~~~~~~~~~~    
coprobber.cpp:84:5: note: in expansion of macro 'rep'
     rep(i,0,graph[curcop].size())
     ^~~
coprobber.cpp:89:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/tmp/ccpzcaos.o: In function `main':
grader.cpp:(.text.startup+0x13c): undefined reference to `start(int, bool (*) [500])'
collect2: error: ld returned 1 exit status