Submission #1065473

# Submission time Handle Problem Language Result Execution time Memory
1065473 2024-08-19T08:10:25 Z ReLice Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 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 = 1e3 + 7;
const ll M = N * N + 7;
const ll inf = 1e9 + 7;
vector<vll> f;
ll n;
ll pref[N][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,j;
	
	n = nn;
	f = F;
	
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			sum += (1 - f[i - 1][j - 1]);
			pref[i][j] = pref[i - 1][j] + pref[i][j - 1] - pref[i - 1][j - 1] + (1 - f[i - 1][j - 1]);
		}
	}
	
	bool flag = 1;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(f[i - 1][j - 1]){
				ll x = pref[i][j] - pref[i][j - 1];
				ll y = pref[n][j] - pref[n][j - 1] - x;
				if(x && y) flag = 0;
				x = pref[i][j] - pref[i - 1][j];
				y = pref[i][n] - pref[i - 1][n] - x;
				if(x && y) flag = 0; 
			}
		}
	}
	
	if (f) return sum;
	return 1;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:67:4: error: 'sum' was not declared in this scope
   67 |    sum += (1 - f[i - 1][j - 1]);
      |    ^~~
soccer.cpp:86:6: error: could not convert 'f' from 'std::vector<std::vector<int> >' to 'bool'
   86 |  if (f) return sum;
      |      ^
      |      |
      |      std::vector<std::vector<int> >
soccer.cpp:86:16: error: 'sum' was not declared in this scope
   86 |  if (f) return sum;
      |                ^~~