답안 #841374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
841374 2023-09-01T15:07:21 Z pera 축구 경기장 (IOI23_soccer) C++17
8 / 100
4500 ms 680 KB
#include<bits/stdc++.h>
#include "soccer.h"
using namespace std;

int biggest_stadium(int N , vector<vector<int>> F){
	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:52: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]
   52 |   for(int i = 0;i < X.size();i ++){
      |                 ~~^~~~~~~~~~
soccer.cpp:53: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]
   53 |    for(int j = 0;j < X.size();j ++){
      |                  ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4514 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ok
2 Correct 1 ms 212 KB ok
3 Execution timed out 4546 ms 680 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB ok
2 Correct 1 ms 212 KB ok
3 Correct 1 ms 212 KB ok
4 Correct 1 ms 212 KB ok
5 Correct 1 ms 212 KB ok
6 Correct 1 ms 212 KB ok
7 Correct 1 ms 212 KB ok
8 Correct 1 ms 212 KB ok
9 Correct 1 ms 212 KB ok
10 Correct 1 ms 212 KB ok
11 Correct 1 ms 212 KB ok
12 Correct 1 ms 212 KB ok
13 Correct 1 ms 212 KB ok
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4514 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4514 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4514 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4514 ms 308 KB Time limit exceeded
2 Halted 0 ms 0 KB -