# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44831 | 2018-04-07T14:16:24 Z | cheater2k | DEL13 (info1cup18_del13) | C++17 | 500 ms | 1692 KB |
#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(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Incorrect | 7 ms | 428 KB | Output isn't correct |
4 | Incorrect | 7 ms | 588 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 38 ms | 796 KB | Output is correct |
2 | Execution timed out | 583 ms | 1428 KB | Time limit exceeded |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Incorrect | 7 ms | 428 KB | Output isn't correct |
4 | Incorrect | 7 ms | 588 KB | Output isn't correct |
5 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
6 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
7 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Incorrect | 7 ms | 428 KB | Output isn't correct |
4 | Incorrect | 7 ms | 588 KB | Output isn't correct |
5 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
6 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
7 | Incorrect | 2 ms | 1428 KB | Output isn't correct |
8 | Incorrect | 423 ms | 1572 KB | Output isn't correct |
9 | Incorrect | 435 ms | 1692 KB | Output isn't correct |
10 | Incorrect | 283 ms | 1692 KB | Output isn't correct |
11 | Incorrect | 299 ms | 1692 KB | Output isn't correct |