QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#864826#7942. $K$ SubsequencesStep_AsideWA 33ms3584kbC++14483b2025-01-21 09:36:552025-01-21 09:36:56

Judging History

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

  • [2025-01-21 09:36:56]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:3584kb
  • [2025-01-21 09:36:55]
  • 提交

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)