Submission #1010399

# Submission time Handle Problem Language Result Execution time Memory
1010399 2024-06-29T04:27:18 Z thinknoexit Soccer Stadium (IOI23_soccer) C++17
35.5 / 100
262 ms 71508 KB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2020;
int n;
int f[N][N], qs[N][N];
int l[N], r[N];
// check if all empty cell are regular stadium
bool all_can() {
    for (int i = 1;i <= n;i++) {
        for (int j = 1;j <= n + 1;j++) {
            if (f[i][j - 1] != f[i][j]) {
                if (!l[i]) l[i] = j;
                else if (!r[i]) r[i] = j - 1;
                else return 0;
            }
        }
    }
    for (int j = 1;j <= n;j++) {
        int cnt = 0;
        for (int i = 1;i <= n;i++) {
            cnt += f[i - 1][j] != f[i][j];
        }
        if (cnt > 2) return 0;
    }
    for (int i = 1;i <= n;i++) {
        if (l[i] == 0) continue;
        for (int j = 1;j <= n;j++) {
            if (l[j] == 0) continue;
            bool ch = (l[i] <= l[j] && r[j] <= r[i]) || (l[j] <= l[i] && r[i] <= r[j]);
            if (!ch) return 0;
        }
    }
    return 1;
}
int mx = 0;
void play(int st) {
    if (st == n + 1) {
        bool can = 1;
        int cnt = 0;
        {
            int cnt = 0;
            for (int i = 1;i <= n;i++) {
                cnt += (l[i] == 0) != (l[i - 1] == 0);
            }
            if (cnt > 2) return;
        }
        if (l[1] && l[2] && l[3]) {
            for (int i = 2;i < n;i++) {
                if (l[i - 1] < l[i] && l[i] > l[i + 1]) return;
                if (r[i - 1] > r[i] && r[i] < r[i + 1]) return;
            }
        }
        for (int i = 1;i <= n;i++) {
            if (l[i] == 0) continue;
            cnt += r[i] - l[i] + 1;
            for (int j = 1;j <= n;j++) {
                if (l[j] == 0) continue;
                bool ch = (l[i] <= l[j] && r[j] <= r[i]) || (l[j] <= l[i] && r[i] <= r[j]);
                if (!ch) can = 0;
            }
        }
        if (can) mx = max(mx, cnt);
        return;
    }
    l[st] = r[st] = 0;
    play(st + 1);
    for (int i = 1;i <= n;i++) {
        for (int j = i;j <= n;j++) {
            l[st] = i, r[st] = j;
            if (qs[st][j] - qs[st][i - 1] == 0) play(st + 1);
        }
    }
}
int biggest_stadium(int NN, vector<vector<int>> F) {
    n = NN;
    int empty_cell = 0;
    for (int i = 1;i <= n;i++) {
        f[0][i] = f[n + 1][i] = f[i][0] = f[i][n + 1] = 1;
        for (int j = 1;j <= n;j++) {
            f[i][j] = F[i - 1][j - 1];
            qs[i][j] = qs[i][j - 1] + f[i][j];
            empty_cell += f[i][j] == 0;
        }
    }
    if (all_can()) return empty_cell;
    if (empty_cell == n * n - 1) {
        int mx = 0;
        for (int i = 1;i <= n && !mx;i++) {
            for (int j = 1;j <= n && !mx;j++) {
                if (f[i][j]) {
                    mx = max(mx, (i - 1) * n + (j - 1) * n - (i - 1) * (j - 1));
                    mx = max(mx, (n - i) * n + (j - 1) * n - (n - i) * (j - 1));
                    mx = max(mx, (i - 1) * n + (n - j) * n - (i - 1) * (n - j));
                    mx = max(mx, (n - i) * n + (n - j) * n - (n - i) * (n - j));
                }
            }
        }
        return mx;
    }
    if (n <= 3) play(1);
    return mx;
}
# 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 1 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 1376 KB ok
8 Correct 15 ms 8728 KB ok
9 Correct 215 ms 71312 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 344 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
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 Correct 0 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 344 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Partially correct 1 ms 348 KB partial
16 Partially correct 0 ms 348 KB partial
17 Partially correct 1 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 1 ms 348 KB ok
22 Partially correct 0 ms 348 KB partial
23 Partially correct 0 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 0 ms 444 KB partial
26 Partially correct 0 ms 348 KB partial
# 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 1 ms 344 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 344 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 0 ms 348 KB ok
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 1 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 1 ms 348 KB ok
24 Partially correct 0 ms 348 KB partial
25 Partially correct 0 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 0 ms 444 KB partial
28 Partially correct 0 ms 348 KB partial
29 Partially correct 0 ms 344 KB partial
30 Partially correct 1 ms 604 KB partial
31 Partially correct 0 ms 604 KB partial
32 Partially correct 1 ms 604 KB partial
33 Partially correct 0 ms 604 KB partial
34 Correct 0 ms 604 KB ok
35 Correct 0 ms 604 KB ok
36 Partially correct 0 ms 604 KB partial
37 Partially correct 1 ms 604 KB partial
38 Partially correct 0 ms 604 KB partial
39 Partially correct 0 ms 604 KB partial
40 Partially correct 1 ms 608 KB partial
41 Partially correct 1 ms 608 KB partial
# 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 1 ms 344 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 344 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 0 ms 348 KB ok
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 1 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 1 ms 348 KB ok
24 Partially correct 0 ms 348 KB partial
25 Partially correct 0 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 0 ms 444 KB partial
28 Partially correct 0 ms 348 KB partial
29 Partially correct 0 ms 344 KB partial
30 Partially correct 1 ms 604 KB partial
31 Partially correct 0 ms 604 KB partial
32 Partially correct 1 ms 604 KB partial
33 Partially correct 0 ms 604 KB partial
34 Correct 0 ms 604 KB ok
35 Correct 0 ms 604 KB ok
36 Partially correct 0 ms 604 KB partial
37 Partially correct 1 ms 604 KB partial
38 Partially correct 0 ms 604 KB partial
39 Partially correct 0 ms 604 KB partial
40 Partially correct 1 ms 608 KB partial
41 Partially correct 1 ms 608 KB partial
42 Partially correct 15 ms 8796 KB partial
43 Partially correct 16 ms 8796 KB partial
44 Partially correct 15 ms 8792 KB partial
45 Partially correct 14 ms 8792 KB partial
46 Partially correct 14 ms 8724 KB partial
47 Partially correct 14 ms 8796 KB partial
48 Correct 15 ms 8848 KB ok
49 Partially correct 16 ms 8792 KB partial
50 Partially correct 14 ms 8792 KB partial
51 Partially correct 19 ms 9164 KB partial
52 Partially correct 16 ms 8796 KB partial
53 Partially correct 14 ms 8800 KB partial
54 Partially correct 14 ms 8852 KB partial
55 Partially correct 23 ms 8796 KB partial
56 Partially correct 15 ms 8796 KB partial
57 Partially correct 14 ms 8796 KB partial
58 Partially correct 19 ms 8856 KB partial
59 Partially correct 14 ms 8796 KB partial
# 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 1 ms 344 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 1376 KB ok
9 Correct 15 ms 8728 KB ok
10 Correct 215 ms 71312 KB ok
11 Correct 0 ms 344 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 0 ms 344 KB ok
16 Correct 0 ms 348 KB ok
17 Correct 0 ms 348 KB ok
18 Correct 0 ms 348 KB ok
19 Correct 0 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 348 KB ok
22 Partially correct 1 ms 348 KB partial
23 Partially correct 0 ms 348 KB partial
24 Partially correct 1 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 1 ms 348 KB ok
29 Partially correct 0 ms 348 KB partial
30 Partially correct 0 ms 348 KB partial
31 Partially correct 0 ms 348 KB partial
32 Partially correct 0 ms 444 KB partial
33 Partially correct 0 ms 348 KB partial
34 Partially correct 0 ms 344 KB partial
35 Partially correct 1 ms 604 KB partial
36 Partially correct 0 ms 604 KB partial
37 Partially correct 1 ms 604 KB partial
38 Partially correct 0 ms 604 KB partial
39 Correct 0 ms 604 KB ok
40 Correct 0 ms 604 KB ok
41 Partially correct 0 ms 604 KB partial
42 Partially correct 1 ms 604 KB partial
43 Partially correct 0 ms 604 KB partial
44 Partially correct 0 ms 604 KB partial
45 Partially correct 1 ms 608 KB partial
46 Partially correct 1 ms 608 KB partial
47 Partially correct 15 ms 8796 KB partial
48 Partially correct 16 ms 8796 KB partial
49 Partially correct 15 ms 8792 KB partial
50 Partially correct 14 ms 8792 KB partial
51 Partially correct 14 ms 8724 KB partial
52 Partially correct 14 ms 8796 KB partial
53 Correct 15 ms 8848 KB ok
54 Partially correct 16 ms 8792 KB partial
55 Partially correct 14 ms 8792 KB partial
56 Partially correct 19 ms 9164 KB partial
57 Partially correct 16 ms 8796 KB partial
58 Partially correct 14 ms 8800 KB partial
59 Partially correct 14 ms 8852 KB partial
60 Partially correct 23 ms 8796 KB partial
61 Partially correct 15 ms 8796 KB partial
62 Partially correct 14 ms 8796 KB partial
63 Partially correct 19 ms 8856 KB partial
64 Partially correct 14 ms 8796 KB partial
65 Partially correct 261 ms 71272 KB partial
66 Partially correct 237 ms 71248 KB partial
67 Partially correct 216 ms 71328 KB partial
68 Partially correct 218 ms 71252 KB partial
69 Partially correct 258 ms 71320 KB partial
70 Partially correct 205 ms 71252 KB partial
71 Partially correct 212 ms 71296 KB partial
72 Partially correct 232 ms 71248 KB partial
73 Correct 232 ms 71440 KB ok
74 Correct 225 ms 71204 KB ok
75 Partially correct 220 ms 71252 KB partial
76 Partially correct 215 ms 71188 KB partial
77 Partially correct 199 ms 71204 KB partial
78 Partially correct 207 ms 71248 KB partial
79 Partially correct 201 ms 71332 KB partial
80 Partially correct 206 ms 71316 KB partial
81 Partially correct 200 ms 71252 KB partial
82 Partially correct 204 ms 71248 KB partial
83 Partially correct 262 ms 71508 KB partial
84 Partially correct 214 ms 71252 KB partial
85 Partially correct 220 ms 71332 KB partial
86 Partially correct 201 ms 71332 KB partial
87 Partially correct 200 ms 71252 KB partial
88 Partially correct 209 ms 71248 KB partial
89 Partially correct 233 ms 71252 KB partial
90 Partially correct 211 ms 71204 KB partial
91 Partially correct 214 ms 71252 KB partial
92 Partially correct 219 ms 71256 KB partial
93 Partially correct 234 ms 71504 KB partial
94 Partially correct 197 ms 71180 KB partial
95 Partially correct 186 ms 71196 KB partial
96 Partially correct 185 ms 71328 KB partial
97 Partially correct 195 ms 71252 KB partial
98 Partially correct 180 ms 71180 KB partial
99 Partially correct 183 ms 71252 KB partial
100 Partially correct 192 ms 71204 KB partial
101 Partially correct 237 ms 71252 KB partial
102 Partially correct 198 ms 71248 KB partial
103 Partially correct 208 ms 71184 KB partial
104 Partially correct 214 ms 71252 KB partial
105 Partially correct 204 ms 71312 KB partial
106 Partially correct 219 ms 71328 KB partial
107 Partially correct 217 ms 71312 KB partial
108 Partially correct 222 ms 71316 KB partial
109 Partially correct 250 ms 71248 KB partial