Submission #1059188

#TimeUsernameProblemLanguageResultExecution timeMemory
1059188hasan2006Soccer Stadium (IOI23_soccer)C++17
1.50 / 100
174 ms55184 KiB
#include <bits/stdc++.h> //#include "soccer.h" using namespace std; #define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); #define rall(s) s.rbegin(),s.rend() #define all(s) s.begin(),s.end() #define pb push_back #define se second #define fi first #define ll long long #define ld long double #define YES cout<<"YES\n" #define Yes cout<<"Yes\n" #define yes cout<<"yes\n" #define NO cout<<"NO\n" #define No cout<<"No\n" #define no cout<<"no\n" const int N = 2e3 + 9 , mod = 1e9 + 7; ll b[N] , dp[N] , c[N] , d[N] , us[N][N] ; vector<vector<int>>a; void dfs(int i , int j , int n) { if(!us[i][j]) us[i][j] = 1; if(j && !a[i][j - 1] && !us[i][j - 1]) dfs(i , j - 1 , n); if(i && !a[i - 1][j] && !us[i - 1][j]) dfs(i - 1, j , n); if(j + 1 < n && !a[i][j + 1] && !us[i][j + 1]) dfs(i , j + 1 , n); if(i + 1 < n && !a[i + 1][j] && !us[i + 1][j]) dfs(i + 1, j , n); } int biggest_stadium(int n , vector<vector<int>>a) { ll i , j , l, r , s = 0 , f = 0 , x , y , k , m ; ::a = a; y = 0; for(i = 0; i < n; i++) { s = 0; for(j = 0; j < n; j++) { f += 1 - a[i][j]; if(a[i][j] == 0 && s == 0) s = 1; else if(a[i][j] == 1 && s == 1) s = 2; else if(a[i][j] == 0 && s == 2) s = -1; } if(s == -1) return n * n + 1; } for(i = 0; i < n; i++) { s = 0; for(j = 0; j < n; j++) { if(a[j][i] == 0 && s == 0) s = 1; else if(a[j][i] == 1 && s == 1) s = 2; else if(a[j][i] == 0 && s == 2) s = -1; } if(s == -1) return n * n + 1; } for(i = 0; i < n; i++) for(j = 0; j < n; j++) if(!us[i][j] && !a[i][j]) dfs(i , j , n) , y++; if(y <= 1) return f; else return n * n + 1; }

Compilation message (stderr)

soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:37:17: warning: unused variable 'l' [-Wunused-variable]
   37 |     ll i , j ,  l,  r , s  = 0 , f  = 0 , x , y , k , m ;
      |                 ^
soccer.cpp:37:21: warning: unused variable 'r' [-Wunused-variable]
   37 |     ll i , j ,  l,  r , s  = 0 , f  = 0 , x , y , k , m ;
      |                     ^
soccer.cpp:37:43: warning: unused variable 'x' [-Wunused-variable]
   37 |     ll i , j ,  l,  r , s  = 0 , f  = 0 , x , y , k , m ;
      |                                           ^
soccer.cpp:37:51: warning: unused variable 'k' [-Wunused-variable]
   37 |     ll i , j ,  l,  r , s  = 0 , f  = 0 , x , y , k , m ;
      |                                                   ^
soccer.cpp:37:55: warning: unused variable 'm' [-Wunused-variable]
   37 |     ll i , j ,  l,  r , s  = 0 , f  = 0 , x , y , k , m ;
      |                                                       ^
#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...