Submission #955200

#TimeUsernameProblemLanguageResultExecution timeMemory
95520042kangarooSoccer Stadium (IOI23_soccer)C++17
25 / 100
438 ms39956 KiB
#include "soccer.h" #include "bits/stdc++.h" int biggest_stadium(int N, std::vector<std::vector<int>> F) { using namespace std; bool allPos = true; vector<pair<int, int>> ra(N); vector<int> les(N); for (int i = 0; i < N; ++i) { ra[i].first = 0; for (; ra[i].first < N; ra[i].first++) { if (F[i][ra[i].first] == 0) break; } ra[i].second = N - 1; for (; ra[i].second >= 0; ra[i].second--) { if (F[i][ra[i].second] == 0) break; } les[i] = ra[i].second - ra[i].first + 1; for (int j = ra[i].first; j <= ra[i].second; ++j) { if (F[i][j] == 1) allPos = false; } if (!allPos) break; } int tot = 0; int maI = max_element(les.begin(), les.end()) - les.begin(); pair<int,int> actRa = ra[maI]; pair<int,int> oRa = {maI, maI}; tot = les[maI]; while (allPos && oRa != make_pair(0, N - 1)) { int ne = oRa.first -1; if (ne < 0 || (oRa.second < N - 1 && les[ne] < les[oRa.second + 1])) ne = oRa.second + 1; if (les[ne] < 0) break; if (actRa.first > ra[ne].first || actRa.second < ra[ne].second) allPos = false; actRa = ra[ne]; tot += les[ne]; oRa = {min(oRa.first, ne), max(oRa.second, ne)}; } if (allPos) return tot; else return 0; }
#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...