QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#155729#7118. Closing Timebulijiojiodibuliduo#Compile Error//C++172.2kb2023-09-02 02:58:222024-04-28 06:47:27

Judging History

你现在查看的是最新测评结果

  • [2024-04-28 06:47:27]
  • 管理员手动重测本题所有提交记录
  • [2023-09-02 02:58:23]
  • 评测
  • [2023-09-02 02:58:22]
  • 提交

answer

#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int bf(int N, std::vector<std::vector<int>> F) {
    rep(i,0,N) {
        int pl=N+1,pr=-1;
        rep(j,0,N) {
            if (F[i][j]==0) pl=min(pl,j),pr=max(pr,j);
        }
        if (pl<=pr) {
            rep(j,pl,pr+1) if (F[i][j]==1) { return 0; }
        }
    }
    rep(j,0,N) {
        int pl=N+1,pr=-1;
        rep(i,0,N) {
            if (F[i][j]==0) pl=min(pl,i),pr=max(pr,i);
        }
        if (pl<=pr) {
            rep(i,pl,pr+1) if (F[i][j]==1) { return 0; }
        }
    }
    vector<int> f(N*N,0);
    iota(all(f),0);
    function<int(int)> find=[&](int x) {
        return f[x]==x?x:f[x]=find(f[x]);
    };
    int pc=0,r=0;
    rep(i,0,N) rep(j,0,N) {
        if (F[i][j]==0) pc=i*N+j,++r;
        if (j+1<N&&F[i][j]==0&&F[i][j+1]==0) f[find(i*N+j)]=find(i*N+(j+1));
        if (i+1<N&&F[i][j]==0&&F[i+1][j]==0) f[find(i*N+j)]=find((i+1)*N+j);
    }
    rep(i,0,N) rep(j,0,N) if (F[i][j]==0&&find(i*N+j)!=find(pc)) return 0;
    return r;
}

int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
    return bf(N,F);
}

int main() {
    int N;
    assert(1 == scanf("%d", &N));
    std::vector<std::vector<int>> F(N, std::vector<int>(N));
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < N; j++)
        {
            assert(1 == scanf("%d", &F[i][j]));
        }
    }
    fclose(stdin);

    int res = biggest_stadium(N, F);

    printf("%d\n", res);
    fclose(stdout);
    return 0;
}

Details

answer.code:1:10: fatal error: soccer.h: No such file or directory
    1 | #include "soccer.h"
      |          ^~~~~~~~~~
compilation terminated.