답안 #1069619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069619 2024-08-22T07:14:56 Z Faisal_Saqib 축구 경기장 (IOI23_soccer) C++17
6 / 100
256 ms 63056 KB
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define vll vector<ll>
#define pb push_back
int biggest_stadium(int n, std::vector<std::vector<int>> grid)
{
	vector<pair<int,int>> trees;
	int row[n][n],col[n][n];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			row[i][j]=col[i][j]=-1;
			if(grid[i][j])
				trees.pb({i,j});
		}
		row[i][n-1]=-1;
		for(int j=n-2;j>=0;j--)
		{
			if(grid[i][j]!=grid[i][j+1])
			{
				row[i][j]=j+1;
			}
			else
			{
				row[i][j]=row[i][j+1];
			}
		}
	}
	for(int j=0;j<n;j++)
	{
		col[n-1][j]=-1;
		for(int i=n-2;i>=0;i--)
		{
			if(grid[i][j]!=grid[i+1][j])
			{
				col[i][j]=i+1;
			}
			else
			{
				col[i][j]=col[i+1][j];
			}
		}
	}
	if(trees.size()==0)
	{
		return (n*n);
	}
	else if(trees.size()==1)
	{
		int x=trees[0].first;
		int y=trees[0].second;
		return (n*n)-min({(x+1)*(y+1),(n-x)*(y+1),(n-y)*(x+1),(n-y)*(n-x)});
	}
	else
	{
		bool can=1;
		for(int i=0;i<n;i++)
		{
			for(int j=0;j<n;j++)
			{
				if(grid[i][j]==0)
				{
					if(row[i][j]!=-1 and col[i][row[i][j]]!=-1)
					{
						can=0;
					}
					if(col[i][j]!=-1 and row[col[i][j]][j]!=-1)
					{
						can=0;
					}
					if(row[i][j]!=-1 and row[i][row[i][j]]!=-1)
					{
						can=0;
					}
					if(col[i][j]!=-1 and col[col[i][j]][j]!=-1)
					{
						can=0;
					}
				}
			}
		}
		if(can)
		{
			return (n*n)-(int)trees.size();
		}
		else
		{
			return min(1,(n*n)-(int)trees.size());
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 15 ms 4252 KB ok
9 Correct 256 ms 63056 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 0 ms 344 KB partial
4 Partially correct 1 ms 348 KB partial
5 Partially correct 0 ms 348 KB partial
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 344 KB partial
5 Partially correct 1 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Incorrect 0 ms 348 KB wrong
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Incorrect 0 ms 348 KB wrong
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 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 1 ms 348 KB ok
9 Correct 15 ms 4252 KB ok
10 Correct 256 ms 63056 KB ok
11 Partially correct 0 ms 344 KB partial
12 Partially correct 1 ms 348 KB partial
13 Partially correct 0 ms 348 KB partial
14 Incorrect 0 ms 348 KB wrong
15 Halted 0 ms 0 KB -