QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393658#7942. $K$ Subsequenceskyuukyuusha#WA 23ms3672kbC++17569b2024-04-19 02:15:302024-04-19 02:15:30

Judging History

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

  • [2024-04-19 02:15:30]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:3672kb
  • [2024-04-19 02:15:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while(t--) {
      int n, k;
      cin >> n >> k;
      int a = 1, b = 1;
      int x;
      while(n--) {
          cin >> x;
          if(x==1) {
              cout << a << " ";
              a %= k;
              ++a;
          } else {
              cout << b << " ";
              b %= k;
              ++b;
          }
      }
      cout << endl;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

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: 23ms
memory: 3664kb

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)