답안 #840795

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
840795 2023-08-31T17:15:01 Z ogkostya 축구 경기장 (IOI23_soccer) C++17
6 / 100
265 ms 31628 KB
#include "soccer.h"


int GoTo(std::vector<std::vector<bool>>& V, std::vector<std::vector<int>>& F, int i, int j, int dx1, int dx2, int dy1, int dy2, int N)
{
    int count = 0;

    int x1 = i, y1 = j;
    while (true)
    {
        x1 += dx1;
        y1 += dy1;

        if (x1 < 0 || x1 >= N)
            break;
        if (y1 < 0 || y1 >= N)
            break;

        if (F[x1][y1] == 1)
        {
            break;
        }
        if (!V[x1][y1])
        {
            V[x1][y1] = true;
            count++;
        }

        int x2 = x1;
        int y2 = y1;
        while (true)
        {
            x2 += dx2;
            y2 += dy2;

            if (x2 < 0 || x2 >= N)
                break;
            if (y2 < 0 || y2 >= N)
                break;

            if (F[x2][y2] == 1)
            {
                break;
            }
            if (!V[x2][y2])
            {
                V[x2][y2] = true;
                count++;
            }
        }
    }

    return count;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    int x, y;
    int c = 0;

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (F[i][j] == 1)
            {
                c++;
                x = i;
                y = j;
            }
        }
    }

    if (c == 1)
    {
        return std::max(std::max(N * N - (x + 1) * (y + 1), N * N - (N - x) * (y + 1)), std::max(N * N - (x + 1) * (N - y), N * N - (N - x) * (N - y)));
    }

    std::vector<std::vector<int>> S(N, std::vector<int>(N));
    bool allmax = true;
    if (N <= 7)
    {

        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j < N; j++)
            {
                if (F[i][j] == 0)
                {
                    std::vector<std::vector<bool>> V(N, std::vector<bool>(N));
                    int count = 1;

                    count += GoTo(V, F, i, j, 1, 0, 0, 1, N);
                    count += GoTo(V, F, i, j, 1, 0, 0, -1, N);

                    count += GoTo(V, F, i, j, -1, 0, 0, 1, N);
                    count += GoTo(V, F, i, j, -1, 0, 0, -1, N);

                    count += GoTo(V, F, i, j, 0, 1, 1, 0, N);
                    count += GoTo(V, F, i, j, 0, 1, -1, 0, N);

                    count += GoTo(V, F, i, j, 0, -1, 1, 0, N);
                    count += GoTo(V, F, i, j, 0, -1, -1, 0, N);

                    S[i][j] = count;

                    if (count != c)
                    {
                        allmax = false;
                    }
                }
            }
        }
    }

    return allmax ? c : 1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Correct 0 ms 212 KB ok
7 Correct 1 ms 340 KB ok
8 Correct 15 ms 2180 KB ok
9 Correct 265 ms 31628 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 ms 212 KB ok
3 Partially correct 0 ms 212 KB partial
4 Partially correct 0 ms 212 KB partial
5 Partially correct 0 ms 212 KB partial
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Incorrect 0 ms 212 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Partially correct 0 ms 212 KB partial
5 Partially correct 0 ms 212 KB partial
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Partially correct 0 ms 212 KB partial
9 Incorrect 0 ms 212 KB wrong
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Partially correct 0 ms 212 KB partial
11 Incorrect 0 ms 212 KB wrong
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Partially correct 0 ms 212 KB partial
9 Partially correct 0 ms 212 KB partial
10 Partially correct 0 ms 212 KB partial
11 Incorrect 0 ms 212 KB wrong
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 212 KB ok
5 Correct 0 ms 212 KB ok
6 Correct 0 ms 212 KB ok
7 Correct 0 ms 212 KB ok
8 Correct 1 ms 340 KB ok
9 Correct 15 ms 2180 KB ok
10 Correct 265 ms 31628 KB ok
11 Partially correct 0 ms 212 KB partial
12 Partially correct 0 ms 212 KB partial
13 Partially correct 0 ms 212 KB partial
14 Partially correct 0 ms 212 KB partial
15 Partially correct 0 ms 212 KB partial
16 Incorrect 0 ms 212 KB wrong
17 Halted 0 ms 0 KB -