# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676783 | Cyanmond | Martian DNA (BOI18_dna) | C++17 | 223 ms | 29320 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>
int main() {
int N, K, R;
std::cin >> N >> K >> R;
std::vector<int> D(N);
for (auto &e : D) {
std::cin >> e;
}
std::vector<std::vector<int>> index_list(K);
for (int i = 0; i < N; ++i) {
index_list[D[i]].push_back(i);
}
std::vector<std::vector<std::pair<int, bool>>> events(N + 1);
while (R--) {
int B, Q;
std::cin >> B >> Q;
const auto &list = index_list[B];
if ((int)list.size() < Q) {
events[0].push_back({3 * N, true});
break;
}
events[0].push_back({list[Q - 1], true});
for (int i = 0; i < (int)list.size() - Q; ++i) {
events[list[i] + 1].push_back({list[i + Q - 1], false});
events[list[i] + 1].push_back({list[i + Q], true});
}
events[list[(int)list.size() - Q] + 1].push_back({3 * N, true});
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |