제출 #839891

#제출 시각아이디문제언어결과실행 시간메모리
839891abdzag축구 경기장 (IOI23_soccer)C++17
1.50 / 100
240 ms31632 KiB
#include "soccer.h"
#include <bits/stdc++.h>

typedef long long ll;
const long long inf = 2e9;
using namespace std;

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    ll ans =0;
    bool bad=0;
    vector<pair<ll,ll>> corners={{0,0}, {0,N-1}, {N-1,0}, {N-1,N-1}};
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++){
            if(F[i][j] and find(corners.begin(),corners.end(),make_pair((ll)i,(ll)j))==corners.end()){
                bad=1;
            }
            ans+=!F[i][j];
        }
    }
    if(N==2 and ans==2 and ((F[0][1]==1 and F[1][0]==1) or (F[0][0]==1 and F[1][1]==1)))bad=1;
    if(bad)return -1;
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...