#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
#define pf push_front
#define pb push_back
#define ll long long
#define vi vector<int>
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
vector<array<int,2>> v;
int n, a[10][10];
int recur(int pos){
if(pos==sz(v)){
int tot = 0;
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
if(!a[i][j]) tot++;
return tot;
}
if(a[v[pos][0]][v[pos][1]]) return recur(pos+1);
int ans = 0;
for(int i = 0; i <= v[pos][0]; i++)
for(int j = 0; j <= v[pos][1]; j++)
a[i][j]++;
ans = max(ans, recur(pos+1));
for(int i = 0; i <= v[pos][0]; i++)
for(int j = 0; j <= v[pos][1]; j++)
a[i][j]--;
for(int i = 0; i <= v[pos][0]; i++)
for(int j = v[pos][1]; j < n; j++)
a[i][j]++;
ans = max(ans, recur(pos+1));
for(int i = 0; i <= v[pos][0]; i++)
for(int j = v[pos][1]; j < n; j++)
a[i][j]--;
for(int i = v[pos][0]; i < n; i++)
for(int j = 0; j <= v[pos][1]; j++)
a[i][j]++;
ans = max(ans, recur(pos+1));
for(int i = v[pos][0]; i < n; i++)
for(int j = 0; j <= v[pos][1]; j++)
a[i][j]--;
for(int i = v[pos][0]; i < n; i++)
for(int j = v[pos][1]; j < n; j++)
a[i][j]++;
ans = max(ans, recur(pos+1));
for(int i = v[pos][0]; i < n; i++)
for(int j = v[pos][1]; j < n; j++)
a[i][j]--;
return ans;
}
int biggest_stadium(int N, vector<vi> F)
{
n = N; v.clear();
for(int i = 0; i < N; i++)
for(int j = 0; j < N; j++)
if(F[i][j]) v.pb({i,j});
return recur(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
440 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
440 KB |
ok |
3 |
Correct |
0 ms |
344 KB |
ok |
4 |
Correct |
0 ms |
436 KB |
ok |
5 |
Incorrect |
0 ms |
348 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
440 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
0 ms |
436 KB |
ok |
6 |
Incorrect |
0 ms |
348 KB |
wrong |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
440 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
436 KB |
ok |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
440 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
344 KB |
ok |
7 |
Correct |
0 ms |
436 KB |
ok |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
440 KB |
ok |
4 |
Correct |
0 ms |
344 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
9 |
Halted |
0 ms |
0 KB |
- |