제출 #1227117

#제출 시각아이디문제언어결과실행 시간메모리
1227117Gabriel축구 경기장 (IOI23_soccer)C++20
1.50 / 100
195 ms31772 KiB
#include "soccer.h" #include "bits/stdc++.h" using namespace std; int biggest_stadium(int n, vector< vector<int> > fulbo){ int r = 0; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(fulbo[i][j] == 0) r++; } } for(int i = 0; i < n; i++){ int Componentes = 0; for(int j = 0; j < n; j++){ if((j == 0 and fulbo[i][j] == 0) or (j > 0 and fulbo[i][j - 1] == 1 and fulbo[i][j] == 0)) Componentes++; } if(Componentes > 1) return 0; } for(int i = 0; i < n; i++){ int Componentes = 0; for(int j = 0; j < n; j++){ if((j == 0 and fulbo[j][i] == 0) or (j > 0 and fulbo[j - 1][i] == 1 and fulbo[j][i] == 0)) Componentes++; } if(Componentes > 1) return 0; } vector< pair<int, int> > Claves; int i; for(i = 0; i < n; i++) if(fulbo[0][i] == 0) break; Claves.push_back({0, i}); for(i = 0; i < n; i++) if(fulbo[i][0] == 0) break; Claves.push_back({i, 0}); for(i = n - 1; i > -1; i--) if(fulbo[i][0] == 0) break; Claves.push_back({i, 0}); for(i = 0; i < n; i++) if(fulbo[n - 1][i] == 0) break; Claves.push_back({n - 1, i}); for(i = n - 1; i > -1; i--) if(fulbo[n - 1][i] == 0) break; Claves.push_back({n - 1, i}); for(i = n - 1; i > -1; i--) if(fulbo[i][n - 1] == 0) break; Claves.push_back({i, n - 1}); for(i = 0; i < n; i++) if(fulbo[i][n - 1] == 0) break; Claves.push_back({i, n - 1}); for(i = n - 1; i > -1; i--) if(fulbo[0][i] == 0) break; Claves.push_back({0, i}); for(i = 0; i < 7; i++){ if(Claves[i].first <= -1 or Claves[i].first >= n or Claves[i].second <= -1 or Claves[i].second >= n) continue; for(int j = i + 1; j < 8; j++){ if(Claves[j].first <= -1 or Claves[j].first >= n or Claves[j].second <= -1 or Claves[j].second >= n) continue; bool No_se_puede = 1; for(int k = Claves[i].first; k < n and k > -1; k += (Claves[j].first - Claves[i].first) / abs(Claves[j].first - Claves[i].first)){ if(k == Claves[j].first){ No_se_puede = 0; break; } } for(int k = Claves[i].second; k < n and k > -1; k += (Claves[j].second - Claves[i].second) / abs(Claves[j].second - Claves[i].second)){ if(k == Claves[j].second){ No_se_puede = 0; break; } } if(No_se_puede) return -0; } } return r; }
#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...