QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#177536#7120. Soccertriple321#6 255ms35376kbC++203.5kb2023-09-13 01:57:142024-04-28 07:41:25

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 07:41:25]
  • 管理员手动重测本题所有提交记录
  • 测评结果:6
  • 用时:255ms
  • 内存:35376kb
  • [2023-09-13 01:57:15]
  • 评测
  • 测评结果:6
  • 用时:259ms
  • 内存:35616kb
  • [2023-09-13 01:57:14]
  • 提交

answer

#include <bits/stdc++.h>
#ifndef CYBER
#include "soccer.h"
#endif
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("Ofast")

using namespace std;
using namespace __gnu_pbds;

#define lg long long
#define ordered_set	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

lg dx[] = {1, 0, -1, 0};
lg dy[] = {0, 1, 0, -1}, N;

lg valid(lg i, lg j)
{
	return i >= 0 && i < N && j >= 0 && j < N;
}


int biggest_stadium(int n, vector<vector<int>> f)
{
	N = n;
	lg pos = 1, ans = 0, sum = 0;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < n; j++)
			ans += !f[i][j], sum += f[i][j];
	set<lg> se[5];
	//down, right, up, left
	for(int i = 0; i < n; i++)
	{
		lg xgh = 0;
		for(int j = 0; j < n; j++)
		{
			if(f[i][j])	continue;
			if(i && j && f[i-1][j] && f[i][j-1])
			{
				auto it = se[4].lower_bound(j);
				if(it != se[4].begin())	pos = 0;
			}
			if(i+1 < n && j && f[i+1][j] && f[i][j-1])
			{
				auto it = se[4].lower_bound(j);
				if(it != se[4].begin())	pos = 0;
			}
			if(i && f[i-1][j])
			{
				auto it = se[0].lower_bound(i);
				if(it != se[0].begin())	pos = 0;
			}
			if(i+1 < n && f[i+1][j])
			{
				auto it = se[2].upper_bound(i);
				if(it != se[2].end())	pos = 0;
			}
			if(j && f[i][j-1])
			{
				if(xgh)	
				{
					pos = 0;
				}
			}
			for(int k = 0; k < 4; k++)
			{
				lg newI = i+dx[k], newJ = j+dy[k];
				if(!valid(newI, newJ))	continue;
				if(f[newI][newJ])
				{
					se[k].insert(newI);
				}
			}
			xgh = true;
			se[4].insert(j);
		}
	}
	// if(!pos)	return -1;
	if(!pos)	ans = 1;
	if(sum == 1 && !pos)
	{
		int idI = 0, idJ = 0;
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				if(f[i][j])
				{
					idI = i, idJ = j;
				}
			}
		}
		idI++;
		idJ++;
		// cout << idI << ' ' << idJ << '\n';
		// cout << idI*idJ << ' ' << idJ*(n-idI+1) << ' ' << idI*(n-idJ+1) << ' ' << (n-idJ+1)*(n-idI+1) << '\n';
		ans = n*n-min({idI*idJ, idJ*(n-idI+1), idI*(n-idJ+1), (n-idJ+1)*(n-idI+1)});
	}
	else if(n <= 3 && !pos)
	{
		for(int i = 0; i < (1ll << (n*n)); i++)
		{
			vector<array<lg, 2>> a;
			for(int j = 0; j < n*n; j++)
			{
				if((1ll << j)&i)
				{
					a.push_back({j/n, j%n});
				}
			}
			lg o = 1;
			for(auto it : a)
			{
				if(f[it[0]][it[1]])	o = 0;
				for(auto it2 : a)
				{
					if(it[0] == it2[0])
					{
						for(int j = min(it[1], it2[1]); j <= max(it[1], it2[1]); j++)
						{
							if(f[it[0]][j]) o = 0;
						}
						if(o)	continue;
					}
					if(it[1] == it2[1])
					{
						for(int j = min(it[0], it2[0]); j <= max(it[0], it2[0]); j++)
						{
							if(f[j][it[1]]) o = 0;
						}
						if(o)	continue;
					}
					lg d = 1, h = 1;
					if(!f[it[0]][it2[1]])	
					{
						for(int i = min(it[1], it2[1]); i <= max(it[1], it2[1]); i++)
						{
							if(f[it[0]][i])	d = 0;
						}
						for(int i = min(it[0], it2[0]); i <= max(it[0], it2[0]); i++)
						{
							if(f[i][it2[1]])	d = 0;
						}
						if(d)	continue;
					}
					if(!f[it2[0]][it[1]])	
					{
						for(int i = min(it[1], it2[1]); i <= max(it[1], it2[1]); i++)
						{
							if(f[it2[0]][i])	h = 0;
						}
						for(int i = min(it[0], it2[0]); i <= max(it[0], it2[0]); i++)
						{
							if(f[i][it[1]])	h = 0;
						}
						if(h)	continue;
					}
					o = 0;
					break;
				}
			}
			ans = max(ans, (lg)(o*a.size()));
		}
	}
	return ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 6
Accepted

Test #1:

score: 6
Accepted
time: 0ms
memory: 3884kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

score: 6
Accepted
time: 0ms
memory: 3812kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #3:

score: 6
Accepted
time: 1ms
memory: 3860kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
9850

result:

ok ok

Test #4:

score: 6
Accepted
time: 16ms
memory: 5872kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
236536

result:

ok ok

Test #5:

score: 6
Accepted
time: 255ms
memory: 35376kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
2000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
3786181

result:

ok ok

Test #6:

score: 6
Accepted
time: 1ms
memory: 3808kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
9
1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
80

result:

ok ok

Test #7:

score: 6
Accepted
time: 0ms
memory: 3872kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
10
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
99

result:

ok ok

Test #8:

score: 6
Accepted
time: 0ms
memory: 3796kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Test #9:

score: 6
Accepted
time: 0ms
memory: 4104kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

ok ok

Subtask #2:

score: 0
Wrong Answer

Test #10:

score: 8
Accepted
time: 1ms
memory: 3836kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #11:

score: 8
Accepted
time: 1ms
memory: 4072kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 3812kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

wrong answer wrong

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%