Submission #1072285

# Submission time Handle Problem Language Result Execution time Memory
1072285 2024-08-23T16:24:18 Z Zicrus Soccer Stadium (IOI23_soccer) C++17
8 / 100
4500 ms 436 KB
#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;

typedef long long ll;

int n;
vector<vector<int>> f;
vector<vector<int>> sum;

int search(vector<pair<int, int>> prev, int res, int mn, int mx, bool dec) {
    if (sum[prev.size()][mx+1] - sum[prev.size()][mn] > 0) return res;
    for (auto &e : prev) {
        if (mn < e.first && mx < e.second) return res;
        if (mn > e.first && mx > e.second) return res;
    }

    prev.push_back({mn, mx});
    res += mx - mn + 1;
    int best = res;
    if (prev.size() == n)
        return best;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            if (dec && (i < mn || j > mx)) continue;
            bool d = dec || i > mn || j < mx;
            best = max(best, search(prev, res, i, j, d));
        }
    }
    return best;
}

int biggest_stadium(int N, vector<vector<int>> F) {
    n = N; f = F;
    sum = vector<vector<int>>(n, vector<int>(n+1));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            sum[i][j+1] = sum[i][j] + f[i][j];
        }
    }
    int best = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i; j < n; j++) {
            best = max(best, search(vector<pair<int, int>>(), 0, i, j, false));
        }
    }
    return best;
}

#ifdef TEST
#include "grader.cpp"
#endif

Compilation message

soccer.cpp: In function 'int search(std::vector<std::pair<int, int> >, int, int, int, bool)':
soccer.cpp:21:21: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |     if (prev.size() == n)
      |         ~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Execution timed out 4596 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 344 KB ok
8 Correct 0 ms 436 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 432 KB ok
13 Correct 0 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 344 KB ok
9 Correct 0 ms 436 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 1 ms 432 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 46 ms 348 KB ok
16 Correct 7 ms 348 KB ok
17 Correct 0 ms 348 KB ok
18 Correct 1 ms 348 KB ok
19 Partially correct 0 ms 344 KB partial
20 Incorrect 0 ms 348 KB wrong
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Execution timed out 4596 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Execution timed out 4596 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Execution timed out 4596 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -