QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#360381#7942. $K$ SubsequencesVengeful_Spirit#WA 0ms3648kbC++20727b2024-03-21 18:39:592024-03-21 18:39:59

Judging History

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

  • [2024-03-21 18:39:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-03-21 18:39:59]
  • 提交

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)