답안 #897079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897079 2024-01-02T14:13:11 Z irmuun 축구 경기장 (IOI23_soccer) C++17
컴파일 오류
0 ms 0 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 biggest_stadium(int N,vector<vector<int>>F){
    vector<pair<int,int>>u;
    int total=0;
    for(int i=0;i<n;i++){
        vector<int>v;
        for(int j=0;j<n;j++){
            if(F[i][j]==0){
                total++;
                v.pb(j);
            }
        }
        bool ok=true;
        for(int j=1;j<v.size();j++){
            if(v[j-1]+1!=v[j]){
                ok=false;
            }
        }
        if(!ok){
            return 0;
        }
        if(v.size()>0){
            u.pb({v[0],v.back()});
        }
    }
    for(int j=0;j<n;j++){
        vector<int>v;
        for(int i=0;i<n;i++){
            if(F[i][j]==0){
                v.pb(i);
            }
        }
        bool ok=true;
        for(int i=1;i<v.size();i++){
            if(v[i-1]+1!=v[i]){
                ok=false;
            }
        }
        if(!ok){
            return 0;
        }
    }
    for(auto x:u){
        for(auto y:u){
            if(x.ss<y.ff||y.ss<x.ff){
                return 0;
            }
        }
    }
    return total;
}

Compilation message

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:16:19: error: 'n' was not declared in this scope
   16 |     for(int i=0;i<n;i++){
      |                   ^
soccer.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for(int j=1;j<v.size();j++){
      |                     ~^~~~~~~~~
soccer.cpp:37:19: error: 'n' was not declared in this scope
   37 |     for(int j=0;j<n;j++){
      |                   ^
soccer.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int i=1;i<v.size();i++){
      |                     ~^~~~~~~~~