#include<bits/stdc++.h>
#include "soccer.h"
using namespace std;
pair<int,int> process(vector<int> S){
int L=-1,R=-1,flag = 1;
for(int i=0;i<(int)S.size();i++){
if(!S[i] && L==-1){
L = i; R = i;
}
else if(!S[i] && R==i-1){
R=i;
}
else if(!S[i]){
flag = 0;
}
}
if(!flag) return make_pair(-2,-2);
return make_pair(L,R);
}
int check_Left(vector<int> List){
int answer=1,down=0,flag = 0, Last = -1 , next_level = 0;
for(int i:List){
if(i==-2) answer=0;
else if(i==-1 && Last!=-1) flag = 1;
else{
if(flag) answer = 0;
if(Last==-1) Last = i;
else{
if(i>Last && next_level==0) next_level = 1;
else if(i<Last && next_level==1) answer = 0;
}
Last = i;
}
}
if(down > 1 || answer==0) return 0;
else return 1;
}
int check_Right(vector<int> List){
int answer=1,down=0,flag = 0, Last = -1 , next_level = 0;
for(int i:List){
if(i==-2) answer=0;
else if(i==-1 && Last!=-1) flag = 1;
else{
if(flag) answer = 0;
if(Last==-1) Last = i;
else{
if(i<Last && next_level==0) next_level = 1;
else if(i>Last && next_level==1) answer = 0;
}
Last = i;
}
}
if(down > 1 || answer==0) return 0;
else return 1;
}
int biggest_stadium(int N,vector<vector<int>> F){
vector<int> a;
vector<int> b;
int Count = 0;
for(auto i:F){
for(int j:i){
if(j==0) Count++;
}
pair<int,int> tmp = process(i);
a.push_back(tmp.first);
b.push_back(tmp.second);
}
if(check_Left(a) && check_Right(b)) return Count;
else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 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 |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
1 ms |
348 KB |
partial |
8 |
Partially correct |
19 ms |
2208 KB |
partial |
9 |
Partially correct |
252 ms |
32024 KB |
partial |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 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 |
Incorrect |
0 ms |
348 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
600 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 |
Incorrect |
0 ms |
348 KB |
wrong |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
600 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
600 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Partially correct |
0 ms |
348 KB |
partial |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Incorrect |
0 ms |
348 KB |
wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
partial |
2 |
Correct |
0 ms |
600 KB |
ok |
3 |
Correct |
0 ms |
348 KB |
ok |
4 |
Correct |
0 ms |
348 KB |
ok |
5 |
Correct |
0 ms |
348 KB |
ok |
6 |
Correct |
0 ms |
348 KB |
ok |
7 |
Partially correct |
0 ms |
348 KB |
partial |
8 |
Partially correct |
1 ms |
348 KB |
partial |
9 |
Partially correct |
19 ms |
2208 KB |
partial |
10 |
Partially correct |
252 ms |
32024 KB |
partial |
11 |
Partially correct |
0 ms |
348 KB |
partial |
12 |
Partially correct |
0 ms |
348 KB |
partial |
13 |
Incorrect |
0 ms |
348 KB |
wrong |
14 |
Halted |
0 ms |
0 KB |
- |