QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#154100#7120. Soccer1kri#Compile Error//C++141.5kb2023-08-31 13:36:322024-04-28 06:30:02

Judging History

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

  • [2024-04-28 06:30:02]
  • 管理员手动重测本题所有提交记录
  • [2023-08-31 13:36:33]
  • 评测
  • [2023-08-31 13:36:32]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <vector>
//#include "soccer.h"
using namespace std;
int n,a[2005][2005];
int l[2005],r[2005];
int biggest_stadium(int _n,vector<vector<int>> F){
    n=_n;
    for (int i=0;i<n;i++)
        for (int j=0;j<n;j++)
            a[i+1][j+1]=F[i][j];
    int sum=0,mx=-1,id=-1;
    for (int i=1;i<=n;i++){
        int c=0;
        for (int j=1;j<=n;j++)c+=1-a[i][j];
        if (c>mx)mx=c,id=i;
        sum+=c;
    }
    for (int i=1;i<=n;i++){
        int pl=1,pr=n;
        while(pl<=pr&&a[i][pl]==1)pl++;
        while(pl<=pr&&a[i][pr]==1)pr--;
        for (int j=pl;j<=pr;j++)
            if (a[i][j]==1)return 0;
        l[i]=pl,r[i]=pr;
    }
    int u=id,d=id;
    int x=l[id],y=r[id];
    while(u>1&&d<n){
        if (r[u-1]-l[u-1]+1>r[d+1]-l[d+1]+1){
            u--;
            if (l[u]<x||r[u]>y)return 0;
            x=l[u],y=r[u];
        }
        else{
            d++;
            if (l[d]<x||r[d]>y)return 0;
            x=l[d],y=r[d];
        }
    }
    while(u>1){
        u--;
        if (l[u]<x||r[u]>y)return 0;
        x=l[u],y=r[u];
    }
    while(d<n){
        d++;
        if (l[d]<x||r[d]>y)return 0;
        x=l[d],y=r[d];
    }
    return sum;
}
int main(){
    int n;
    cin>>n;
    vector<vector<int>> F;
    for (int i=0;i<n;i++){
        vector<int> qwq(n);
        for (int j=0;j<n;j++)cin>>qwq[j];
        F.push_back(qwq);
    }
    cout<<biggest_stadium(n,F)<<endl;
    return 0;
}

詳細信息

/usr/bin/ld: /tmp/ccoacnDO.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/ccsEbXvP.o:implementer.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status