답안 #1018227

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018227 2024-07-09T16:53:48 Z tmarcinkevicius 축구 경기장 (IOI23_soccer) C++17
2 / 100
4500 ms 258840 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define f first
#define s second

int biggest_stadium(int N, vector<vector<int>> F)
{
    vector<vector<int>> prefixLine(N), prefixCol(N);

    for (int i = 0; i < N; i++)
    {
        prefixLine[i] = vector<int>(N, 0);

        prefixLine[i][0] = F[i][0];

        for (int j = 1; j < N; j++)
        {
            prefixLine[i][j] = prefixLine[i][j - 1] + F[i][j];
        }
    }

    for (int i = 0; i < N; i++)
    {
        prefixCol[i] = vector<int>(N, 0);

        prefixCol[i][0] = F[0][i];

        for (int j = 1; j < N; j++)
        {
            prefixCol[i][j] = prefixCol[i][j - 1] + F[j][i];
        }
    }

    set<pii> freeCells;
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            if (F[i][j] == 0)
            {
                freeCells.insert({i, j});
            }
        }
    }

    bool possible = true;
    for (pii p1 : freeCells)
    {
        for (pii p2 : freeCells)
        {
            if (p1 == p2)
                continue;

            if (p1.f == p2.f)
            {
                int sum = prefixLine[p1.f][max(p1.s, p2.s)] - prefixLine[p1.f][min(p1.s, p2.s)];
                if (sum != 0)
                {
                    possible = false;
                    break;
                }
            }
            else if (p1.s == p2.s)
            {
                int sum = prefixCol[p1.s][max(p1.f, p2.f)] - prefixCol[p1.s][min(p1.f, p2.f)];
                if (sum != 0)
                {
                    possible = false;
                    break;
                }
            }
            else
            {
                int sum1 = prefixLine[p1.f][max(p1.s, p2.s)] - prefixLine[p1.f][min(p1.s, p2.s)] +
                            prefixCol[p2.s][max(p1.f, p2.f)] - prefixCol[p2.s][min(p1.f, p2.f)];

                int sum2 = prefixLine[p2.f][max(p1.s, p2.s)] - prefixLine[p2.f][min(p1.s, p2.s)] +
                            prefixCol[p1.s][max(p1.f, p2.f)] - prefixCol[p1.s][min(p1.f, p2.f)];

                if (sum1 != 0 && sum2 != 0)
                {
                    possible = false;
                    break;
                }
            }
        }

        if (!possible)
            break;
    }

    if (possible)
    {
        return freeCells.size();
    }
    else
    {
        return 0;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 9 ms 860 KB partial
8 Partially correct 438 ms 16636 KB partial
9 Execution timed out 4568 ms 258840 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 0 ms 344 KB partial
4 Partially correct 0 ms 348 KB partial
5 Partially correct 0 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 344 KB partial
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Partially correct 0 ms 348 KB partial
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 348 KB partial
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 344 KB partial
5 Partially correct 0 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 344 KB partial
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 348 KB partial
13 Partially correct 0 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Partially correct 1 ms 344 KB partial
16 Partially correct 0 ms 344 KB partial
17 Partially correct 0 ms 348 KB partial
18 Partially correct 1 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 348 KB ok
22 Partially correct 0 ms 348 KB partial
23 Incorrect 0 ms 348 KB wrong
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 ms 344 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 344 KB partial
18 Partially correct 0 ms 344 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 348 KB partial
21 Partially correct 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Partially correct 0 ms 348 KB partial
25 Incorrect 0 ms 348 KB wrong
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 ms 344 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 344 KB partial
18 Partially correct 0 ms 344 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 348 KB partial
21 Partially correct 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Partially correct 0 ms 348 KB partial
25 Incorrect 0 ms 348 KB wrong
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Partially correct 9 ms 860 KB partial
9 Partially correct 438 ms 16636 KB partial
10 Execution timed out 4568 ms 258840 KB Time limit exceeded
11 Halted 0 ms 0 KB -