Submission #1081844

#TimeUsernameProblemLanguageResultExecution timeMemory
1081844LaMatematica14Soccer Stadium (IOI23_soccer)C++17
1.50 / 100
214 ms39508 KiB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    int tot = 0;
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++) {
            if (!F[i][j]) tot++;
        }
    }
    vector<int> lc(N, -1); // -1 non ancora vuota, 0 vuota, 1 ritrovata piena
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++) {
            if (!F[i][j]) {
                if (lc[j] == 0) continue;
                lc[j]++;
                if (lc[j] == 2) return tot+1;

            }
            else if (lc[j] == 0) lc[j]++;
        }
    }
    fill(lc.begin(), lc.end(), -1);
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++) {
            if (!F[j][i]) {
                if (lc[j] == 0) continue;
                lc[j]++;
                if (lc[j] == 2) return tot+1;

            }
            else if (lc[j] == 0) lc[j]++;
        }
    }
    return tot;
}
#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...