Submission #840437

#TimeUsernameProblemLanguageResultExecution timeMemory
840437mohammad_kilaniSoccer Stadium (IOI23_soccer)C++17
1.50 / 100
262 ms31764 KiB
#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; int cnt2 = 0 , has2 = 0; 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; if(has) return 0; has = 1; v.push_back(make_pair(cnt , j - 1)); cnt = 0; } } if(cnt){ if(has) return 0; v.push_back(make_pair(cnt , N - 1)); has = 1; } if(has){ cnt2++; } else{ if(cnt2) has2++; cnt2 = 0; } } if(has2 > 0) return 0; 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].first < v[i].first || v[i - 1].second > v[i].second) return 0; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...