# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475191 | bigo | Table Tennis (info1cup20_tabletennis) | C++14 | 70 ms | 884 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>
#include <cmath>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<int>vec(n + k);
for (int i = 0; i < n + k; i++)
cin >> vec[i];
int ans=1;
int max1 = 0;
int pla;
vector<bool>vec1(n + k, false);
for (int i = 0; i < n + k - 1; i++) {
if (vec[i + 1] == vec[i] + 1) {
ans++;
max1 = max(max1, ans);
vec1[i] = true;
vec1[i + 1] = true;
}
else
ans = 1;
}
max1 = min(max1, n);
int cnt = 0;
for (int i = 0; i < max1; i++) {
if (vec1[i])
cnt++;
}
if (cnt == max1) {
for (int j = 0; j <= max1 - 1; j++)
cout << vec[j] << " ";
}
else {
for (int i = 1; i <= n + k - max1; i++) {
if (vec1[i - 1])
cnt--;
if (vec1[i + max1 - 1])
cnt++;
if (cnt == max1) {
for (int j = i; j <= i + max1 - 1; j++)
cout << vec[j] << " ";
break;
}
}
}
}
Compilation message (stderr)
# | 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... |
# | 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... |