QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#177520#7120. Soccertriple321#6 156ms34808kbC++203.6kb2023-09-13 01:04:572024-04-28 07:41:06

Judging History

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

  • [2024-04-28 07:41:06]
  • 管理员手动重测本题所有提交记录
  • 测评结果:6
  • 用时:156ms
  • 内存:34808kb
  • [2023-09-13 01:04:58]
  • 评测
  • 测评结果:6
  • 用时:178ms
  • 内存:34740kb
  • [2023-09-13 01:04:57]
  • 提交

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);


int biggest_stadium(int n, vector<vector<int>> f)
{
	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];
	vector<int> tree[n];
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(f[i][j])
			{
				tree[i].push_back(j);
			}
		}
	}
	if(n > 30)
	{
		for(int i = 0; i < n; i++)
		{
			lg bef = 0, aft = 0;
			for(auto it : tree[i])
			{
				lg x = it;
				while(x >= 0)
				{
					bef += !f[i][x];
					x--;
				}
				x = it;
				while(x < n)
				{
					aft += !f[i][x];
					x++;
				}
			}
			if(bef && aft)	pos = 0;
			tree[i].clear();
		}
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				if(f[i][j])
				{
					tree[j].push_back(i);
				}
			}
		}
		for(int i = 0; i < n; i++)
		{
			lg bef = 0, aft = 0;
			for(auto it : tree[i])
			{
				lg x = it;
				while(x >= 0)
				{
					bef += !f[x][i];
					x--;
				}
				x = it;
				while(x < n)
				{
					aft += !f[x][i];
					x++;
				}
			}
			if(bef && aft)	pos = 0;
		}	
	}
	else{
		for(int i = 0; i < n; i++)
		{
			for(int j = 0; j < n; j++)
			{
				if(f[i][j])	continue;
				for(int k = 0; k < n; k++)
				{
					for(int z = 0; z < n; z++)
					{
						if(f[k][z])	continue;
						if(i == k && j == z)	continue;
						if(i == k)
						{
							for(int g = min(j, z); g <= max(j, z); g++)
							{
								if(f[i][g])	pos = 0;
								if(!pos)	break;
							}
							continue;
						}
						if(j == z)
						{
							for(int g = min(i, k); g <= max(i, k); g++)
							{
								if(f[g][j])	pos = 0;
								if(!pos)	break;
							}
							continue;
						}
						lg l = min(i, k), r = max(i, k);
						if(!f[i][z])	continue;
						if(!f[k][j])	continue;
						pos = 0;
						break;
					}
					if(!pos)	break;
				}
				if(!pos)	break;
			}
			if(!pos)	break;
		}
	}
	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)
			{
				for(auto it2 : a)
				{
					if(it == it2)	continue;
					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(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(!f[it[0]][it2[1]])	continue;
					if(!f[it2[0]][it[1]])	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: 1ms
memory: 4068kb

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: 3876kb

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: 11ms
memory: 5312kb

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: 156ms
memory: 34808kb

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: 3840kb

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: 3820kb

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: 3804kb

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: 0ms
memory: 3752kb

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: 3804kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #12:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
5

result:

ok ok

Test #13:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
1 0 0
1 0 1
0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
4

result:

ok ok

Test #14:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #15:

score: 8
Accepted
time: 0ms
memory: 3840kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
0 0 1
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
7

result:

ok ok

Test #16:

score: 8
Accepted
time: 0ms
memory: 3816kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 0 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
9

result:

ok ok

Test #17:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
1 0 0
0 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #18:

score: 0
Wrong Answer
time: 1ms
memory: 4116kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
1 1 1
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
3

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%