답안 #949764

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
949764 2024-03-19T16:22:12 Z ALTAKEXE 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 KB
#include <vector>
#include <algorithm>

using namespace std;

bool is_regular(int N, int r, int c, int s, const vector<vector<int>> &F)
{
    vector<vector<int>> trees(F);

    for (int i = r; i < r + s; i++)
    {
        for (int j = c; j < c + s; j++)
        {
            if (trees[i][j] == 1)
            {
                return false;
            }
        }
    }

    for (int i = r; i < r + s; i++)
    {
        int count = count_if(trees[i].begin() + c, trees[i].begin() + c + s, [](int val)
                             { return val == 0; });
        if (count != s && count != 0)
        {
            return false;
        }
    }

    for (int j = c; j < c + s; j++)
    {
        int count = 0;
        for (int i = r; i < r + s; i++)
        {
            if (trees[i][j] == 0)
            {
                count++;
            }
        }
        if (count != s && count != 0)
        {
            return false;
        }
    }

    return true;
}

int biggest_stadium(int N, const vector<vector<int>> &F)
{
    int max_size = 1;

    for (int r = 0; r < N; r++)
    {
        for (int c = 0; c < N; c++)
        {
            for (int s = 1; s <= N; s++)
            {
                if (r + s <= N && c + s <= N && is_regular(N, r, c, s, F))
                {
                    max_size = max(max_size, s);
                }
            }
        }
    }

    return max_size * max_size;
}

Compilation message

/usr/bin/ld: /tmp/cc8NZpGs.o: in function `main':
grader.cpp:(.text.startup+0x4ac): undefined reference to `biggest_stadium(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status