# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1001040 |
2024-06-18T13:25:08 Z |
변재우(#10901) |
Soccer Stadium (IOI23_soccer) |
C++17 |
|
0 ms |
348 KB |
#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
int ans=0;
for(int i=0; i<N; i++) {
for(int j=0; j<N; j++) {
if(F[i][j]) continue;
int r=j;
for(int k=j+1; k<N && !F[i][k]; k++) r=k;
vector<int> A, B;
for(int k=j; k<=r; k++) {
int u=1, d=0;
for(int l=i; l>=0; l--) {
if(F[l][k]) break;
u=i-l+1;
}
for(int l=i+1; l<N; l++) {
if(F[l][k]) break;
d=l-i;
}
A.push_back(u), B.push_back(d);
}
int mx1=0, mx2=0;
for(int k=0; k<A.size(); k++) {
int curr=A[k], sum=0;
for(int l=k; l>=0; l--) curr=min(curr, A[l]), sum+=curr;
curr=A[k];
for(int l=k+1; l<N; l++) curr=min(curr, A[l]), sum+=curr;
mx1=max(mx1, sum);
}
for(int k=0; k<B.size(); k++) {
int curr=B[k], sum=0;
for(int l=k; l>=0; l--) curr=min(curr, B[l]), sum+=curr;
curr=B[k];
for(int l=k+1; l<N; l++) curr=min(curr, B[l]), sum+=curr;
mx2=max(mx2, sum);
}
ans=max({ans, mx1, mx2});
j=r+1;
}
}
for(int i=0; i<N; i++) for(int j=0; j<=i; j++) swap(F[i][j], F[j][i]);
for(int i=0; i<N; i++) {
for(int j=0; j<N; j++) {
if(F[i][j]) continue;
int r=j;
for(int k=j+1; k<N && !F[i][k]; k++) r=k;
vector<int> A, B;
for(int k=j; k<=r; k++) {
int u=1, d=0;
for(int l=i; l>=0; l--) {
if(F[l][k]) break;
u=i-l+1;
}
for(int l=i+1; l<N; l++) {
if(F[l][k]) break;
d=l-i;
}
A.push_back(u), B.push_back(d);
}
int mx1=0, mx2=0;
for(int k=0; k<A.size(); k++) {
int curr=A[k], sum=0;
for(int l=k; l>=0; l--) curr=min(curr, A[l]), sum+=curr;
curr=A[k];
for(int l=k+1; l<A.size(); l++) curr=min(curr, A[l]), sum+=curr;
mx1=max(mx1, sum);
}
for(int k=0; k<B.size(); k++) {
int curr=B[k], sum=0;
for(int l=k; l>=0; l--) curr=min(curr, B[l]), sum+=curr;
curr=B[k];
for(int l=k+1; l<B.size(); l++) curr=min(curr, B[l]), sum+=curr;
mx2=max(mx2, sum);
}
ans=max({ans, mx1, mx2});
j=r+1;
}
}
return ans;
}
Compilation message
soccer.cpp: In function 'int biggest_stadium(int, std::vector<std::vector<int> >)':
soccer.cpp:27:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int k=0; k<A.size(); k++) {
| ~^~~~~~~~~
soccer.cpp:34:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(int k=0; k<B.size(); k++) {
| ~^~~~~~~~~
soccer.cpp:65:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | for(int k=0; k<A.size(); k++) {
| ~^~~~~~~~~
soccer.cpp:69:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
69 | for(int l=k+1; l<A.size(); l++) curr=min(curr, A[l]), sum+=curr;
| ~^~~~~~~~~
soccer.cpp:72:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
72 | for(int k=0; k<B.size(); k++) {
| ~^~~~~~~~~
soccer.cpp:76:33: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
76 | for(int l=k+1; l<B.size(); l++) curr=min(curr, B[l]), sum+=curr;
| ~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Incorrect |
0 ms |
348 KB |
wrong |
3 |
Halted |
0 ms |
0 KB |
- |