Submission #1077364

# Submission time Handle Problem Language Result Execution time Memory
1077364 2024-08-27T05:59:18 Z emptypringlescan Soccer Stadium (IOI23_soccer) C++17
2 / 100
1 ms 436 KB
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int n,vector<vector<int> > arr){
	int close[4][n][n];
	for(int j=0; j<n; j++){
		int prv=-1;
		for(int i=0; i<n; i++){
			if(arr[i][j]) prv=i;
			close[0][i][j]=prv;
		}
		prv=n;
		for(int i=n-1; i>=0; i--){
			if(arr[i][j]) prv=i;
			close[1][i][j]=prv;
		}
	}
	for(int i=0; i<n; i++){
		int prv=-1;
		for(int j=0; j<n; j++){
			if(arr[i][j]) prv=j;
			close[2][i][j]=prv;
		}
		prv=n;
		for(int j=n-1; j>=0; j--){
			if(arr[i][j]) prv=j;
			close[3][i][j]=prv;
		}
	}
	int pref[4][n+5][n+5];
	memset(pref,0,sizeof(pref));
	for(int i=0; i<n; i++) for(int j=0; j<n; j++) arr[i][j]^=1;
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			pref[0][i+1][j+1]=pref[0][i+1][j]+pref[0][i][j+1]-pref[0][i][j]+arr[i][j];
		}
		for(int j=n-1; j>=0; j--){
			pref[1][i+1][j+1]=pref[1][i+1][j+2]+pref[1][i][j+1]-pref[1][i][j+2]+arr[i][j];
		}
	}
	for(int i=n-1; i>=0; i--){
		for(int j=0; j<n; j++){
			pref[2][i+1][j+1]=pref[2][i+1][j]+pref[2][i+2][j+1]-pref[2][i+2][j]+arr[i][j];
		}
		for(int j=n-1; j>=0; j--){
			pref[3][i+1][j+1]=pref[3][i+1][j+2]+pref[3][i+2][j+1]-pref[3][i+2][j+2]+arr[i][j];
		}
	}
	for(int a=1; a<=n; a++){
		for(int b=1; b<=n; b++){
			if(arr[a-1][b-1]==0) continue;
			int u=close[0][a-1][b-1],d=close[1][a-1][b-1],l=close[2][a-1][b-1],r=close[3][a-1][b-1];
			//cout << a << ' ' << b << '\n';
			//cout << u << ' ' << d << ' ' << l << ' ' << r << '\n';
			if(pref[0][u+1][l+1]) return 0;
			if(pref[1][u+1][r+1]) return 0;
			if(pref[2][d+1][l+1]) return 0;
			if(pref[3][d+1][r+1]) return 0;
		}
	}
	return pref[0][n][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 436 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 344 KB ok
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 436 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 0 ms 432 KB partial
4 Partially correct 0 ms 432 KB partial
5 Partially correct 0 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 436 KB partial
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Partially correct 1 ms 348 KB partial
11 Partially correct 1 ms 348 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 0 ms 436 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 432 KB partial
5 Partially correct 0 ms 432 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 436 KB partial
9 Correct 1 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Partially correct 1 ms 348 KB partial
12 Partially correct 1 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Incorrect 0 ms 348 KB wrong
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 436 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Partially correct 0 ms 432 KB partial
7 Partially correct 0 ms 432 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 ms 436 KB partial
11 Correct 1 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Partially correct 1 ms 348 KB partial
14 Partially correct 1 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Incorrect 0 ms 348 KB wrong
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 436 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Partially correct 0 ms 432 KB partial
7 Partially correct 0 ms 432 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 ms 436 KB partial
11 Correct 1 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Partially correct 1 ms 348 KB partial
14 Partially correct 1 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Incorrect 0 ms 348 KB wrong
18 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Correct 0 ms 436 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -