Submission #894717

# Submission time Handle Problem Language Result Execution time Memory
894717 2023-12-28T18:55:40 Z JeanBombeur Soccer Stadium (IOI23_soccer) C++17
3.5 / 100
265 ms 35604 KB
#include "soccer.h"
#include <cstdio>
#include <vector>
using namespace std;

//  <|°_°|>

const int MAX_ROWS = 2001;

bool Empty[MAX_ROWS][MAX_ROWS];


bool Check(int up, int down, int left, int right) {
    // printf("CHECKING : %d %d %d %d\n", up, down, left, right);
    int highest = -1;
    int low = 1e9;
    int leftBorder = 1e9, rightBorder = -1;
    for (int i = up; i < down && highest < 0; i ++)
    {
        for (int j = left; j < right; j ++)
        {
            if (Empty[i][j])
            {
                highest = i;
                leftBorder = min(leftBorder, j);
                if (rightBorder >= 0 && rightBorder < (j - 1))
                    return 0;
                rightBorder = j;
                int cur = i;
                while (Empty[cur][j])
                    cur ++;
                low = min(low, cur);
                while (cur < down)
                    if (Empty[cur ++][j])
                        return 0;
            }
        }
    }
    rightBorder ++;
    if (highest < 0)
    {
        // printf("DONE\n");
        return 1;
    }
    for (int i = up; i < low; i ++)
    {
        int j = left;
        while (!Empty[i][j])
            j ++;
        for (; j < right - 1; j ++)
            if (!Empty[i][j] && Empty[i][j + 1])
                return 0;
    }
    for (int i = low; i < down; i ++)
    {
        for (int j = left; j < right; j ++)
        {
            if (Empty[i][j] && (j < leftBorder || j >= rightBorder))
                return 0;
        }
    }
    return Check(up, low, left, leftBorder) && Check(up, low, rightBorder, right) && Check(low, down, leftBorder, rightBorder);
}

int biggest_stadium(int nbRows, vector <vector <int>> Forest) {
    
    int nb = 0;
    for (int i = 0; i < nbRows; i ++)
        for (int j = 0; j < nbRows; j ++)
            nb += Empty[i][j] = !Forest[i][j];
    
    return Check(0, nbRows, 0, nbRows) ? nb : 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 604 KB partial
8 Partially correct 16 ms 3164 KB partial
9 Partially correct 265 ms 35604 KB partial
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 344 KB partial
7 Partially correct 0 ms 436 KB partial
8 Correct 0 ms 600 KB ok
9 Correct 0 ms 428 KB ok
10 Partially correct 0 ms 348 KB partial
11 Partially correct 0 ms 344 KB partial
12 Partially correct 1 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 1 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 1 ms 344 KB partial
8 Partially correct 0 ms 436 KB partial
9 Correct 0 ms 600 KB ok
10 Correct 0 ms 428 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 344 KB partial
13 Partially correct 1 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Partially correct 0 ms 344 KB partial
16 Partially correct 0 ms 348 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 344 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 1 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 1 ms 344 KB partial
10 Partially correct 0 ms 436 KB partial
11 Correct 0 ms 600 KB ok
12 Correct 0 ms 428 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 0 ms 344 KB partial
18 Partially correct 0 ms 348 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 344 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 1 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 1 ms 344 KB partial
10 Partially correct 0 ms 436 KB partial
11 Correct 0 ms 600 KB ok
12 Correct 0 ms 428 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 0 ms 344 KB partial
18 Partially correct 0 ms 348 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 344 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 1 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 1 ms 604 KB partial
9 Partially correct 16 ms 3164 KB partial
10 Partially correct 265 ms 35604 KB partial
11 Partially correct 0 ms 344 KB partial
12 Partially correct 0 ms 348 KB partial
13 Partially correct 0 ms 348 KB partial
14 Partially correct 1 ms 344 KB partial
15 Partially correct 0 ms 436 KB partial
16 Correct 0 ms 600 KB ok
17 Correct 0 ms 428 KB ok
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 344 KB partial
20 Partially correct 1 ms 348 KB partial
21 Correct 0 ms 348 KB ok
22 Partially correct 0 ms 344 KB partial
23 Partially correct 0 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 1 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Correct 0 ms 344 KB ok
28 Correct 0 ms 348 KB ok
29 Incorrect 0 ms 348 KB wrong
30 Halted 0 ms 0 KB -