답안 #839806

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839806 2023-08-30T16:46:24 Z nigus 축구 경기장 (IOI23_soccer) C++17
1.5 / 100
248 ms 47388 KB
#include "soccer.h"

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

const int MAXN = 2001;

int n;
int grid[MAXN][MAXN] = {0};


int biggest_stadium(int N, vector<vi> F)
{   

    n = N;
    rep(c1,0,n){
        rep(c2,0,n){
            grid[c1][c2] = F[c1][c2];
        }
    }

    int x = 0;
    int y = n-1;

    rep(c1,0,n){
        int emp = 0;
        rep(c2,0,n){
            emp += grid[c1][c2];
        }
        if(emp != n){
            x = c1;
            break;
        }
    }
    for(int c1 = n-1; c1 >= 0; c1--){
        int emp = 0;
        rep(c2,0,n){
            emp += grid[c1][c2];
        }
        if(emp != n){
            y = c1;
            break;
        }
    }

    int lo = n;
    int hi = -1;
    bool sub = 0;

    int ans = 0;
    bool fail = 0;

    rep(c1,x,y+1){
        
        int lo2 = n;
        int hi2 = -1;
        int tot = 0;
        rep(c2,0,n){
            if(grid[c1][c2] == 0){
                tot++;
                lo2 = min(lo2, c2);
                hi2 = max(hi2, c2);
            }
        }
        ans += tot;
        if(tot != hi2-lo2+1)fail = 1;

        if(sub == 1){
            if(lo2 < lo || hi2 > hi){
                fail = 1;
            }
        }
        else{
            if(lo2 > lo || hi2 < hi){
                if(lo2 >= lo && hi2 <= hi){
                    sub = 1;
                }
                else{
                    fail = 1;
                }
            }
        }   
        lo = lo2;
        hi = hi2;
    }

    if(!fail){
        return ans;
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 340 KB ok
4 Correct 0 ms 340 KB ok
5 Correct 0 ms 212 KB ok
6 Partially correct 0 ms 300 KB partial
7 Partially correct 2 ms 724 KB partial
8 Partially correct 24 ms 5140 KB partial
9 Partially correct 248 ms 47388 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB ok
2 Correct 0 ms 212 KB ok
3 Partially correct 0 ms 212 KB partial
4 Partially correct 0 ms 212 KB partial
5 Incorrect 0 ms 212 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Partially correct 0 ms 212 KB partial
5 Partially correct 0 ms 212 KB partial
6 Incorrect 0 ms 212 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 340 KB ok
5 Correct 0 ms 340 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Incorrect 0 ms 212 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 340 KB ok
5 Correct 0 ms 340 KB ok
6 Partially correct 0 ms 212 KB partial
7 Partially correct 0 ms 212 KB partial
8 Incorrect 0 ms 212 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB partial
2 Correct 0 ms 212 KB ok
3 Correct 0 ms 212 KB ok
4 Correct 0 ms 340 KB ok
5 Correct 0 ms 340 KB ok
6 Correct 0 ms 212 KB ok
7 Partially correct 0 ms 300 KB partial
8 Partially correct 2 ms 724 KB partial
9 Partially correct 24 ms 5140 KB partial
10 Partially correct 248 ms 47388 KB partial
11 Partially correct 0 ms 212 KB partial
12 Partially correct 0 ms 212 KB partial
13 Incorrect 0 ms 212 KB wrong
14 Halted 0 ms 0 KB -