Submission #1018283

# Submission time Handle Problem Language Result Execution time Memory
1018283 2024-07-09T18:07:02 Z tmarcinkevicius Soccer Stadium (IOI23_soccer) C++17
3.5 / 100
186 ms 39504 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;
    }
}

// int main()
// {
//     int count = 0;
//     for (int num = 0; num < (1 << 25); num++)
//     {
//         vector<vector<int>> vec(5);
//         bitset<25> bSet(num);

//         for (int i = 0; i < 5; i++)
//         {
//             vec[i] = vector<int>(5);
//             for (int j = 0; j < 5; j++)
//             {
//                 vec[i][j] = bSet[5 * i + j];
//             }
//         }

//         int res = biggest_stadium(5, vec);

//         if (res)
//         {
//             cout << "\nfound: " << count << '\n';
//             count++;
//             for (int i = 0; i < 5; i++)
//             {
//                 for (int j = 0; j < 5; j++)
//                 {
//                     cout << vec[i][j];
//                 }
//                 cout << '\n';
//             }
//         }
//     }
// }
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 496 KB partial
8 Partially correct 12 ms 2908 KB partial
9 Partially correct 186 ms 39504 KB partial
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 1 ms 600 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 348 KB partial
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 344 KB ok
10 Partially correct 0 ms 604 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
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 1 ms 600 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 348 KB partial
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 344 KB ok
11 Partially correct 0 ms 604 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 0 ms 348 KB partial
16 Partially correct 1 ms 348 KB partial
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 344 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 Incorrect 0 ms 348 KB wrong
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
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 344 KB ok
6 Partially correct 1 ms 600 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 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 344 KB ok
13 Partially correct 0 ms 604 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 0 ms 348 KB partial
18 Partially correct 1 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 344 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 Incorrect 0 ms 348 KB wrong
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
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 344 KB ok
6 Partially correct 1 ms 600 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 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 344 KB ok
13 Partially correct 0 ms 604 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 0 ms 348 KB partial
18 Partially correct 1 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 344 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 Incorrect 0 ms 348 KB wrong
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
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 344 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 496 KB partial
9 Partially correct 12 ms 2908 KB partial
10 Partially correct 186 ms 39504 KB partial
11 Partially correct 1 ms 600 KB partial
12 Partially correct 0 ms 348 KB partial
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 Correct 0 ms 344 KB ok
18 Partially correct 0 ms 604 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Correct 0 ms 348 KB ok
22 Partially correct 0 ms 348 KB partial
23 Partially correct 1 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 0 ms 344 KB partial
26 Partially correct 0 ms 348 KB partial
27 Correct 0 ms 348 KB ok
28 Correct 0 ms 348 KB ok
29 Incorrect 0 ms 348 KB wrong
30 Halted 0 ms 0 KB -