이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
int biggest_stadium(int n, vector<vector<int>> a) {
int res = 1, temp, down, up;
bool ok, can1, can2;
vector<pair<int,int>> free;
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
if(!a[i][j]) free.push_back({i, j});
}
}
for(int i = 2; i < (1<<free.size()); i++) {
temp = i;
vector<int> tempfree;
for(int i = 0; i < free.size() && temp > 0; i++, temp/=2) {
if(temp%2==0) tempfree.push_back(i);
}
ok = true;
for(int i = 0; i < tempfree.size(); i++) {
for(int j = 0; j < tempfree.size(); j++) {
if(free[tempfree[i]].first < free[tempfree[j]].first) {
down = tempfree[i];
up = tempfree[j];
} else {
down = tempfree[j];
up = tempfree[i];
}
can1 = true, can2 = true;
//most down - upwards - then to the other
for(int z = free[down].first; z <= free[up].first; z++) {
if(a[z][free[down].second]) can1 = false;
}
for(int z = min(free[down].second, free[up].second); z <= max(free[down].second, free[up].second); z++) {
if(a[free[up].first][z]) can1 = false;
}
//most up - downwards - then to the other
for(int z = free[down].first; z <= free[up].first; z++) {
if(a[z][free[up].second]) can2 = false;
}
for(int z = min(free[down].second, free[up].second); z <= max(free[down].second, free[up].second); z++) {
if(a[free[down].first][z]) can2 = false;
}
if(!can1 && !can2) ok = false;
}
}
if(ok) res = max(res, (int)tempfree.size());
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:18: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]
18 | for(int i = 0; i < free.size() && temp > 0; i++, temp/=2) {
| ~~^~~~~~~~~~~~~
soccer.cpp:22:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int i = 0; i < tempfree.size(); i++) {
| ~~^~~~~~~~~~~~~~~~~
soccer.cpp:23:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
23 | for(int j = 0; j < tempfree.size(); j++) {
| ~~^~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |