답안 #937307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937307 2024-03-03T19:38:36 Z Dan4Life 축구 경기장 (IOI23_soccer) C++17
8 / 100
4500 ms 512 KB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;

#define pf push_front
#define pb push_back
#define ll long long
#define vi vector<int>
#define sz(a) (int)a.size()
#define lb lower_bound
#define ub upper_bound
#define all(a) begin(a),end(a)

const int mxN = 2010;
int n;
vector<int> col[mxN];

int biggest_stadium(int N, vector<vi> a)
{
	n = N; int ans = 0;
	
	for(int i = 0; i < n; i++) 
		col[i].clear(), col[i].pb(-1);
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			if(a[i][j]) col[j].pb(i);
	for(int i = 0; i < n; i++) col[i].pb(n);
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(a[i][j]) continue;
			for(int k = i; k < n; k++){
				if(a[k][j]) break; 
				for(int l = j; l < n; l++){
					int tot = 0;
					int pos = lb(all(col[l]),i)-begin(col[l]);
					if(col[l][pos]<=k) break; // if a[i][l]...a[k][l] contains forest
					
					int DOWN = i, UP = i;
					while(UP>0 and !a[UP-1][l]) UP--;   		// while we dont have forest, go up
					while(DOWN<n-1 and !a[DOWN+1][l]) DOWN++; 	//          " "               go down
					tot+=DOWN-UP+1; if(l!=j) tot+=k-i+1;
					int up2 = UP, down2 = DOWN;
					
					bool bad = 0;
					for(int m = l-1; m > j; m--){
						int pos = lb(all(col[m]),i)-begin(col[m]);
						int up = max(UP, col[m][pos-1]+1); 
						int down = min(DOWN, col[m][pos]-1);
						if(up>down) bad = 1;
						UP = up, DOWN = down; tot+=down-up+1;
					}
					if(bad) continue;
					UP = up2, DOWN = down2;
					for(int m = l+1; m < n; m++){
						int pos = lb(all(col[m]),i)-begin(col[m]);
						int up = max(UP, col[m][pos-1]+1); 
						int down = min(DOWN, col[m][pos]-1);
						if(up>down) break;
						UP = up, DOWN = down; tot+=down-up+1;
					}
					ans = max(ans, tot); 
				}
			}
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 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 1 ms 348 KB ok
7 Execution timed out 4562 ms 348 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 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 Correct 0 ms 348 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 1 ms 512 KB ok
13 Correct 1 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 348 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 1 ms 512 KB ok
14 Correct 1 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 0 ms 348 KB ok
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Correct 1 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 348 KB ok
22 Correct 0 ms 344 KB ok
23 Incorrect 1 ms 348 KB wrong
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 348 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
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 512 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 0 ms 348 KB ok
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Correct 0 ms 344 KB ok
25 Incorrect 1 ms 348 KB wrong
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 348 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
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 512 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 0 ms 348 KB ok
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Correct 0 ms 344 KB ok
25 Incorrect 1 ms 348 KB wrong
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 ms 348 KB ok
8 Execution timed out 4562 ms 348 KB Time limit exceeded
9 Halted 0 ms 0 KB -