답안 #1038071

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038071 2024-07-29T12:42:49 Z Zicrus 축구 경기장 (IOI23_soccer) C++17
12 / 100
4500 ms 2396 KB
#include <bits/stdc++.h>
#include "soccer.h"
using namespace std;

typedef long long ll;

int biggest_stadium(int n, vector<vector<int>> f) {
    vector<pair<ll, ll>> v(n, {-1, -1}), h(n, {-1, -1});
    ll num = 0;
    bool done = false;
    pair<ll, ll> prev = {-1, -1}, mn = {-1, -1};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (!f[i][j]) {
                /*if (done)
                    return 0;*/
                if (v[i].first == -1) v[i].first = j;
                /*if (j - v[i].second > 1 && v[i].second != -1)
                    return 0;*/
                v[i].second = j;
                num++;
            }
        }
        if (v[i].first == -1 && num > 0) done = true;
        if (prev.first == -1) {
            prev = v[i];
            mn = v[i];
            continue;
        }
        if (v[i].first == -1) continue;
        /*if (v[i].first > prev.first && v[i].second > prev.second)
            return 0;
        if (v[i].first < prev.first && v[i].second < prev.second)
            return 0;
        if (v[i].first > mn.first && v[i].second > mn.second)
            return 0;
        if (v[i].first < mn.first && v[i].second < mn.second)
            return 0;*/
        prev = v[i];
    }
    num = 0;
    done = false;
    prev = {-1, -1};
    mn = {-1, -1};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (!f[j][i]) {
                /*if (done)
                    return 0;*/
                if (h[i].first == -1) h[i].first = j;
                /*if (j - h[i].second > 1 && h[i].second != -1)
                    return 0;*/
                h[i].second = j;
                num++;
            }
        }
        if (h[i].first == -1 && num > 0) done = true;
        if (prev.first == -1) {
            prev = h[i];
            mn = h[i];
            continue;
        }
        if (h[i].first == -1) continue;
        /*if (h[i].first > prev.first && h[i].second > prev.second)
            return 0;
        if (h[i].first < prev.first && h[i].second < prev.second)
            return 0;
        if (h[i].first > mn.first && h[i].second > mn.second)
            return 0;
        if (h[i].first < mn.first && h[i].second < mn.second)
            return 0;*/
        prev = h[i];
    }

    for (int x1 = 0; x1 < n; x1++) {
        for (int y1 = 0; y1 < n; y1++) {
            if (f[x1][y1]) continue;
            for (int x2 = 0; x2 < n; x2++) {
                for (int y2 = 0; y2 < n; y2++) {
                    if (f[x2][y2]) continue;
                    bool poss = false;
                    
                    if (!f[x1][y2]) {
                        bool t = true;
                        for (int i = y1; i < y2; i += clamp(y2-y1, -1, 1)) {
                            if (f[x1][i]) t = false;
                        }
                        for (int i = x1; i < x2; i += clamp(x2-x1, -1, 1)) {
                            if (f[i][y2]) t = false;
                        }
                        poss |= t;
                    }
                    if (!f[x2][y1]) {
                        bool t = true;
                        for (int i = x1; i < x2; i += clamp(x2-x1, -1, 1)) {
                            if (f[i][y1]) t = false;
                        }
                        for (int i = y1; i < y2; i += clamp(y2-y1, -1, 1)) {
                            if (f[x2][i]) t = false;
                        }
                        poss |= t;
                    }

                    if (!poss)
                        return 0;
                }
            }
        }
    }

    return num;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:10:10: warning: variable 'done' set but not used [-Wunused-but-set-variable]
   10 |     bool done = false;
      |          ^~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 81 ms 348 KB partial
8 Execution timed out 4568 ms 2396 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 0 ms 344 KB partial
4 Partially correct 0 ms 348 KB partial
5 Partially correct 0 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 1 ms 348 KB partial
8 Correct 0 ms 348 KB ok
9 Correct 1 ms 348 KB ok
10 Partially correct 0 ms 348 KB partial
11 Partially correct 1 ms 344 KB partial
12 Partially correct 0 ms 348 KB partial
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 0 ms 344 KB partial
5 Partially correct 0 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 348 KB partial
9 Correct 0 ms 348 KB ok
10 Correct 1 ms 348 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 1 ms 344 KB partial
13 Partially correct 0 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Partially correct 0 ms 348 KB partial
16 Partially correct 0 ms 348 KB partial
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 348 KB ok
22 Partially correct 1 ms 348 KB partial
23 Partially correct 0 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 0 ms 348 KB partial
26 Partially correct 1 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 1 ms 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 1 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Partially correct 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Partially correct 1 ms 348 KB partial
25 Partially correct 0 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 0 ms 348 KB partial
28 Partially correct 1 ms 348 KB partial
29 Partially correct 0 ms 348 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 0 ms 348 KB partial
32 Partially correct 0 ms 348 KB partial
33 Partially correct 0 ms 348 KB partial
34 Correct 1 ms 348 KB ok
35 Correct 2 ms 348 KB ok
36 Partially correct 1 ms 348 KB partial
37 Partially correct 0 ms 348 KB partial
38 Partially correct 0 ms 344 KB partial
39 Partially correct 0 ms 348 KB partial
40 Partially correct 0 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 0 ms 344 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 1 ms 348 KB partial
11 Correct 0 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 1 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Partially correct 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Partially correct 1 ms 348 KB partial
25 Partially correct 0 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 0 ms 348 KB partial
28 Partially correct 1 ms 348 KB partial
29 Partially correct 0 ms 348 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 0 ms 348 KB partial
32 Partially correct 0 ms 348 KB partial
33 Partially correct 0 ms 348 KB partial
34 Correct 1 ms 348 KB ok
35 Correct 2 ms 348 KB ok
36 Partially correct 1 ms 348 KB partial
37 Partially correct 0 ms 348 KB partial
38 Partially correct 0 ms 344 KB partial
39 Partially correct 0 ms 348 KB partial
40 Partially correct 0 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
42 Partially correct 14 ms 2396 KB partial
43 Partially correct 14 ms 2200 KB partial
44 Partially correct 13 ms 2396 KB partial
45 Partially correct 13 ms 2396 KB partial
46 Partially correct 13 ms 2396 KB partial
47 Partially correct 17 ms 2396 KB partial
48 Execution timed out 4521 ms 2396 KB Time limit exceeded
49 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB partial
2 Correct 0 ms 344 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 0 ms 344 KB partial
8 Partially correct 81 ms 348 KB partial
9 Execution timed out 4568 ms 2396 KB Time limit exceeded
10 Halted 0 ms 0 KB -