답안 #988644

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
988644 2024-05-25T11:18:18 Z Gray 축구 경기장 (IOI23_soccer) C++17
0 / 100
4500 ms 126036 KB
#include<bits/stdc++.h>
#include "soccer.h"

using namespace std;
#define ll long long
#define ff first
#define ss second
#define ln "\n"


ll n;

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    n=N;
    vector<vector<ll>> gr(n+1, vector<ll>(n+1));
    vector<vector<pair<ll, ll>>> A(N+2, vector<pair<ll, ll>>(N+2, {0, n+1}));
    for (ll i=1; i<=n; i++){
        for (ll j=1; j<=n; j++){
            gr[i][j]=F[i-1][j-1];
            A[i][j].ff=A[i][j-1].ff;
            if (gr[i][j]){
                A[i][j].ff=j;
            }
        }
    }
    for (ll i=1; i<=n; i++){
        for (ll j=n; j>=1; j--){
            A[i][j].ss=A[i][j+1].ss;
            if (gr[i][j]){
                A[i][j].ss=j;
            }
        }
    }
    // for (ll i=1; i<=n; i++){
    //     for (ll j=1; j<=n; j++){
    //         cout << A[i][j].ff << "|" << A[i][j].ss << " ";
    //     }
    //     cout << ln;
    // }
    // cout << ln;
    ll res=0;
    for (ll i=1; i<=n; i++){
        for (ll j=1; j<=n; j++){
            // vector<ll> debug;
            ll l=A[i][j].ff, r=A[i][j].ss;
            ll ans=-(r-l-1);
            ll ch=i;
            while (ch>0 and l<j and r>j and l<r){
                
                ans+=r-l-1;
                ch--;
                l = max(l, A[ch][j].ff);
                r = min(r, A[ch][j].ss);
            }
            l=A[i][j].ff; r=A[i][j].ss;
            // debug.push_back(ch);
            ch = i;
            while (ch<=n and l<j and r>j and l<r){
                ans+=r-l-1;
                ch++;
                l = max(l, A[ch][j].ff);
                r = min(r, A[ch][j].ss);
            }
            // debug.push_back(ch);
            // cout << i << " " << j << " -> " << ans << ": ";
            // for (auto cch:debug){
            //     cout << cch << " "; 
            // }
            // cout << ln;
            if (res<ans){
                res=ans;
            }
        }
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 3 ms 604 KB ok
8 Correct 320 ms 8284 KB ok
9 Execution timed out 4546 ms 126036 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Incorrect 1 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Incorrect 1 ms 348 KB wrong
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 1 ms 348 KB ok
10 Incorrect 1 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 1 ms 348 KB ok
10 Incorrect 1 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 344 KB ok
3 Correct 1 ms 344 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 3 ms 604 KB ok
9 Correct 320 ms 8284 KB ok
10 Execution timed out 4546 ms 126036 KB Time limit exceeded
11 Halted 0 ms 0 KB -