QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#757965 | #9574. Strips | WTR2007 | WA | 0ms | 3748kb | C++20 | 1.3kb | 2024-11-17 14:55:09 | 2024-11-17 14:55:10 |
Judging History
answer
#include<bits/stdc++.h>
#define fi first
#define se second
#define MULT_TEST 1
using namespace std;
typedef long double ldb;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const int MOD = 998244353;
inline int read() {
int w = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
w = (w << 1) + (w << 3) + ch - 48;
ch = getchar();
}
return w * f;
}
inline void Solve() {
int n, m, k, w;
n = read(), m = read(), k = read(), w = read();
vector<int> col(w + 1);
for (int a, i = 1; i <= n; i++) col[a = read()] = 1;
for (int a, i = 1; i <= m; i++) col[a = read()] = 2;
int pos = 1, flag = 1;
vector<int> A;
while (pos + k - 1 <= w) {
if (col[pos] == 1) {
for (int i = pos; i < pos + k; i++)
if (col[i] == 2) flag = 0;
A.push_back(pos), pos += k;
}
else pos++;
}
if (!flag) return printf("-1\n"), void();
printf("%d\n", (int)A.size());
for (auto u : A) printf("%d ", u);
puts("");
}
signed main() {
int _ = 1;
#if MULT_TEST
_ = read();
#endif
while (_--) Solve();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3748kb
input:
4 5 2 3 16 7 11 2 9 14 13 5 3 2 4 11 6 10 2 1 11 2 1 2 6 1 5 3 2 1 2 6 1 5 2
output:
-1 2 2 6 2 1 5 -1
result:
wrong answer Participant didn't find a solution but the jury found one. (test case 1)