Submission #1066480

# Submission time Handle Problem Language Result Execution time Memory
1066480 2024-08-19T22:46:30 Z aaaaaarroz Soccer Stadium (IOI23_soccer) C++17
8 / 100
4500 ms 32736 KB
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, vector<vector<int>> F){
	map<tuple<int,int,int>,bool>libre;
	for(int fila=0;fila<N;fila++){
		for(int i=0;i<N;i++){
			for(int j=i;j<N;j++){
				if(i==j){
					libre[{fila,i,j}]=!F[fila][j];
				}
				else{
					libre[{fila,i,j}]=(!F[fila][j])&&libre[{fila,i,j-1}];
				}
			}
		}
	}
	int best=0;
	for(int fila=0;fila<N;fila++){
		for(int columna=0;columna<N;columna++){
			for(int i=0;i<=columna;i++){
				for(int j=columna;j<N;j++){
					if(libre[{fila,i,j}]){
						vector<pair<int,int>>almacen;
						almacen.push_back({i,j});
						int suma=0;
						int fil=fila-1;
						while(fil>=0&&F[fil][columna]!=1){
							int l=columna,r=columna;
							while(l>=almacen.back().first&&r<=almacen.back().second){
								if(libre[{fil,l-1,r}]&&(l-1)>=almacen.back().first){
									l--;
								}
								else if(libre[{fil,l,r+1}]&&(r+1)<=almacen.back().second){
									r++;
								}
								else{
									break;
								}
							}
							almacen.push_back({l,r});
							fil--;
						}
						almacen.push_back({i,j});
						fil=fila+1;
						int fila_extra=1;
						int alm_ant=almacen.size()-1;
						while(fil<N&&F[fil][columna]!=1){
							if(fila_extra<alm_ant){
								int l1=columna,r1=columna;
								l1=almacen[fila_extra].first;
								r1=almacen[fila_extra].second;
								while(l1>=almacen.back().first&&r1<=almacen.back().second){
									if(libre[{fil,l1-1,r1}]&&(l1-1)>=almacen.back().first){
										l1--;
									}
									else if(libre[{fil,l1,r1+1}]&&(r1+1)<=almacen.back().second){
										r1++;
									}
									else{
										break;
									}
								}
								int l=columna,r=columna;
								while(l>=almacen[fila_extra].first&&r<=almacen[fila_extra].second){
									if(libre[{fil,l-1,r}]&&(l-1)>=almacen[fila_extra].first){
										l--;
									}
									else if(libre[{fil,l,r+1}]&&(r+1)<=almacen[fila_extra].second){
										r++;
									}
									else{
										break;
									}
								}
								if(libre[{fil,l1,r1}]&&l1>=almacen.back().first&&r1<=almacen.back().second){
									almacen.push_back({l1,r1});
								}
								else{
									almacen.push_back({l,r});
								}
								fil++;
								fila_extra++;
							}
							else{
								int l=columna,r=columna;
								while(l>=almacen.back().first&&r<=almacen.back().second){
									if(libre[{fil,l-1,r}]&&(l-1)>=almacen.back().first){
										l--;
									}
									else if(libre[{fil,l,r+1}]&&(r+1)<=almacen.back().second){
										r++;
									}
									else{
										break;
									}
								}
								almacen.push_back({l,r});
								fil++;
							}
						}
						for(auto[x,y]:almacen){
							suma+=(y-x+1);
						}
						suma-=(j-i+1);
						best=max(suma,best);
					}
					else{
						continue;
					}
				}
			}
		}
	}
	return best;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 3 ms 348 KB ok
4 Correct 6 ms 472 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Execution timed out 4601 ms 32736 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 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 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 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 1 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Correct 0 ms 344 KB ok
# 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 344 KB ok
5 Correct 0 ms 344 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 1 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 1 ms 348 KB ok
14 Correct 0 ms 344 KB ok
15 Partially correct 1 ms 344 KB partial
16 Partially correct 1 ms 348 KB partial
17 Correct 1 ms 344 KB ok
18 Correct 1 ms 344 KB ok
19 Correct 0 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 1 ms 436 KB ok
22 Incorrect 1 ms 348 KB wrong
23 Halted 0 ms 0 KB -
# 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 3 ms 348 KB ok
5 Correct 6 ms 472 KB ok
6 Correct 0 ms 344 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 1 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 0 ms 344 KB ok
17 Partially correct 1 ms 344 KB partial
18 Partially correct 1 ms 348 KB partial
19 Correct 1 ms 344 KB ok
20 Correct 1 ms 344 KB ok
21 Correct 0 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 436 KB ok
24 Incorrect 1 ms 348 KB wrong
25 Halted 0 ms 0 KB -
# 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 3 ms 348 KB ok
5 Correct 6 ms 472 KB ok
6 Correct 0 ms 344 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 1 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 0 ms 344 KB ok
17 Partially correct 1 ms 344 KB partial
18 Partially correct 1 ms 348 KB partial
19 Correct 1 ms 344 KB ok
20 Correct 1 ms 344 KB ok
21 Correct 0 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 436 KB ok
24 Incorrect 1 ms 348 KB wrong
25 Halted 0 ms 0 KB -
# 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 3 ms 348 KB ok
5 Correct 6 ms 472 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Execution timed out 4601 ms 32736 KB Time limit exceeded
9 Halted 0 ms 0 KB -