#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;
ll sum = 0;
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 (flag) return sum;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 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 |
344 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
2 ms |
860 KB |
partial |
8 |
Partially correct |
13 ms |
5908 KB |
partial |
9 |
Runtime error |
247 ms |
111884 KB |
Execution killed with signal 11 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Partially correct |
1 ms |
348 KB |
partial |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Incorrect |
0 ms |
348 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
partial |
2 |
Correct |
1 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
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 |
0 ms |
348 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 |
344 KB |
ok |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 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 |
344 KB |
ok |
6 |
Partially correct |
1 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
348 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 |
344 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
2 ms |
860 KB |
partial |
9 |
Partially correct |
13 ms |
5908 KB |
partial |
10 |
Runtime error |
247 ms |
111884 KB |
Execution killed with signal 11 |
11 |
Halted |
0 ms |
0 KB |
- |