# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1001042 |
2024-06-18T13:27:23 Z |
변재우(#10901) |
축구 경기장 (IOI23_soccer) |
C++17 |
|
4500 ms |
31768 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+1;
}
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+1;
}
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;
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
1 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
5 ms |
348 KB |
ok |
8 |
Correct |
597 ms |
2412 KB |
ok |
9 |
Execution timed out |
4544 ms |
31768 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Partially correct |
0 ms |
348 KB |
partial |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Correct |
1 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Incorrect |
0 ms |
348 KB |
wrong |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Partially correct |
0 ms |
348 KB |
partial |
5 |
Partially correct |
0 ms |
348 KB |
partial |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Partially correct |
0 ms |
348 KB |
partial |
9 |
Correct |
1 ms |
348 KB |
ok |
10 |
Correct |
0 ms |
348 KB |
ok |
11 |
Correct |
0 ms |
348 KB |
ok |
12 |
Incorrect |
0 ms |
348 KB |
wrong |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Incorrect |
0 ms |
348 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Correct |
0 ms |
348 KB |
ok |
9 |
Correct |
0 ms |
348 KB |
ok |
10 |
Partially correct |
0 ms |
348 KB |
partial |
11 |
Correct |
1 ms |
348 KB |
ok |
12 |
Correct |
0 ms |
348 KB |
ok |
13 |
Correct |
0 ms |
348 KB |
ok |
14 |
Incorrect |
0 ms |
348 KB |
wrong |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
ok |
2 |
Correct |
0 ms |
348 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
1 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Correct |
0 ms |
348 KB |
ok |
8 |
Correct |
5 ms |
348 KB |
ok |
9 |
Correct |
597 ms |
2412 KB |
ok |
10 |
Execution timed out |
4544 ms |
31768 KB |
Time limit exceeded |
11 |
Halted |
0 ms |
0 KB |
- |