# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44831 | cheater2k | DEL13 (info1cup18_del13) | C++17 | 583 ms | 1692 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, q;
int a[N], del[N];
vector <int> vres;
void solve() {
cin >> n >> q;
for (int i = 1; i <= q; ++i) cin >> a[i];
a[q + 1] = n + 1;
vres.clear();
for (int i = 1; i <= q + 1; ++i) {
vector <int> vec;
for (int j = a[i - 1] + 1; j < a[i]; ++j) vec.push_back(j);
while(vec.size() > 2) {
vres.push_back(vec[1]);
vec.erase(vec.begin() + 2);
vec.erase(vec.begin());
}
del[i] = vec.size();
}
for (int i = 2; i <= q + 1; ++i) {
while(del[i - 1] > 0) {
del[i - 1]--;
del[i]--;
vres.push_back(a[i - 1]);
}
if (del[i] < 0) { // invalid
printf("-1\n");
return;
}
}
if (del[q + 1] > 0) { // invalid
printf("-1\n");
return;
}
printf("%d\n", vres.size());
for (int &i : vres) printf("%d ", i);
printf("\n");
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int tt; cin >> tt;
while(tt--) {
solve();
}
}
컴파일 시 표준 에러 (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... |