이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |