답안 #1079741

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079741 2024-08-29T00:07:33 Z Lobo 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
226 ms 31788 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 10;
const int inf1 = 1e9 + 10;
#define int long long
#define dbl long double
#define endl '\n'
#define sc second
#define fr first
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const int maxn = -1;

int32_t biggest_stadium(int32_t n, std::vector<std::vector<int32_t>> F)
{

    int ans = 1;
    int ansqtd = 0;
    {
        vector<int> mnl(n),mxl(n),qtdl(n);
        for(int i = 0; i < n; i++) {
            mnl[i] = inf;
            mxl[i] = -inf;
            qtdl[i] = 0;
            for(int j = 0; j < n; j++) {
                if(F[i][j] == 0) {
                    ansqtd++;
                    qtdl[i]++;
                    mnl[i] = min(mnl[i],j);
                    mxl[i] = max(mxl[i],j);
                }
            }
        }
        int difmn = 0;
        int difmx = 0;
        // +1 -> increasing
        //  0 -> equal
        // -1 -> decreasing
        for(int i = 0; i < n; i++) {
            if(qtdl[i] != 0 and qtdl[i] != mxl[i]-mnl[i]+1) {
                ans = 0;
            }

            int difmn1 = 0;
            int difmx1 = 0;
            if(i != 0) {
                if(mnl[i] < mnl[i-1]) difmn1 = 1; // increasing
                if(mnl[i] > mnl[i-1]) difmn1 = -1; // decreasing

                if(mxl[i] > mxl[i-1]) difmx1 = 1; // increasing
                if(mxl[i] < mxl[i-1]) difmx1 = -1; // decreasing
            }

            if(difmn == -1 and difmn1 == 1) {
                ans = 0;
            }

            if(difmx == -1 and difmx1 == 1) {
                ans = 0;
            }

            if(difmn1 == -1 and (difmx1 == 1 or difmx == 1)) {
                ans = 0;
            }

            if(difmx1 == -1 and (difmn1 == 1 or difmn == 1)) {
                ans = 0;
            }

            if(difmn1 == 1 and (difmx1 == -1 or difmx == -1)) {
                ans = 0;
            }

            if(difmx1 == 1 and (difmn1 == -1 or difmn == -1)) {
                ans = 0;
            }

            if(difmn1 != 0) difmn = difmn1;
            if(difmx1 != 0) difmx = difmx1;

        }
    }

    for(int i = 0; i < n ; i++) {
        for(int j = 0; j < n; j++) {
            if(i < j) swap(F[i][j],F[j][i]);
        }
    }

    {
        vector<int> mnl(n),mxl(n),qtdl(n);
        for(int i = 0; i < n; i++) {
            mnl[i] = inf;
            mxl[i] = -inf;
            qtdl[i] = 0;
            for(int j = 0; j < n; j++) {
                if(F[i][j] == 0) {
                    qtdl[i]++;
                    mnl[i] = min(mnl[i],j);
                    mxl[i] = max(mxl[i],j);
                }
            }
        }
        int difmn = 0;
        int difmx = 0;
        // +1 -> increasing
        //  0 -> equal
        // -1 -> decreasing
        for(int i = 0; i < n; i++) {
            if(qtdl[i] != 0 and qtdl[i] != mxl[i]-mnl[i]+1) {
                ans = 0;
            }

            int difmn1 = 0;
            int difmx1 = 0;
            if(i != 0) {
                if(mnl[i] < mnl[i-1]) difmn1 = 1; // increasing
                if(mnl[i] > mnl[i-1]) difmn1 = -1; // decreasing

                if(mxl[i] > mxl[i-1]) difmx1 = 1; // increasing
                if(mxl[i] < mxl[i-1]) difmx1 = -1; // decreasing
            }

            if(difmn == -1 and difmn1 == 1) {
                ans = 0;
            }

            if(difmx == -1 and difmx1 == 1) {
                ans = 0;
            }

            if(difmn1 == -1 and (difmx1 == 1 or difmx == 1)) {
                ans = 0;
            }

            if(difmx1 == -1 and (difmn1 == 1 or difmn == 1)) {
                ans = 0;
            }

            if(difmn1 == 1 and (difmx1 == -1 or difmx == -1)) {
                ans = 0;
            }

            if(difmx1 == 1 and (difmn1 == -1 or difmn == -1)) {
                ans = 0;
            }

            if(difmn1 != 0) difmn = difmn1;
            if(difmx1 != 0) difmx = difmx1;

        }
    }
    if(ans) return ansqtd;
    return 0;
}
# 결과 실행 시간 메모리 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 1 ms 348 KB partial
7 Partially correct 1 ms 348 KB partial
8 Partially correct 14 ms 2396 KB partial
9 Partially correct 226 ms 31788 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 0 ms 348 KB ok
10 Partially correct 0 ms 348 KB partial
11 Partially correct 0 ms 344 KB partial
12 Partially correct 0 ms 348 KB partial
13 Incorrect 1 ms 348 KB wrong
14 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 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 0 ms 348 KB ok
11 Partially correct 0 ms 348 KB partial
12 Partially correct 0 ms 344 KB partial
13 Partially correct 0 ms 348 KB partial
14 Incorrect 1 ms 348 KB wrong
15 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 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 0 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Incorrect 1 ms 348 KB wrong
17 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 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 0 ms 348 KB ok
13 Partially correct 0 ms 348 KB partial
14 Partially correct 0 ms 344 KB partial
15 Partially correct 0 ms 348 KB partial
16 Incorrect 1 ms 348 KB wrong
17 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 1 ms 348 KB partial
8 Partially correct 1 ms 348 KB partial
9 Partially correct 14 ms 2396 KB partial
10 Partially correct 226 ms 31788 KB partial
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 0 ms 348 KB ok
18 Partially correct 0 ms 348 KB partial
19 Partially correct 0 ms 344 KB partial
20 Partially correct 0 ms 348 KB partial
21 Incorrect 1 ms 348 KB wrong
22 Halted 0 ms 0 KB -