#include "soccer.h"
#include <bits/stdc++.h>
using namespace std;
int biggest_stadium(int N, std::vector<std::vector<int>> F){
vector< pair< int , int > > v;
for(int cnt , has = 0, i = 0 ;i < N;i++){
cnt = 0;
has = 0;
for(int j = 0 ;j < N;j++){
if(F[i][j] == 0){
cnt++;
}
else{
if(cnt == 0) continue;
has++;
v.push_back(make_pair(cnt , j - 1));
cnt = 0;
}
}
if(cnt > 0){
has++;
v.push_back(make_pair(cnt , N - 1));
}
if(has > 1) return 0;
if(has == 0) v.push_back(make_pair(0 , N - 1));
}
int state = 0;
for(int i = 1;i < N;i++){
if(v[i].first < v[i - 1].first){
if(state == 1) return false;
state = 1;
}
}
sort(v.begin(),v.end());
int ans = 0;
for(int i = 0 ;i < (int)v.size();i++){
ans += v[i].first;
v[i].first = v[i].second - v[i].first + 1;
if(i == 0) continue;
if(v[i - 1].second < v[i - 1].first) continue;
if(v[i - 1].first < v[i].first || v[i - 1].second > v[i].second)
return 0;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
1 ms |
212 KB |
ok |
6 |
Partially correct |
0 ms |
212 KB |
partial |
7 |
Partially correct |
1 ms |
340 KB |
partial |
8 |
Partially correct |
17 ms |
2260 KB |
partial |
9 |
Partially correct |
259 ms |
31760 KB |
partial |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
ok |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Partially correct |
1 ms |
256 KB |
partial |
4 |
Incorrect |
0 ms |
212 KB |
wrong |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Partially correct |
1 ms |
256 KB |
partial |
5 |
Incorrect |
0 ms |
212 KB |
wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
0 ms |
212 KB |
ok |
6 |
Partially correct |
1 ms |
256 KB |
partial |
7 |
Incorrect |
0 ms |
212 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
0 ms |
212 KB |
ok |
6 |
Partially correct |
1 ms |
256 KB |
partial |
7 |
Incorrect |
0 ms |
212 KB |
wrong |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
partial |
2 |
Correct |
0 ms |
212 KB |
ok |
3 |
Correct |
0 ms |
212 KB |
ok |
4 |
Correct |
0 ms |
212 KB |
ok |
5 |
Correct |
0 ms |
212 KB |
ok |
6 |
Correct |
1 ms |
212 KB |
ok |
7 |
Partially correct |
0 ms |
212 KB |
partial |
8 |
Partially correct |
1 ms |
340 KB |
partial |
9 |
Partially correct |
17 ms |
2260 KB |
partial |
10 |
Partially correct |
259 ms |
31760 KB |
partial |
11 |
Partially correct |
1 ms |
256 KB |
partial |
12 |
Incorrect |
0 ms |
212 KB |
wrong |
13 |
Halted |
0 ms |
0 KB |
- |