QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#864826 | #7942. $K$ Subsequences | Step_Aside | WA | 33ms | 3584kb | C++14 | 483b | 2025-01-21 09:36:55 | 2025-01-21 09:36:56 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int t, n, k;
const int N = 2e5 + 7;
int a[N], b[N];
void solve() {
cin >> n >> k;
for (int i = 1; i <= n; ++ i) cin >> a[i];
int pos = 0, idx = 0;
for (int i = 1; i <= n; ++ i) {
if (a[i] == 1) {
b[i] = pos + 1; pos = (pos + 1) % k;
} else {
b[i] = idx + 1; idx = (idx + 1) % k;
}
}
for (int i = 1; i <= n; ++ i) cout << b[i] << ' '; cout << '\n';
}
int main() {
cin >> t;
while (t--) solve();
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3584kb
input:
5 3 2 1 -1 1 4 2 -1 1 1 -1 7 3 1 1 1 1 1 1 1 10 3 1 1 1 1 -1 -1 1 1 1 1 12 4 1 1 1 1 -1 -1 -1 -1 1 1 1 1
output:
1 1 2 1 1 2 2 1 2 3 1 2 3 1 1 2 3 1 1 2 2 3 1 2 1 2 3 4 1 2 3 4 1 2 3 4
result:
ok Correct (5 test cases)
Test #2:
score: -100
Wrong Answer
time: 33ms
memory: 3584kb
input:
18434 10 1 -1 1 1 -1 -1 1 -1 -1 1 1 10 2 -1 -1 -1 1 1 -1 1 1 1 1 10 2 1 -1 -1 -1 -1 1 1 -1 1 1 10 7 1 1 -1 1 -1 1 1 -1 -1 1 9 1 -1 1 -1 1 1 -1 1 -1 1 8 1 -1 -1 -1 -1 1 1 -1 -1 10 3 -1 -1 -1 1 1 1 1 -1 -1 -1 9 1 1 -1 -1 1 -1 -1 -1 -1 -1 10 10 -1 1 1 1 1 1 1 1 1 1 10 4 -1 1 -1 1 -1 1 1 -1 1 1 9 3 1 1 ...
output:
1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 2 1 2 1 2 1 1 2 1 2 2 1 1 2 1 1 2 1 3 2 4 5 3 4 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 3 1 2 3 1 1 2 3 1 1 1 1 1 1 1 1 1 1 1 2 3 4 5 6 7 8 9 1 1 2 2 3 3 4 4 1 2 1 2 1 2 3 3 1 1 2 1 2 1 3 4 1 2 2 1 1 2 3 4 5 6 7 2 1 1 1 2 2 3 4 3 4 5 1 1 1 1 1 1 1 1 1 1 2...
result:
wrong answer Jury found better answer than participant (test case 10)