Submission #998500

# Submission time Handle Problem Language Result Execution time Memory
998500 2024-06-14T05:11:22 Z irmuun Soccer Stadium (IOI23_soccer) C++17
0 / 100
4500 ms 3672 KB
#include<bits/stdc++.h>
#include "soccer.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int n;
vector<vector<int>>f;
int solve(int x,int y){
    int lx=x,rx=x,ly=y,ry=y;
    while(lx>0&&f[lx-1][y]==0){
        lx--;
    }
    while(rx<n-1&&f[rx+1][y]==0){
        rx++;
    }
    while(ly>0&&f[x][ly-1]==0){
        ly--;
    }
    while(ry<n-1&&f[x][ry+1]==0){
        ry++;
    }
    int left=ly,right=ry;
    int total=rx-lx+ry-ly+1;
    for(int i=x-1;i>=lx;i--){
        int j=y;
        while(j>left&&f[i][j-1]==0){
            j--;
        }
        total+=y-j;
        left=j;
        j=y;
        while(j<right&&f[i][j+1]==0){
            j++;
        }
        total+=j-y;
        right=j;
    }
    left=ly,right=ry;
    for(int i=x+1;i<=rx;i++){
        int j=y;
        while(j>left&&f[i][j-1]==0){
            j--;
        }
        total+=y-j;
        left=j;
        j=y;
        while(j<right&&f[i][j+1]==0){
            j++;
        }
        total+=j-y;
        right=j;
    }
    return total;
}

int biggest_stadium(int N,vector<vector<int>>F){
    n=N;
    f=F;
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(f[i][j]==0){
                ans=max(ans,solve(i,j));
            }
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
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 1 ms 344 KB ok
7 Correct 55 ms 348 KB ok
8 Execution timed out 4601 ms 3672 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB ok
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 344 KB ok
6 Correct 0 ms 348 KB ok
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 348 KB ok
8 Incorrect 0 ms 348 KB wrong
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 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 0 ms 344 KB ok
9 Correct 0 ms 348 KB ok
10 Incorrect 0 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 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 0 ms 344 KB ok
9 Correct 0 ms 348 KB ok
10 Incorrect 0 ms 348 KB wrong
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 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 344 KB ok
8 Correct 55 ms 348 KB ok
9 Execution timed out 4601 ms 3672 KB Time limit exceeded
10 Halted 0 ms 0 KB -