제출 #1366336

#제출 시각아이디문제언어결과실행 시간메모리
1366336alexddShopping (JOI21_shopping)C++20
컴파일 에러
0 ms0 KiB
#include "Anna.h"
#include <bits/stdc++.h>
using namespace std;

namespace
{
    const int MAXN = 105;
    int who[MAXN][MAXN];
}

void Anna(int N, int K, std::vector<int> R, std::vector<int> C)
{
    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            who[i][j] = (i%3) * 3 + (j%3);
            who[i][j] -= 2;
        }
    }

    for(int i=0;i<N;i++)
    {
        for(int j=0;j<N;j++)
        {
            int val = who[i][j];
            if(val < 0)
                SetFlag(i, j, 1);
            else if(R[val] < i - 1)
                SetFlag(i, j, 2 + 3);
            else if(R[val] > i + 1)
                SetFlag(i, j, 2 + 2);
            else if(C[val] < j - 1)
                SetFlag(i, j, 2 + 1);
            else if(C[val] > j + 1)
                SetFlag(i, j, 2 + 0);
            else
            {
                assert(i - 1 <= R[val] && R[val] <= i + 1 && j - 1 <= C[val] && C[val] <= j + 1);
                int mini_poz = (R[val] - (i - 1)) * 3 + (C[val] - (j - 1));
                SetFlag(i, j, 6 + mini_poz);
            }
        }
    }
}
#include "Bruno.h"
#include <bits/stdc++.h>
using namespace std;

std::vector<int> Bruno(int K, std::vector<int> flags)
{
    int mat[3][3];
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)
            mat[i][j] = flags[i*3 + j];

    bool gasit = 0;
    int rx, ry;
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(mat[i][j] == 1 && mat[i][(j+1)%3] == 1)
            {
                assert(!gasit);
                gasit = 1;
                rx = i;
                ry = j;
            }
        }
    }
    assert(gasit);

    vector<int> ans(K);
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            int who = ((i - rx + 3) % 3) * 3 + (j - ry + 3) % 3;
            who -= 2;

            int myf = mat[i][j];

            if(who < 0)
            {
                assert(myf == 1);
                continue;
            }
            assert(myf != 1);

            assert(0 <= who && who < K);

            if(myf <= 5)
            {
                ans[who] = myf - 2;
            }
            else
            {
                myf -= 6;

                int dx = myf / 3, dy = myf % 3;

                int actual_x = (i - 1) + dx, actual_y = (j - 1) + dy;

                if(actual_y > 1)
                    ans[who] = 0;
                else if(actual_y < 1)
                    ans[who] = 1;
                else if(actual_x > 1)
                    ans[who] = 2;
                else if(actual_x < 1)
                    ans[who] = 3;
                else
                {
                    assert(actual_x == 1 && actual_y == 1);
                    ans[who] = 4;
                }
            }
        }
    }

    return ans;
}

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

# 1번째 컴파일 단계

Anna.cpp: In function 'void Anna(int, int, std::vector<int>, std::vector<int>)':
Anna.cpp:28:17: error: 'SetFlag' was not declared in this scope
   28 |                 SetFlag(i, j, 1);
      |                 ^~~~~~~
Anna.cpp:30:17: error: 'SetFlag' was not declared in this scope
   30 |                 SetFlag(i, j, 2 + 3);
      |                 ^~~~~~~
Anna.cpp:32:17: error: 'SetFlag' was not declared in this scope
   32 |                 SetFlag(i, j, 2 + 2);
      |                 ^~~~~~~
Anna.cpp:34:17: error: 'SetFlag' was not declared in this scope
   34 |                 SetFlag(i, j, 2 + 1);
      |                 ^~~~~~~
Anna.cpp:36:17: error: 'SetFlag' was not declared in this scope
   36 |                 SetFlag(i, j, 2 + 0);
      |                 ^~~~~~~
Anna.cpp:41:17: error: 'SetFlag' was not declared in this scope
   41 |                 SetFlag(i, j, 6 + mini_poz);
      |                 ^~~~~~~