QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#448863 | #7942. $K$ Subsequences | kzxx00011 | WA | 0ms | 3632kb | C++14 | 621b | 2024-06-20 10:17:54 | 2024-06-20 10:17:55 |
Judging History
answer
#include<iostream>
using namespace std;
const int N=2e5+1;
int a[N];
int b[N];
int n,k;
int sum1,sum2;
int main()
{
int t;
cin>>t;
while(t--)
{
sum1=0,sum2=0;
cin>>n>>k; //k个盒子
for(int i=1;i<=n;i++)
{
cin>>a[i];
if(a[i]==1) sum1++; //sum1个1
else sum2++; //sum2个挡板
}
int fg=sum1/(k+sum2);
int cnt1=0;
int js1=1;
for(int i=1;i<=n;i++)
{
if(a[i]==1)
{
cnt1++;
if(cnt1>fg&&js1<k) js1++,cnt1=1;
b[i]=js1;
}
else b[i]=k;
}
for(int i=1;i<=n;i++) cout<<b[i]<<" ";
cout<<endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3632kb
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:
2 2 2 2 2 2 2 1 1 2 2 3 3 3 1 2 3 3 3 3 3 3 3 3 1 2 3 4 4 4 4 4 4 4 4 4
result:
wrong answer Jury found better answer than participant (test case 2)