Submission #841376

# Submission time Handle Problem Language Result Execution time Memory
841376 2023-09-01T15:09:27 Z pera Soccer Stadium (IOI23_soccer) C++17
0 / 100
4500 ms 212 KB
#include<bits/stdc++.h>
#include "soccer.h"
using namespace std;

int biggest_stadium(int N , vector<vector<int>> F){
	int c = 0 , I , J;
	for(int i = 0;i < N;i ++){
		for(int j = 0;j < N;j ++){
			if(F[i][j] == 1){
				c ++;
				I = i , J = j;
			}
		}
	}
	if(c == 1){
		int ans = N * N;
		ans -= min({I , J , N - I - 1 , N - J - 1});
		return ans;
	}
	map<pair<pair<int , int> , pair<int , int>> , bool> ok;
	for(int i = 0;i < N;i ++){
		for(int j = 0;j < N;j ++){
			if(F[i][j] == 0){
				for(int k = j;k >= 0;k --){
					if(F[i][k] == 1) break;
					ok[{{i , j} , {i , k}}] = 1;
				}
				for(int k = j;k < N;k ++){
					if(F[i][k] == 1) break;
					ok[{{i , j} , {i , k}}] = 1;
				}
				for(int k = i;k >= 0;k --){
					if(F[k][j] == 1) break;
					ok[{{i , j} , {k , j}}] = 1;
				}
				for(int k = i;k < N;k ++){
					if(F[k][j] == 1) break;
					ok[{{i , j} , {k , j}}] = 1;
				}
			}
		}
	}
	for(int i = 0;i < N;i ++){
		for(int j = 0;j < N;j ++){
			if(F[i][j] == 0){
				for(int k1 = 0;k1 < N;k1 ++){
					for(int k2 = 0;k2 < N;k2 ++){
						if(k1 == i || k2 == j) continue;
						ok[{{i , j} , {k1 , k2}}] = ((ok[{{i , j} , {i , k2}}] && ok[{{i , k2} , {k1 , k2}}])
													|| (ok[{{i , j} , {k1 , j}}] && ok[{{k1 , j} , {k1 , k2}}]));
					}
				}
			}
		}
	}
	int ans = 0;
	for(int mk = 0;mk < (1 << (N * N));mk ++){
		int c = 0;
		vector<pair<int , int>> X;
		for(int i = 0;i < N;i ++){
			for(int j = 0;j < N;j ++){
				if((1 << (c ++)) & mk) X.push_back({i , j});
			}
		}
		int okk = 1;
		for(int i = 0;i < X.size();i ++){
			for(int j = 0;j < X.size();j ++){
				okk &= ok[{X[i] , X[j]}];	
			}
		}
		if(okk == 1) ans = max(ans , (int)X.size());
	}
	return ans;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:66:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |   for(int i = 0;i < X.size();i ++){
      |                 ~~^~~~~~~~~~
soccer.cpp:67:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |    for(int j = 0;j < X.size();j ++){
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 4561 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4561 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4561 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4561 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4561 ms 212 KB Time limit exceeded
2 Halted 0 ms 0 KB -