Submission #858270

#TimeUsernameProblemLanguageResultExecution timeMemory
858270Danilo21Soccer Stadium (IOI23_soccer)C++17
1.50 / 100
243 ms48408 KiB
#include <bits/stdc++.h>
#include "soccer.h"

#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define en '\n'
#define sp ' '
#define tb '\t'
#define ri(n) int n; cin >> n
#define rl(n) ll n; cin >> n
#define rs(s) string s; cin >> s
#define rc(c) char c; cin >> c
#define rv(v) for (auto &x : v) cin >> x
#define pven(v) for (auto x : v) cout << x << en
#define pv(v) for (auto x : v) cout << x << sp; cout << en
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yes cout << "YES" << en
#define no cout << "NO" << en
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
#define ssort(a, b) if (a < b) swap(a, b)
#define bitcnt(a) (__builtin_popcountll(a))
#define bithigh(a) (63-__builtin_clzll(a))
#define lg bithigh
#define highpow(a) (1LL << (ll)lg(a))

using namespace std;

const ll LINF = 2e18;
const int mxN = 300, INF = 2e9;

bool Check(int N, vector<vector<int> > F){

    for (int i = 0; i < N; i++){
        bool f = 0;
        for (int j = 0; j < N; j++){
            if (!F[i][j]){
                if (f) return 0;
                while (j+1 < N && !F[i][j+1])
                    j++;
                f = 1;
            }
        }
    }
    return 1;
}

int biggest_stadium(int N, vector<vector<int>> F){

    if (!Check(N, F)) return 0;
    vector<vector<int> > G(N, vector<int>(N));
    int cnt = 0;
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            G[i][j] = F[j][i];
            cnt += F[j][i];
        }
    }
    if (!Check(N, G)) return 0;
    return N*N - cnt;
}
#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...