Submission #980159

# Submission time Handle Problem Language Result Execution time Memory
980159 2024-05-12T00:24:34 Z vjudge1 Soccer Stadium (IOI23_soccer) C++17
Compilation error
0 ms 0 KB
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;

//int biggest_stadium(int n, vvi f)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int cnt=0, x, y, n; cin>>n;
    vvi f(n+1, vi(n+1, 0));
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin>>f[i][j];
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            if(f[i][j]==1){
                cnt++;
                y=i;    x=j;
            }
    if(cnt>1)   return 0;
    int ans=1;
    int aux=n*(n-1-y)+max((y+1)*x, (y+1)*(n-x-1));
    ans=max(ans, aux);
    aux=n*y+max((n-x-1)*(n-y), x*(n-y));
    ans=max(ans, aux);
    
    aux=n*x+max((n-x)*y, (n-x)*(n-y-1));
    ans=max(ans, aux);
    aux=n*(n-x-1)+max((x+1)*y, (x+1)*(n-y-1));
    ans=max(ans, aux);
    
    cout<<ans;
}

Compilation message

soccer.cpp: In function 'int main()':
soccer.cpp:50:33: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |     aux=n*y+max((n-x-1)*(n-y), x*(n-y));
      |                                ~^~~~~~
soccer.cpp:50:36: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   50 |     aux=n*y+max((n-x-1)*(n-y), x*(n-y));
      |                                  ~~^~~
/usr/bin/ld: /tmp/ccbJ82Nn.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccV3iEwn.o:soccer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccbJ82Nn.o: in function `main':
grader.cpp:(.text.startup+0x4ac): undefined reference to `biggest_stadium(int, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status