# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1000747 | 2024-06-18T08:13:54 Z | kunzaZa183 | Soccer Stadium (IOI23_soccer) | C++17 | 208 ms | 39044 KB |
#include "soccer.h" #include <bits/stdc++.h> using namespace std; int biggest_stadium(int N, vector<vector<int>> F) { vector<pair<int, int>> vpii; int cur; for (int i = 0; i < N; i++) { pair<int, int> pii = {-1, -1}; cur = 0; for (int j = 0; j < N; j++) if (cur == 0) { if (F[i][j] == 0) { cur++; pii.first = j; } } else if (cur == 1) { if (F[i][j] == 1) { cur++; pii.second = j - 1; } } else if (cur == 2) if (F[i][j] == 0) return INT_MAX; if (cur == 1) pii.second = N - 1; vpii.push_back(pii); } // for (auto a : vpii) cout << a.first << " " << a.second << "\n"; cur = 0; for (auto a : vpii) if (cur == 0) { if (a.first != -1) cur++; } else if (cur == 1) { if (a.first == -1) cur++; } else if (cur == 2) { if (a.first != -1) return INT_MAX; } while (!vpii.empty()) if (vpii.back().first == -1) vpii.pop_back(); else break; while (!vpii.empty()) if (vpii.front().first == -1) vpii.erase(vpii.begin()); else break; for (int i = 0; i < vpii.size(); i++) { bool fails = 0; for (int j = i - 1; j >= 0; j--) if (vpii[j].first < vpii[j + 1].first || vpii[j].second > vpii[j + 1].second) fails = 1; for (int j = i + 1; j < vpii.size(); j++) if (vpii[j].first < vpii[j - 1].first || vpii[j].second > vpii[j - 1].second) fails = 1; if (!fails) goto A; } return INT_MAX; A:; vpii.clear(); for (int j = 0; j < N; j++) { pair<int, int> pii = {-1, -1}; cur = 0; for (int i = 0; i < N; i++) if (cur == 0) { if (F[i][j] == 0) { cur++; pii.first = i; } } else if (cur == 1) { if (F[i][j] == 1) { cur++; pii.second = i - 1; } } else if (cur == 2) if (F[i][j] == 0) return INT_MAX; if (cur == 1) pii.second = N - 1; vpii.push_back(pii); } // for (auto a : vpii) cout << a.first << " " << a.second << '\n'; cur = 0; for (auto a : vpii) if (cur == 0) { if (a.first != -1) cur++; } else if (cur == 1) { if (a.first == -1) cur++; } else if (cur == 2) { if (a.first != -1) return INT_MAX; } while (!vpii.empty()) if (vpii.back().first == -1) vpii.pop_back(); else break; while (!vpii.empty()) if (vpii.front().first == -1) vpii.erase(vpii.begin()); else break; for (int i = 0; i < vpii.size(); i++) { bool fails = 0; for (int j = i - 1; j >= 0; j--) if (vpii[j].first < vpii[j + 1].first || vpii[j].second > vpii[j + 1].second) fails = 1; for (int j = i + 1; j < vpii.size(); j++) if (vpii[j].first < vpii[j - 1].first || vpii[j].second > vpii[j - 1].second) fails = 1; if (!fails) { int ct = 0; for (auto a : F) for (auto b : a) ct += 1 - b; return ct; } } return INT_MAX; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | partial |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | ok |
2 | Correct | 0 ms | 440 KB | ok |
3 | Correct | 1 ms | 436 KB | ok |
4 | Correct | 0 ms | 348 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Partially correct | 1 ms | 348 KB | partial |
7 | Partially correct | 1 ms | 348 KB | partial |
8 | Partially correct | 16 ms | 2700 KB | partial |
9 | Partially correct | 208 ms | 39044 KB | partial |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | ok |
2 | Correct | 0 ms | 440 KB | ok |
3 | Partially correct | 0 ms | 344 KB | partial |
4 | Partially correct | 0 ms | 348 KB | partial |
5 | Partially correct | 0 ms | 348 KB | partial |
6 | Partially correct | 0 ms | 436 KB | partial |
7 | Incorrect | 0 ms | 348 KB | wrong |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | partial |
2 | Correct | 1 ms | 348 KB | ok |
3 | Correct | 0 ms | 440 KB | ok |
4 | Partially correct | 0 ms | 344 KB | partial |
5 | Partially correct | 0 ms | 348 KB | partial |
6 | Partially correct | 0 ms | 348 KB | partial |
7 | Partially correct | 0 ms | 436 KB | partial |
8 | Incorrect | 0 ms | 348 KB | wrong |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | partial |
2 | Correct | 1 ms | 348 KB | ok |
3 | Correct | 0 ms | 440 KB | ok |
4 | Correct | 1 ms | 436 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Partially correct | 0 ms | 344 KB | partial |
7 | Partially correct | 0 ms | 348 KB | partial |
8 | Partially correct | 0 ms | 348 KB | partial |
9 | Partially correct | 0 ms | 436 KB | partial |
10 | Incorrect | 0 ms | 348 KB | wrong |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | partial |
2 | Correct | 1 ms | 348 KB | ok |
3 | Correct | 0 ms | 440 KB | ok |
4 | Correct | 1 ms | 436 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Partially correct | 0 ms | 344 KB | partial |
7 | Partially correct | 0 ms | 348 KB | partial |
8 | Partially correct | 0 ms | 348 KB | partial |
9 | Partially correct | 0 ms | 436 KB | partial |
10 | Incorrect | 0 ms | 348 KB | wrong |
11 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | partial |
2 | Correct | 1 ms | 348 KB | ok |
3 | Correct | 0 ms | 440 KB | ok |
4 | Correct | 1 ms | 436 KB | ok |
5 | Correct | 0 ms | 348 KB | ok |
6 | Correct | 0 ms | 348 KB | ok |
7 | Partially correct | 1 ms | 348 KB | partial |
8 | Partially correct | 1 ms | 348 KB | partial |
9 | Partially correct | 16 ms | 2700 KB | partial |
10 | Partially correct | 208 ms | 39044 KB | partial |
11 | Partially correct | 0 ms | 344 KB | partial |
12 | Partially correct | 0 ms | 348 KB | partial |
13 | Partially correct | 0 ms | 348 KB | partial |
14 | Partially correct | 0 ms | 436 KB | partial |
15 | Incorrect | 0 ms | 348 KB | wrong |
16 | Halted | 0 ms | 0 KB | - |