# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082692 | HappyCapybara | Soccer Stadium (IOI23_soccer) | C++17 | 2055 ms | 600 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
int n;
vector<vector<int>> f;
int check(){
int res = 0;
vector<pair<int,int>> c;
for (int i=0; i<n; i++){
int b = 0;
for (int j=0; j<n; j++){
if (f[i][j] == 2){
if (b == 0) b = 1;
if (b == 2) return 0;
res++;
int nb = 0;
if (i > 0 && f[i-1][j] == 2) nb++;
if (i < n-1 && f[i+1][j] == 2) nb++;
if (j > 0 && f[i][j-1] == 2) nb++;
if (j < n-1 && f[i][j+1] == 2) nb++;
if (nb <= 2) c.push_back({i, j});
}
else {
if (b == 1) b = 2;
}
}
}
for (int j=0; j<n; j++){
int b = 0;
for (int i=0; i<n; i++){
if (f[i][j] == 2){
if (b == 0) b = 1;
if (b == 2) return 0;
}
else {
if (b == 1) b = 2;
}
}
}
for (int i=0; i<c.size()-1; i++){
for (int j=i+1; j<c.size(); j++){
if (f[c[i].first][c[j].second] < 2 && f[c[j].first][c[i].second] < 2) return 0;
}
}
return res;
}
int biggest_stadium(int N, vector<vector<int>> F){
n = N;
f = F;
int res = 0;
for (int i=(1<<(N*N))-1; i>=1; i--){
bool valid = true;
for (int j=0; j<N; j++){
for (int k=0; k<N; k++){
if (i & 1<<(j*N+k)){
if (F[j][k]) valid = false;
f[j][k] = 2;
}
else f[j][k] = F[j][k];
if (!valid) break;
}
if (!valid) break;
}
if (valid) res = max(res, check());
}
return res;
}
Compilation message (stderr)
# | 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... |