Submission #1018282

#TimeUsernameProblemLanguageResultExecution timeMemory
1018282tmarcinkeviciusSoccer Stadium (IOI23_soccer)C++17
0 / 100
0 ms348 KiB
#include "soccer.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define f first #define s second int biggest_stadium(int N, vector<vector<int>> F) { pii minRow, maxRow; bool possible = true; int state = 0; int fullCount = 0; pii prev; for (int i = 0; i < N; i++) { int start = N; int end = 0; int openCount = 0; for (int j = 0; j < N; j++) { if (F[i][j] == 0) { fullCount++; if (openCount == 0) { openCount++; } else if (openCount == 2) { openCount++; break; } start = min(start, j); end = max(end, j); } else { if (openCount == 1) { openCount++; } } } cout << "i = " << i << ", {" << start << ", " << end << "}, cnt = " << openCount << '\n'; if (openCount >= 3) { possible = false; } if (i == 0) { minRow = {start, end}; maxRow = {start, end}; prev = {start, end}; continue; } // cout << "min: {" << minRow.f << ", " << minRow.s << "}, max: {" << maxRow.f << ", " << maxRow.s << "}\n"; if (state == 0 && start <= maxRow.f && end >= maxRow.s) { maxRow = {start, end}; prev = {start, end}; continue; } else if (start >= prev.f && end <= prev.s && ((start >= minRow.f && end <= minRow.s) || (start <= minRow.f && end >= minRow.s))) { state = 1; minRow = {max(minRow.f, start), min(minRow.s, end)}; prev = {start, end}; continue; } possible = false; break; } if (possible) { return fullCount; } 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...