답안 #1082080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1082080 2024-08-30T16:53:25 Z ArthuroWich 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
200 ms 32540 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
int n, ans = 0;
vector<vector<pair<int, int>>> segs;
map<tuple<int, int, int>, int> dp1, dp2; 
int solveup(int i, int l, int r) {
    if (dp1.find({i, l, r}) != dp1.end()) {
        return dp1[{i, l, r}];
    }
    if (i == 0) {
        return r-l+1;
    }
    int v = 0;
    for (auto [x, y] : segs[i-1]) {
        if (max(l, x) >= min(r, y)) {
            continue;
        }
        v = max(v, solveup(i-1, max(l, x), min(r, y)));
    }
    dp1[{i, l, r}] = v+(r-l+1);
    return v+(r-l+1);
}
int solvedown(int i, int l, int r) {
    if (dp2.find({i, l, r}) != dp2.end()) {
        return dp2[{i, l, r}];
    }
    if (i == n-1) {
        return r-l+1;
    }
    int v = 0;
    for (auto [x, y] : segs[i+1]) {
        if (max(l, x) >= min(r, y)) {
            continue;
        }
        v = max(v, solvedown(i+1, max(l, x), min(r, y)));
    }
    dp2[{i, l, r}] = v+(r-l+1);
    return v+(r-l+1);
}
int biggest_stadium(int N, vector<vector<int>> f) {
    n = N;
    segs.resize(n);
    for (int i = 0; i < n; i++) {
        int l = -1, r = -1;
        for (int j = 0; j < n; j++) {
            if (f[i][j] == 0) {
                if (l == -1) {
                    l = j;
                }
                r = j;
            } else {
                if (l != -1) {
                    segs[i].push_back({l, r});
                }
                l = -1;
            }
        }
        if (l != -1) {
            segs[i].push_back({l, r});
        }
    }
    for (int i = 0; i < n; i++) {
        for (auto [x, y] : segs[i]) {
            ans = max(ans, solveup(i, x, y)+solvedown(i, x, y)-(y-x+1));
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Correct 1 ms 344 KB ok
8 Correct 13 ms 2392 KB ok
9 Correct 200 ms 32540 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 0 ms 348 KB partial
4 Partially correct 0 ms 348 KB partial
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 348 KB partial
5 Partially correct 0 ms 348 KB partial
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Incorrect 0 ms 348 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Correct 0 ms 348 KB ok
9 Partially correct 0 ms 348 KB partial
10 Incorrect 0 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Correct 0 ms 348 KB ok
9 Partially correct 0 ms 348 KB partial
10 Incorrect 0 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 348 KB partial
8 Correct 1 ms 344 KB ok
9 Correct 13 ms 2392 KB ok
10 Correct 200 ms 32540 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 348 KB partial
13 Correct 0 ms 348 KB ok
14 Partially correct 0 ms 348 KB partial
15 Incorrect 0 ms 348 KB wrong
16 Halted 0 ms 0 KB -