QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#360381 | #7942. $K$ Subsequences | Vengeful_Spirit# | WA | 0ms | 3648kb | C++20 | 727b | 2024-03-21 18:39:59 | 2024-03-21 18:39:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int res[N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin>>T;
while(T--){
int n,k;
cin>>n>>k;
vector<int>a,b;
for(int i=1;i<=n;i++){
int x;
cin>>x;
if(x==1)a.push_back(i);
else b.push_back(i);
}
int cnt=0;
for(int i=0;i<a.size();i++){
res[a[i]]=i/((a.size()+k-1)/k)+1;
}
for(int i=0;i<b.size();i++){
res[b[i]]=i/((b.size()+k-1)/k)+1;
}
for(int i=1;i<=n;i++){
cout<<res[i]<<" ";
}
cout<<"\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
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 1 1 2 2 2 3 1 1 1 2 1 2 2 2 3 3 1 1 2 2 1 2 3 4 3 3 4 4
result:
wrong answer Jury found better answer than participant (test case 4)