답안 #1037929

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037929 2024-07-29T10:16:50 Z fv3 축구 경기장 (IOI23_soccer) C++17
12 / 100
4500 ms 16328 KB
#include "soccer.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int nt = 1;
vector<vector<int>> st_h, st_v;

int getvrange(int l, int r, int k, int x, int y, int i)
{
    if (l > r) swap(l, r);
    if (r < x || l > y) return 0;
    if (x >= l && y <= r) return st_v[i][k];
    int c = (x + y) / 2;
    return getvrange(l, r, k*2, x, c, i) | getvrange(l, r, k*2|1, c+1, y, i);
}

int gethrange(int l, int r, int k, int x, int y, int i)
{
    if (l > r) swap(l, r);
    if (r < x || l > y) return 0;
    if (x >= l && y <= r) return st_h[i][k];
    int c = (x + y) / 2;
    return gethrange(l, r, k*2, x, c, i) | gethrange(l, r, k*2|1, c+1, y, i);
}

int biggest_stadium(int N, vector<vector<int>> F)
{
    int res = 0;

    while (nt < N)
        nt *= 2;

    st_v = st_h = vector<vector<int>>(N, vector<int>(2*nt));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            st_h[i][nt + j] = F[i][j];
            st_v[i][nt + j] = F[j][i];
        }

        for (int j = nt - 1; j >= 1; j--)
        {
            st_h[i][j] = st_h[i][j*2] | st_h[i][j*2|1];
            st_v[i][j] = st_v[i][j*2] | st_v[i][j*2|1];
        }
    }

    vector<pair<int, int>> vpi;
    for (int y = 0; y < N; y++)
    {
        for (int x = 0; x < N; x++)
        {
            if (!F[y][x])
                vpi.push_back({x, y});
        }
    }

    for (int i = 0; i < vpi.size(); i++)
    {
        int x, y;
        tie(x, y) = vpi[i];

        for (int j = i+1; j < vpi.size(); j++)
        {
            int nx, ny;
            tie(nx, ny) = vpi[j];


            bool b1 = getvrange(y, ny, 1, 0, nt - 1, x) || gethrange(x, nx, 1, 0, nt - 1, ny);
            bool b2 = getvrange(y, ny, 1, 0, nt - 1, nx) || gethrange(x, nx, 1, 0, nt - 1, y);

            cerr << x << " " << y << " : " << nx << " " << ny << " = " << b1 << ", " << b2 << "\n";

            if (b1 && b2)
                return -1;
        }
    }

    return vpi.size();
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:61:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |     for (int i = 0; i < vpi.size(); i++)
      |                     ~~^~~~~~~~~~~~
soccer.cpp:66:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |         for (int j = i+1; j < vpi.size(); j++)
      |                           ~~^~~~~~~~~~~~
soccer.cpp:30:9: warning: unused variable 'res' [-Wunused-variable]
   30 |     int res = 0;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 37 ms 472 KB ok
4 Correct 56 ms 484 KB ok
5 Correct 0 ms 348 KB ok
6 Partially correct 1 ms 348 KB partial
7 Execution timed out 4588 ms 7884 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB ok
2 Correct 1 ms 348 KB ok
3 Partially correct 1 ms 348 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 0 ms 348 KB partial
12 Partially correct 1 ms 348 KB partial
13 Correct 1 ms 348 KB ok
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Partially correct 1 ms 348 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 0 ms 348 KB partial
13 Partially correct 1 ms 348 KB partial
14 Correct 1 ms 348 KB ok
15 Partially correct 1 ms 348 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 0 ms 348 KB partial
20 Correct 0 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Partially correct 1 ms 348 KB partial
23 Partially correct 1 ms 348 KB partial
24 Partially correct 0 ms 348 KB partial
25 Partially correct 1 ms 348 KB partial
26 Partially correct 0 ms 344 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 37 ms 472 KB ok
5 Correct 56 ms 484 KB ok
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 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 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 1 ms 348 KB ok
17 Partially correct 1 ms 348 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 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 348 KB ok
24 Partially correct 1 ms 348 KB partial
25 Partially correct 1 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 1 ms 348 KB partial
28 Partially correct 0 ms 344 KB partial
29 Partially correct 1 ms 348 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 1 ms 348 KB partial
32 Partially correct 0 ms 348 KB partial
33 Partially correct 1 ms 344 KB partial
34 Correct 108 ms 592 KB ok
35 Correct 384 ms 1104 KB ok
36 Partially correct 27 ms 348 KB partial
37 Partially correct 23 ms 488 KB partial
38 Partially correct 6 ms 348 KB partial
39 Partially correct 3 ms 348 KB partial
40 Partially correct 7 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 37 ms 472 KB ok
5 Correct 56 ms 484 KB ok
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 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 0 ms 348 KB partial
15 Partially correct 1 ms 348 KB partial
16 Correct 1 ms 348 KB ok
17 Partially correct 1 ms 348 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 0 ms 348 KB partial
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 348 KB ok
24 Partially correct 1 ms 348 KB partial
25 Partially correct 1 ms 348 KB partial
26 Partially correct 0 ms 348 KB partial
27 Partially correct 1 ms 348 KB partial
28 Partially correct 0 ms 344 KB partial
29 Partially correct 1 ms 348 KB partial
30 Partially correct 1 ms 348 KB partial
31 Partially correct 1 ms 348 KB partial
32 Partially correct 0 ms 348 KB partial
33 Partially correct 1 ms 344 KB partial
34 Correct 108 ms 592 KB ok
35 Correct 384 ms 1104 KB ok
36 Partially correct 27 ms 348 KB partial
37 Partially correct 23 ms 488 KB partial
38 Partially correct 6 ms 348 KB partial
39 Partially correct 3 ms 348 KB partial
40 Partially correct 7 ms 348 KB partial
41 Partially correct 0 ms 348 KB partial
42 Partially correct 19 ms 8920 KB partial
43 Partially correct 19 ms 8920 KB partial
44 Partially correct 19 ms 9172 KB partial
45 Partially correct 17 ms 8920 KB partial
46 Partially correct 18 ms 8916 KB partial
47 Partially correct 256 ms 9416 KB partial
48 Execution timed out 4547 ms 16328 KB Time limit exceeded
49 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 1 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 37 ms 472 KB ok
5 Correct 56 ms 484 KB ok
6 Correct 0 ms 348 KB ok
7 Partially correct 1 ms 348 KB partial
8 Execution timed out 4588 ms 7884 KB Time limit exceeded
9 Halted 0 ms 0 KB -