이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
# | 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... |