제출 #134364

#제출 시각아이디문제언어결과실행 시간메모리
134364Kastanda경찰관과 강도 (BOI14_coprobber)C++11
컴파일 에러
0 ms0 KiB
// ItnoE
#include<bits/stdc++.h>
using namespace std;
const int N = 505;
int n, now, P[N][N], C[N][N];
bool dp[N][N][2];
vector < int > Adj[N];
int start(int _n, int _A[N][N])
{
    n = _n;
    for (int i = 0; i < n; i ++)
        for (int j = 0; j < n; j ++)
            if (A[i][j])
                Adj[i].push_back(j);
    queue < tuple < int , int , int > > qu;
    for (int i = 0; i < n; i ++)
    {
        dp[i][i][0] = dp[i][i][1] = 1;
        P[i][i] = -1;
        qu.push(make_tuple(i, i, 0));
        qu.push(make_tuple(i, i, 1));
    }
    while (qu.size())
    {
        int a, b, w;
        tie(a, b, w) = qu.front();
        qu.pop();
        if (w == 1)
        {
            for (int u : Adj[a])
                if (!dp[u][b][0])
                {
                    dp[u][b][0] = 1;
                    P[u][b] = a;
                    qu.push(make_tuple(u, b, 0));
                }
        }
        if (w == 0)
        {
            a, u, w; a, b, w
            for (int u : Adj[b])
            {
                C[a][u] ++;
                if (C[a][u] == Adj[u].size())
                {
                    dp[a][u][1] = 1;
                    qu.push(make_tuple(a, u, 1));
                }
            }
        }
    }
    for (int i = 0; i < n; i ++)
    {
        bool w = 1;
        for (int j = 0; j < n; j ++)
            w &= dp[i][j][0];
        if (w)
        {
            now = i;
            return (i);
        }
    }
    return (-1);
}
int nextMove(int v)
{
    now = P[now][v];
    return (now);
}

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

coprobber.cpp: In function 'int start(int, int (*)[505])':
coprobber.cpp:13:17: error: 'A' was not declared in this scope
             if (A[i][j])
                 ^
coprobber.cpp:40:16: error: 'u' was not declared in this scope
             a, u, w; a, b, w
                ^
coprobber.cpp:40:25: warning: left operand of comma operator has no effect [-Wunused-value]
             a, u, w; a, b, w
                         ^
coprobber.cpp:40:28: warning: right operand of comma operator has no effect [-Wunused-value]
             a, u, w; a, b, w
                            ^
coprobber.cpp:41:13: error: expected ';' before 'for'
             for (int u : Adj[b])
             ^~~
coprobber.cpp:49:13: warning: right operand of comma operator has no effect [-Wunused-value]
             }
             ^