Submission #1078528

# Submission time Handle Problem Language Result Execution time Memory
1078528 2024-08-27T19:16:01 Z beaconmc Soccer Stadium (IOI23_soccer) C++17
25 / 100
1165 ms 243348 KB
#include "soccer.h"
#include <bits/stdc++.h>
    
using namespace std; 


typedef long long ll;
    
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)



ll prefrow[2001][2001];
ll prefcol[2001][2001];
ll grid[2001][2001];



bool checkrow(ll a, ll b, ll row){
    if (a>b) swap(a,b);

    return (prefrow[row][b] - prefrow[row][a] + grid[row][a] == 0);

}

bool checkcol(ll a, ll b, ll col){
    if (a>b) swap(a,b);

    return (prefcol[b][col] - prefcol[a][col] + grid[a][col] == 0);
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    ll ans = N*N;
    FOR(i,0,N){
        FOR(j,0,N){
            grid[i][j] = F[i][j];
            ans -= F[i][j];
        }
    }
    FOR(i,0,N){
        prefrow[i][0] = F[i][0];
        FOR(j,1,N){
            prefrow[i][j] = prefrow[i][j-1] + F[i][j];
        }
    }

    FOR(j,0,N){
        prefcol[0][j] = F[0][j];
        FOR(i,1,N){
            prefcol[i][j] = prefcol[i-1][j] + F[i][j];
        }
    }

    vector<vector<ll>> special;

    FOR(i,0,N){
        FOR(j,0,N){
            vector<vector<ll>> sus = {{i-1,j}, {i+1,j}, {i,j-1}, {i,j+1}};
            if (grid[i][j] != 1){
                bool flag = 0;
                for (auto&k : sus){
                    if (0<=k[0] && k[0]<N && 0<=k[1] && k[1]<N){
                        if (grid[k[0]][k[1]]==1) flag = 1;
                    }
                }
                if (flag==1 || i==0 || i==N-1 || j==0 || j==N-1) special.push_back({i,j});
            }
        }
    }
    for (auto&X : special){
        for (auto&Y : special){

            ll i = X[0], j = X[1], k = Y[0], l= Y[1];
             if (grid[i][j]==1 || grid[k][l] == 1) continue;
            bool check1 = (checkrow(l, j, i) && checkcol(k, i, l));
            bool check2 = (checkrow(l, j, k) && checkcol(k, i, j));
            if (!check1 && !check2) return 0;

        }
    }
                   


                    

    return ans;


}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 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 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 1 ms 348 KB partial
7 Partially correct 3 ms 1884 KB partial
8 Partially correct 55 ms 14684 KB partial
9 Partially correct 873 ms 133972 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 0 ms 348 KB partial
4 Partially correct 1 ms 348 KB partial
5 Partially correct 1 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 440 KB partial
11 Partially correct 0 ms 344 KB partial
12 Partially correct 0 ms 348 KB partial
13 Correct 1 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 348 KB partial
5 Partially correct 1 ms 348 KB partial
6 Partially correct 1 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 440 KB partial
12 Partially correct 0 ms 344 KB partial
13 Partially correct 0 ms 348 KB partial
14 Correct 1 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 348 KB partial
19 Partially correct 1 ms 344 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 Partially correct 0 ms 348 KB partial
24 Partially correct 1 ms 344 KB partial
25 Partially correct 1 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 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 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 1 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 440 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 1 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 348 KB partial
21 Partially correct 1 ms 344 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 Partially correct 0 ms 348 KB partial
26 Partially correct 1 ms 344 KB partial
27 Partially correct 1 ms 348 KB partial
28 Partially correct 0 ms 348 KB partial
29 Partially correct 0 ms 348 KB partial
30 Partially correct 1 ms 860 KB partial
31 Partially correct 1 ms 860 KB partial
32 Partially correct 1 ms 860 KB partial
33 Partially correct 1 ms 604 KB partial
34 Correct 1 ms 604 KB ok
35 Correct 1 ms 604 KB ok
36 Partially correct 1 ms 604 KB partial
37 Partially correct 0 ms 604 KB partial
38 Partially correct 1 ms 852 KB partial
39 Partially correct 1 ms 604 KB partial
40 Partially correct 1 ms 604 KB partial
41 Partially correct 1 ms 604 KB partial
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 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 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 1 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 440 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 1 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 348 KB partial
21 Partially correct 1 ms 344 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 Partially correct 0 ms 348 KB partial
26 Partially correct 1 ms 344 KB partial
27 Partially correct 1 ms 348 KB partial
28 Partially correct 0 ms 348 KB partial
29 Partially correct 0 ms 348 KB partial
30 Partially correct 1 ms 860 KB partial
31 Partially correct 1 ms 860 KB partial
32 Partially correct 1 ms 860 KB partial
33 Partially correct 1 ms 604 KB partial
34 Correct 1 ms 604 KB ok
35 Correct 1 ms 604 KB ok
36 Partially correct 1 ms 604 KB partial
37 Partially correct 0 ms 604 KB partial
38 Partially correct 1 ms 852 KB partial
39 Partially correct 1 ms 604 KB partial
40 Partially correct 1 ms 604 KB partial
41 Partially correct 1 ms 604 KB partial
42 Partially correct 79 ms 19856 KB partial
43 Partially correct 57 ms 21248 KB partial
44 Partially correct 49 ms 15440 KB partial
45 Partially correct 52 ms 15184 KB partial
46 Partially correct 53 ms 17160 KB partial
47 Partially correct 48 ms 14896 KB partial
48 Correct 63 ms 14724 KB ok
49 Partially correct 55 ms 14684 KB partial
50 Partially correct 55 ms 21504 KB partial
51 Partially correct 62 ms 17536 KB partial
52 Partially correct 47 ms 14680 KB partial
53 Partially correct 47 ms 14936 KB partial
54 Partially correct 49 ms 14684 KB partial
55 Partially correct 49 ms 14684 KB partial
56 Partially correct 47 ms 14896 KB partial
57 Partially correct 55 ms 14964 KB partial
58 Partially correct 50 ms 14932 KB partial
59 Partially correct 48 ms 14980 KB partial
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 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 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 1 ms 348 KB partial
8 Partially correct 3 ms 1884 KB partial
9 Partially correct 55 ms 14684 KB partial
10 Partially correct 873 ms 133972 KB partial
11 Partially correct 0 ms 348 KB partial
12 Partially correct 1 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 0 ms 344 KB partial
16 Correct 0 ms 348 KB ok
17 Correct 0 ms 348 KB ok
18 Partially correct 0 ms 440 KB partial
19 Partially correct 0 ms 344 KB partial
20 Partially correct 0 ms 348 KB partial
21 Correct 1 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 348 KB partial
26 Partially correct 1 ms 344 KB partial
27 Correct 0 ms 348 KB ok
28 Correct 0 ms 348 KB ok
29 Partially correct 0 ms 348 KB partial
30 Partially correct 0 ms 348 KB partial
31 Partially correct 1 ms 344 KB partial
32 Partially correct 1 ms 348 KB partial
33 Partially correct 0 ms 348 KB partial
34 Partially correct 0 ms 348 KB partial
35 Partially correct 1 ms 860 KB partial
36 Partially correct 1 ms 860 KB partial
37 Partially correct 1 ms 860 KB partial
38 Partially correct 1 ms 604 KB partial
39 Correct 1 ms 604 KB ok
40 Correct 1 ms 604 KB ok
41 Partially correct 1 ms 604 KB partial
42 Partially correct 0 ms 604 KB partial
43 Partially correct 1 ms 852 KB partial
44 Partially correct 1 ms 604 KB partial
45 Partially correct 1 ms 604 KB partial
46 Partially correct 1 ms 604 KB partial
47 Partially correct 79 ms 19856 KB partial
48 Partially correct 57 ms 21248 KB partial
49 Partially correct 49 ms 15440 KB partial
50 Partially correct 52 ms 15184 KB partial
51 Partially correct 53 ms 17160 KB partial
52 Partially correct 48 ms 14896 KB partial
53 Correct 63 ms 14724 KB ok
54 Partially correct 55 ms 14684 KB partial
55 Partially correct 55 ms 21504 KB partial
56 Partially correct 62 ms 17536 KB partial
57 Partially correct 47 ms 14680 KB partial
58 Partially correct 47 ms 14936 KB partial
59 Partially correct 49 ms 14684 KB partial
60 Partially correct 49 ms 14684 KB partial
61 Partially correct 47 ms 14896 KB partial
62 Partially correct 55 ms 14964 KB partial
63 Partially correct 50 ms 14932 KB partial
64 Partially correct 48 ms 14980 KB partial
65 Partially correct 901 ms 211996 KB partial
66 Partially correct 836 ms 215756 KB partial
67 Partially correct 815 ms 155620 KB partial
68 Partially correct 844 ms 132268 KB partial
69 Partially correct 821 ms 143872 KB partial
70 Partially correct 807 ms 154100 KB partial
71 Partially correct 785 ms 134384 KB partial
72 Partially correct 827 ms 134068 KB partial
73 Correct 1165 ms 133972 KB ok
74 Correct 1144 ms 133968 KB ok
75 Partially correct 778 ms 134092 KB partial
76 Partially correct 875 ms 243348 KB partial
77 Partially correct 899 ms 242948 KB partial
78 Partially correct 854 ms 154200 KB partial
79 Partially correct 782 ms 143944 KB partial
80 Partially correct 765 ms 143864 KB partial
81 Partially correct 745 ms 140288 KB partial
82 Partially correct 742 ms 143764 KB partial
83 Partially correct 802 ms 174564 KB partial
84 Partially correct 798 ms 133684 KB partial
85 Partially correct 754 ms 133968 KB partial
86 Partially correct 753 ms 133904 KB partial
87 Partially correct 736 ms 133908 KB partial
88 Partially correct 741 ms 133968 KB partial
89 Partially correct 770 ms 133204 KB partial
90 Partially correct 745 ms 134224 KB partial
91 Partially correct 783 ms 134952 KB partial
92 Partially correct 793 ms 159088 KB partial
93 Partially correct 805 ms 157160 KB partial
94 Partially correct 805 ms 154160 KB partial
95 Partially correct 771 ms 154180 KB partial
96 Partially correct 770 ms 154032 KB partial
97 Partially correct 780 ms 154180 KB partial
98 Partially correct 736 ms 143872 KB partial
99 Partially correct 789 ms 157412 KB partial
100 Partially correct 786 ms 134412 KB partial
101 Partially correct 788 ms 134388 KB partial
102 Partially correct 778 ms 134284 KB partial
103 Partially correct 777 ms 134216 KB partial
104 Partially correct 824 ms 134284 KB partial
105 Partially correct 785 ms 134236 KB partial
106 Partially correct 832 ms 134284 KB partial
107 Partially correct 807 ms 134184 KB partial
108 Partially correct 882 ms 215576 KB partial
109 Partially correct 884 ms 215748 KB partial