답안 #1074426

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1074426 2024-08-25T10:28:25 Z anango 축구 경기장 (IOI23_soccer) C++17
0 / 100
1 ms 428 KB
#include "soccer.h"
using namespace std;
#define int long long
int n;
vector<vector<int>> pref;

int query(int a, int b, int c, int d) {
    return pref[c+1][d+1]-pref[a][d+1]-pref[c+1][b]+pref[a][b];
}

signed biggest_stadium(signed N, vector<vector<signed>> F) {
    //the stadium is valid iff for every pair of cells (a,b) and (c,d), 
    //everything in the paths (a,b) to (a,d) to (c,d) is inside
    //or everything in the paths (a,b) to (a,c) to (c,d) is inside
    n=N;
    pref=vector<vector<int>>(n+1,vector<int>(n+1,0));
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            pref[i+1][j+1] = pref[i+1][j]+pref[i][j+1]-pref[i][j]+F[i][j];
        }
    }
    for (int a=0; a<n; a++) {
        for (int b=0; b<n; b++) {
            for (int c=a; c<n; c++) {
                for (int d=b; d<n; d++) {
                    if (F[a][b]==1 || F[c][d]==1) continue;
                    //everything in the paths (a,b) to (a,d) to (c,d) is inside
                    if (query(a,b,a,d)==0 && query(a,d,c,d)==0) continue;
                    //or everything in the paths (a,b) to (a,c) to (c,d) is inside
                    if (query(a,b,a,c)==0 && query(a,c,c,d)==0) continue;
                    return 888;
                }
            }
        }
    }
    return n*n-pref[n][n];
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 424 KB ok
4 Incorrect 1 ms 348 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Partially correct 1 ms 348 KB partial
4 Partially correct 0 ms 428 KB partial
5 Partially correct 1 ms 348 KB partial
6 Incorrect 0 ms 348 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Partially correct 1 ms 348 KB partial
5 Partially correct 0 ms 428 KB partial
6 Partially correct 1 ms 348 KB partial
7 Incorrect 0 ms 348 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 424 KB ok
5 Incorrect 1 ms 348 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 424 KB ok
5 Incorrect 1 ms 348 KB wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 348 KB partial
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 424 KB ok
5 Incorrect 1 ms 348 KB wrong
6 Halted 0 ms 0 KB -