# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
522421 | KoD | Preokret (COCI18_preokret) | C++17 | 1 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::tuple;
using std::pair;
constexpr int L = 2880;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
array<array<int, 2>, L> game = {};
int half = 0;
for (int k = 0; k < 2; ++k) {
int n;
std::cin >> n;
while (n--) {
int x;
std::cin >> x;
half += x <= L / 2;
game[x - 1][k] += 1;
}
}
std::cout << half << '\n';
int turn = 0;
array<int, 2> score = {};
array<bool, 2> losing = {};
for (const auto& add : game) {
array<int, 2> next = score;
for (int k = 0; k < 2; ++k) {
next[k] += add[k];
}
for (int k = 0; k < 2; ++k) {
if (losing[k] and next[k] > next[k ^ 1]) {
turn += 1;
}
}
for (int k = 0; k < 2; ++k) {
if (next[k] > next[k ^ 1]) {
losing[k] = false;
losing[k ^ 1] = true;
}
}
score = std::move(next);
}
std::cout << turn << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |