답안 #1072305

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1072305 2024-08-23T16:43:59 Z Zicrus 축구 경기장 (IOI23_soccer) C++17
30 / 100
4500 ms 604 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 (e.first == -1) continue;
        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];
        }
    }
    vector<pair<int, int>> prev;
    int best = 0;
    for (int s = 0; s < n; s++) {
        for (int i = 0; i < n; i++) {
            for (int j = i; j < n; j++) {
                best = max(best, search(prev, 0, i, j, false));
            }
        }
        prev.push_back({-1, -1});
    }
    return best;
}

Compilation message

soccer.cpp: In function 'int search(std::vector<std::pair<int, int> >, int, int, int, bool)':
soccer.cpp:22: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]
   22 |     if (prev.size() == n)
      |         ~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Execution timed out 4592 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 344 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 604 KB ok
12 Correct 0 ms 364 KB ok
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 348 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 0 ms 604 KB ok
13 Correct 0 ms 364 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 60 ms 348 KB ok
16 Correct 10 ms 344 KB ok
17 Correct 1 ms 344 KB ok
18 Correct 1 ms 344 KB ok
19 Correct 0 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 344 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 2 ms 348 KB ok
26 Correct 4 ms 436 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4592 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4592 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 436 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Execution timed out 4592 ms 348 KB Time limit exceeded
5 Halted 0 ms 0 KB -