QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#217282#7120. Soccerhocky#8 54ms3816kbC++142.3kb2023-10-16 18:04:592023-10-16 18:04:59

Judging History

你现在查看的是测评时间为 2023-10-16 18:04:59 的历史记录

  • [2024-04-28 07:53:02]
  • 管理员手动重测本题所有提交记录
  • 测评结果:8
  • 用时:55ms
  • 内存:5864kb
  • [2023-10-16 18:04:59]
  • 评测
  • 测评结果:8
  • 用时:54ms
  • 内存:3816kb
  • [2023-10-16 18:04:59]
  • 提交

answer

#include "soccer.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PLL;
typedef vector <int> vi;
typedef vector <vi> vvi;
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i = a;i < b;i++)
#define trav(nx, v) for(auto &nx : v)
#define all(a) begin(a), end(a)
#define sz(v) (int) v.size()

int n;
int presum[1005][1005];
void init(const vvi &stadium){
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			presum[i + 1][j + 1] = stadium[i][j];
		}
	}
	rep(i,1,n + 1){
		rep(j,1,n + 1){
			presum[i][j] += presum[i - 1][j] + presum[i][j - 1] - presum[i - 1][j - 1];
		}
	}
}

LL query(PLL st, PLL ed){
	st.fi++; st.se++;
	ed.fi++; ed.se++;
	if(st.fi > ed.fi) swap(st.fi, ed.fi);
	if(st.se > ed.se) swap(st.se, ed.se);
	return presum[ed.fi][ed.se] - presum[st.fi - 1][ed.se] - presum[ed.fi][st.se - 1] + presum[st.fi - 1][st.se - 1];
}

bool check(const vvi &stadium){
			//~ rep(i,0,n) {
				//~ rep(j,0,n) cout << stadium[i][j];
				//~ cout << endl;
			//~ }
	rep(i,0,n){
		rep(j,0,n) {
			if(stadium[i][j] != 2) continue;
			rep(x,i,n){
				rep(y,0,n){
					if(x == i && y == j) continue;
					if(stadium[x][y] != 2) continue;
					bool bawah = query({i, j}, {x, j}) + query({x, j}, {x, y}) == 0;
					bool atas = query({i, j}, {i, y}) + query({i, y}, {x, y}) == 0;
						//~ cout << i << " " << j << " " << x << " " << y << " " << bawah << " " << atas << endl;
					if(!bawah && !atas) {
						
						//~ cout << i << " " << j << " " << x << " " << y << endl;
						//~ exit(0);	
						return 0;
					}
				}
			}
		}
	}
	return 1;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F){
	vvi tmp = F;
	n = N;
	init(tmp);
	int ans = 0;
	rep(mask,1,(1<<(N * N))){
		rep(i,0,N) rep(j,0,N) if(tmp[i][j] == 2) tmp[i][j] = 0;
		bool can = 1;
		rep(i,0,N * N) if((mask>>i)&1 && tmp[i/N][i%N] == 1) can = 0;
		if(!can) continue;
		rep(i,0,N * N) if((mask>>i)&1 && tmp[i/N][i%N] == 0){
			tmp[i/N][i%N] = 2;
		}
		can = check(tmp);
		if(!can) continue;
		auto curans = __builtin_popcount(mask);
		if(curans > ans){
			ans = curans;
			//~ cout << "WT" << endl;
			//~ rep(i,0,N) {
				//~ rep(j,0,N) cout << tmp[i][j];
				//~ cout << endl;
			//~ }
		
		}
	}
    return ans	;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
1
0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
1

result:

ok ok

Test #2:

score: 1.5
Acceptable Answer
time: 1ms
memory: 3688kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
0 1 0
0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

points 0.250 partial

Test #3:

score: 0
Time Limit Exceeded

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:


result:


Subtask #2:

score: 8
Accepted

Test #10:

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

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

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

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

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: 1ms
memory: 3664kb

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: 1ms
memory: 3700kb

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

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 0
1 0 0
0 1 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Test #18:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
1 1 1
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
2

result:

ok ok

Test #19:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
0 0 1
1 0 1
0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
3

result:

ok ok

Test #20:

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

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
3
1 0 1
0 0 0
1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
6

result:

ok ok

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #21:

score: 5.5
Acceptable Answer
time: 54ms
memory: 3692kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 0
0 0 0 0 0 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
12

result:

points 0.250 partial

Test #22:

score: 5.5
Acceptable Answer
time: 32ms
memory: 3684kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 1 0 0
0 0 0 0 0 0 0
1 0 0 0 0 1 0
0 0 0 0 1 0 0

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
8

result:

points 0.250 partial

Test #23:

score: 5.5
Acceptable Answer
time: 21ms
memory: 3816kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 0 1 0 0 0
0 0 0 0 0 1 0
0 1 0 0 0 0 0
0 0 0 0 1 0 0
0 0 0 0 1 0 0
1 0 0 0 0 1 0
0 1 0 0 1 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #24:

score: 5.5
Acceptable Answer
time: 24ms
memory: 3716kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 1 1 0 1 0
1 1 0 0 0 1 0
0 1 0 0 0 0 1
0 0 0 1 1 1 0
0 0 1 0 1 0 0
1 0 1 0 0 1 1
0 1 1 0 1 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #25:

score: 5.5
Acceptable Answer
time: 24ms
memory: 3704kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
0 0 1 1 0 0 1
1 1 1 1 1 1 1
0 0 0 1 1 1 1
1 1 1 1 0 1 1
1 1 1 1 1 0 1
1 0 0 0 0 0 0
1 0 0 1 0 0 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

points 0.250 partial

Test #26:

score: 0
Wrong Answer
time: 24ms
memory: 3712kb

input:

R0R7sb2atQWJ6SAWOjw4ZG7Gwgo5zl9L
7
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 0 1 1
1 1 1 0 0 0 1
1 1 1 1 0 1 1
1 1 1 1 0 1 1

output:

xlqtkQVzqzbOJxjzxlqsyVrlM2kqlbK0
OK
0

result:

wrong answer wrong

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%