답안 #1065933

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1065933 2024-08-19T13:15:37 Z deera 축구 경기장 (IOI23_soccer) C++17
18 / 100
4500 ms 35632 KB
#include <bits/stdc++.h>
using namespace std;

struct Pos {
    int x, y;
    Pos(int x, int y) : x(x), y(y) {}
};

bool FIELD[2001][2001] = {0};
bool empty(int a, int b, int x, int y) {
    assert(a == x || b == y); // only 1d queries
    if (a == x)
        for (int i = min(b, y); i <= max(b, y); i++)
            if (FIELD[a][i]) return false;
    if (b == y) 
        for (int i = min(a, x); i <= max(a, x); i++)
            if (FIELD[i][b]) return false;
    return true;
}

int biggest_stadium(int N, vector<vector<int>> F) {
    vector<Pos> trees;
    for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) {
        if (F[i][j] == 1) trees.push_back({i, j});
        FIELD[i][j] = F[i][j];
    }

    for (auto tree : trees) {
        cerr << tree.x << " " << tree.y << endl;
    }

    if (trees.size() == 0) return N * N;
    if (trees.size() == 1) {
        int x = trees[0].x, y = trees[0].y;

        int n = N - 1;
        int a = (abs(x - 0) + 1) * (abs(y - 0) + 1);
        int b = (abs(x - 0) + 1) * (abs(y - n) + 1);
        int c = (abs(x - n) + 1) * (abs(y - 0) + 1);
        int d = (abs(x - n) + 1) * (abs(y - n) + 1);


        return N * N - min({a, b, c, d});
    }

    for (int a = 0; a < N; a++) for (int b = 0; b < N; b++) {
        for (int x = 0; x < N; x++) for (int y = 0; y < N; y++) {
            // going throgh (a, y)
            if (a == x && b == y) continue;
            if (FIELD[a][b] || FIELD[x][y]) continue;
            if ((empty(a, b, a, y) && empty(x, y, a, y)) 
              || empty(a, b, x, b) && empty(x, y, x, b)) {
                continue;
            } else {return 0;}
        }
    }

    return N * N - trees.size();
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:52:36: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   52 |               || empty(a, b, x, b) && empty(x, y, x, b)) {
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 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 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 1 ms 604 KB ok
8 Correct 12 ms 3164 KB ok
9 Correct 205 ms 35632 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 Partially correct 1 ms 348 KB partial
6 Partially correct 0 ms 348 KB partial
7 Partially correct 0 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 0 ms 348 KB partial
12 Partially correct 1 ms 348 KB partial
13 Correct 0 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
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 Partially correct 1 ms 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 0 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 0 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Correct 0 ms 348 KB ok
15 Partially correct 1 ms 648 KB partial
16 Partially correct 1 ms 348 KB partial
17 Partially correct 0 ms 348 KB partial
18 Partially correct 0 ms 348 KB partial
19 Partially correct 1 ms 348 KB partial
20 Correct 1 ms 348 KB ok
21 Correct 1 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 352 KB partial
25 Partially correct 1 ms 352 KB partial
26 Partially correct 1 ms 352 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
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 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 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 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 648 KB partial
18 Partially correct 1 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Partially correct 1 ms 348 KB partial
22 Correct 1 ms 348 KB ok
23 Correct 1 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 352 KB partial
27 Partially correct 1 ms 352 KB partial
28 Partially correct 1 ms 352 KB partial
29 Partially correct 0 ms 352 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 1 ms 348 KB partial
32 Partially correct 2 ms 348 KB partial
33 Partially correct 4 ms 440 KB partial
34 Correct 5 ms 528 KB ok
35 Correct 9 ms 348 KB ok
36 Partially correct 6 ms 348 KB partial
37 Partially correct 4 ms 348 KB partial
38 Partially correct 4 ms 600 KB partial
39 Partially correct 3 ms 348 KB partial
40 Partially correct 2 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
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 348 KB partial
7 Partially correct 0 ms 348 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 0 ms 348 KB partial
10 Partially correct 0 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 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Partially correct 1 ms 648 KB partial
18 Partially correct 1 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 0 ms 348 KB partial
21 Partially correct 1 ms 348 KB partial
22 Correct 1 ms 348 KB ok
23 Correct 1 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 352 KB partial
27 Partially correct 1 ms 352 KB partial
28 Partially correct 1 ms 352 KB partial
29 Partially correct 0 ms 352 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 1 ms 348 KB partial
32 Partially correct 2 ms 348 KB partial
33 Partially correct 4 ms 440 KB partial
34 Correct 5 ms 528 KB ok
35 Correct 9 ms 348 KB ok
36 Partially correct 6 ms 348 KB partial
37 Partially correct 4 ms 348 KB partial
38 Partially correct 4 ms 600 KB partial
39 Partially correct 3 ms 348 KB partial
40 Partially correct 2 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
42 Partially correct 114 ms 4304 KB partial
43 Partially correct 220 ms 4556 KB partial
44 Partially correct 29 ms 3928 KB partial
45 Partially correct 27 ms 3832 KB partial
46 Partially correct 58 ms 4176 KB partial
47 Partially correct 15 ms 3676 KB partial
48 Execution timed out 4522 ms 5720 KB Time limit exceeded
49 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 348 KB partial
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 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 604 KB ok
9 Correct 12 ms 3164 KB ok
10 Correct 205 ms 35632 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Partially correct 0 ms 348 KB partial
15 Partially correct 0 ms 348 KB partial
16 Correct 0 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 348 KB partial
20 Partially correct 1 ms 348 KB partial
21 Correct 0 ms 348 KB ok
22 Partially correct 1 ms 648 KB partial
23 Partially correct 1 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
27 Correct 1 ms 348 KB ok
28 Correct 1 ms 348 KB ok
29 Partially correct 1 ms 348 KB partial
30 Partially correct 0 ms 348 KB partial
31 Partially correct 0 ms 352 KB partial
32 Partially correct 1 ms 352 KB partial
33 Partially correct 1 ms 352 KB partial
34 Partially correct 0 ms 352 KB partial
35 Partially correct 1 ms 348 KB partial
36 Partially correct 1 ms 348 KB partial
37 Partially correct 2 ms 348 KB partial
38 Partially correct 4 ms 440 KB partial
39 Correct 5 ms 528 KB ok
40 Correct 9 ms 348 KB ok
41 Partially correct 6 ms 348 KB partial
42 Partially correct 4 ms 348 KB partial
43 Partially correct 4 ms 600 KB partial
44 Partially correct 3 ms 348 KB partial
45 Partially correct 2 ms 348 KB partial
46 Partially correct 0 ms 348 KB partial
47 Partially correct 114 ms 4304 KB partial
48 Partially correct 220 ms 4556 KB partial
49 Partially correct 29 ms 3928 KB partial
50 Partially correct 27 ms 3832 KB partial
51 Partially correct 58 ms 4176 KB partial
52 Partially correct 15 ms 3676 KB partial
53 Execution timed out 4522 ms 5720 KB Time limit exceeded
54 Halted 0 ms 0 KB -