제출 #1082692

#제출 시각아이디문제언어결과실행 시간메모리
1082692HappyCapybara축구 경기장 (IOI23_soccer)C++17
8 / 100
2055 ms600 KiB
#include "soccer.h" #include<bits/stdc++.h> using namespace std; int n; vector<vector<int>> f; int check(){ int res = 0; vector<pair<int,int>> c; for (int i=0; i<n; i++){ int b = 0; for (int j=0; j<n; j++){ if (f[i][j] == 2){ if (b == 0) b = 1; if (b == 2) return 0; res++; int nb = 0; if (i > 0 && f[i-1][j] == 2) nb++; if (i < n-1 && f[i+1][j] == 2) nb++; if (j > 0 && f[i][j-1] == 2) nb++; if (j < n-1 && f[i][j+1] == 2) nb++; if (nb <= 2) c.push_back({i, j}); } else { if (b == 1) b = 2; } } } for (int j=0; j<n; j++){ int b = 0; for (int i=0; i<n; i++){ if (f[i][j] == 2){ if (b == 0) b = 1; if (b == 2) return 0; } else { if (b == 1) b = 2; } } } for (int i=0; i<c.size()-1; i++){ for (int j=i+1; j<c.size(); j++){ if (f[c[i].first][c[j].second] < 2 && f[c[j].first][c[i].second] < 2) return 0; } } return res; } int biggest_stadium(int N, vector<vector<int>> F){ n = N; f = F; int res = 0; for (int i=(1<<(N*N))-1; i>=1; i--){ bool valid = true; for (int j=0; j<N; j++){ for (int k=0; k<N; k++){ if (i & 1<<(j*N+k)){ if (F[j][k]) valid = false; f[j][k] = 2; } else f[j][k] = F[j][k]; if (!valid) break; } if (!valid) break; } if (valid) res = max(res, check()); } return res; }

컴파일 시 표준 에러 (stderr) 메시지

soccer.cpp: In function 'int check()':
soccer.cpp:42:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i=0; i<c.size()-1; i++){
      |                   ~^~~~~~~~~~~
soccer.cpp:43:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         for (int j=i+1; j<c.size(); j++){
      |                         ~^~~~~~~~~
#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...