QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#757965#9574. StripsWTR2007WA 0ms3748kbC++201.3kb2024-11-17 14:55:092024-11-17 14:55:10

Judging History

你现在查看的是最新测评结果

  • [2024-11-17 14:55:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2024-11-17 14:55:09]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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)