제출 #1241184

#제출 시각아이디문제언어결과실행 시간메모리
1241184candi_ositos축구 경기장 (IOI23_soccer)C++20
6 / 100
201 ms47644 KiB
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
bool test(int N, vector <vector <int> > F){
    int lmt=-1, rmt=-1, umt=-1, dmt=-1;
    vector <int> ums, dms, rms, lms;
    ums.assign(N, -1);
    dms.assign(N, -1);
    rms.assign(N, -1);
    lms.assign(N, -1);
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(F[i][j]){
                if(i>0){
                    if(!F[i-1][j] && umt==-1){
                        umt=i;
                    }
                }
                if(j>0){
                    if(!F[i][j-1] && (lmt==-1 || lmt>j)){
                        lmt=j;
                    }
                }
                if(i<N-1){
                    if(!F[i+1][j]){
                        dmt=i;
                    }
                }
                if(j<N-1){
                    if(!F[i][j+1] && rmt<j){
                        rmt=j;
                    }
                }
            }
            else{
                if(ums[j]==-1){
                    ums[j]=i;
                }
                if(lms[i]==-1){
                    lms[i]=j;
                }
                rms[i]=j;
                dms[j]=i;
            }
        }
    }
    if(umt<=dmt+1 || lmt<=rmt+1){
        return 0;
    }
    for(int i=0; i<N; ++i){
        if(ums[i]!=-1){
            for(int j=0; j<N; ++i){
                if(dms[j]!=-1){
                    if(F[j][ums[i]] && F[i][dms[j]]){
                        return 0;
                    }
                }
            }
        }
    }
    for(int i=0; i<N; ++i){
        if(lms[i]!=-1){
            for(int j=0; j<N; ++i){
                if(rms[j]!=-1){
                    if(F[lms[i]][j] && F[rms[j]][i]){
                        return 0;
                    }
                }
            }
        }
    }
    int bsc=0;
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(!F[i][j]){
                ++bsc;
            }
        }
    }
    return bsc;
}
int biggest_stadium(int N, vector <vector <int> > F)
{
    int nosirvo=test(N, F);
    if(nosirvo>0){
        return nosirvo;
    }
    vector <vector <vector <int> > > Q;
    int tc=0;
    int x=-1;
    int y=-1;
    for(int i=0; i<N; ++i){
        for(int j=0; j<N; ++j){
            if(F[i][j]){
                ++tc;
                x=i;
                y=j;
            }
        }
    }
    if(tc==0){
        return N*N;
    }
    if(tc==1){
        if(x>N-x-1){
            x=N-x-1;
        }
        if(y>N-y-1){
            y=N-y-1;
        }
        return N*N-(x+1)*(y+1);
    }
    if(tc==N*N-1){
        return 1;
    }
    if(N==2){
        if(F[0][0]==F[0][1]){
            return 2;
        }
        return 1;
    }/*
    if(N==3){
        if(!F[1][1]){
            n
        }
        else{
            f
        }
    }*/
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...