Submission #1065432

# Submission time Handle Problem Language Result Execution time Memory
1065432 2024-08-19T07:33:44 Z ReLice Soccer Stadium (IOI23_soccer) C++17
8 / 100
4500 ms 432 KB
#include "soccer.h"
#include <bits/stdc++.h>
#define ll int
#define pb push_back
#define ins insert
#define fr first
#define sc second
#define vll vector<ll>
#define sz size()
using namespace std;

const ll N = 7;
const ll M = N * N + 7;
const ll inf = 1e9 + 7;
vector<vll> f;
ll n;

bool ok(ll x,ll y){
	return x>=0 && x<n && y>=0 && y<n && !f[x][y];
}

bool can(ll x,ll y,ll x2,ll y2){
	ll a = 0;
	ll b = 0;
	ll xx = x;
	while(x != x2){
		a += f[x][y];
		b += f[x][y2];
		
		if(x < x2) x++;
		else x--;
	}
	x = xx;
	while(y != y2){
		a += f[x2][y];
		b += f[x][y];
		
		if(y < y2) y++;
		else y--;
	}
	if(min(a, b) == 0) return true;
	return false;
}

bool check(vll v){
	for(auto i : v){
		for(auto j : v){
			if(i == j)continue;
			ll x = i / n, y = i % n;
			
			ll x2 = j / n, y2 = j % n;
			
			if(!can(x, y, x2, y2)) return false;
		}
	}
	return true;
}
int biggest_stadium(int nn, vector<vector<int>> F){
	ll i;
	
	n = nn;
	f = F;
	
	ll ans = 0;
	
	for(ll mask=1;mask<(1ll<<(n*n));mask++){
		vll cur;
		for(i=0;i<n*n;i++){
			if(mask & (1ll<<i)) cur.pb(i);
		}
		
		if(check(cur)) ans = max(ans, (ll)cur.sz);
	} 
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 4517 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Incorrect 271 ms 404 KB wrong
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 344 KB ok
6 Correct 0 ms 432 KB ok
7 Correct 0 ms 344 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 1 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
# Verdict Execution time Memory Grader output
1 Execution timed out 4517 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4517 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4517 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4517 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -