Submission #980154

# Submission time Handle Problem Language Result Execution time Memory
980154 2024-05-12T00:21:30 Z vjudge1 Soccer Stadium (IOI23_soccer) C++17
0 / 100
1 ms 348 KB
#include "soccer.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

bool checker(int n, vector<vector<int>> &F) {
    int l[n], r[n];

    for (int i = 0; i < n; i++) l[i] = r[i] = -1;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (F[i][j] == 0 && l[i] == -1) {
                l[i] = r[i] = j;
                while (r[i] < n && F[i][r[i]] == 0) r[i]++;
                r[i]--;
            }
            if (F[i][j] == 0 && r[i] < j && l[i] != -1) return false;
        }
    }

    int L = 100000, R = -1;
    for (int i = 0; i < n; i++)
        if (l[i] != -1) L = min(L, i), R = max(R, i);

    if (L == -1 && R == -1) return false;

    for (int i = L; i < R; i++)
        if (max(r[i + 1], r[i]) != r[i + 1] || min(l[i + 1], l[i]) != l[i + 1]) return false;

    return true;
}

int biggest_stadium(int n, std::vector<std::vector<int>> F) {
    int ans = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
            ans += abs(1 - F[i][j]);
    if (!checker(n, F)) ans = 0;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Incorrect 1 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Incorrect 1 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Incorrect 1 ms 348 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 348 KB partial
2 Incorrect 1 ms 348 KB wrong
3 Halted 0 ms 0 KB -