Submission #1018282

# Submission time Handle Problem Language Result Execution time Memory
1018282 2024-07-09T18:06:19 Z tmarcinkevicius Soccer Stadium (IOI23_soccer) C++17
0 / 100
0 ms 348 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)
{
    pii minRow, maxRow;
    bool possible = true;
    int state = 0;
    int fullCount = 0;
    pii prev;

    for (int i = 0; i < N; i++)
    {
        int start = N;
        int end = 0;
        int openCount = 0;
        for (int j = 0; j < N; j++)
        {
            if (F[i][j] == 0)
            {
                fullCount++;
                if (openCount == 0)
                {
                    openCount++;
                }
                else if (openCount == 2)
                {
                    openCount++;
                    break;
                }
                start = min(start, j);
                end = max(end, j);
            }
            else
            {
                if (openCount == 1)
                {
                    openCount++;
                }
            }
        }

        cout << "i = " << i << ", {" << start << ", " << end << "}, cnt = " << openCount << '\n';

        if (openCount >= 3)
        {
            possible = false;
        }

        if (i == 0)
        {
            minRow = {start, end};
            maxRow = {start, end};

            prev = {start, end};
            continue;
        }

        // cout << "min: {" << minRow.f << ", " << minRow.s << "}, max: {" << maxRow.f << ", " << maxRow.s << "}\n";

        if (state == 0 && start <= maxRow.f && end >= maxRow.s)
        {
            maxRow = {start, end};

            prev = {start, end};
            continue;
        }
        else if (start >= prev.f && end <= prev.s && ((start >= minRow.f && end <= minRow.s) || (start <= minRow.f && end >= minRow.s)))
        {
            state = 1;
            minRow = {max(minRow.f, start), min(minRow.s, end)};

            prev = {start, end};
            continue;
        }

        possible = false;
        break;
    }

    if (possible)
    {
        return fullCount;
    }
    else
    {
        return 0;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Possible tampering with the output
2 Halted 0 ms 0 KB -