QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294600#7942. $K$ Subsequencesckiseki#AC ✓27ms4732kbC++201.5kb2023-12-30 14:54:062023-12-30 14:54:06

Judging History

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

  • [2023-12-30 14:54:06]
  • 评测
  • 测评结果:AC
  • 用时:27ms
  • 内存:4732kb
  • [2023-12-30 14:54:06]
  • 提交

answer

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

#define all(x) begin(x), end(x)
#ifdef CKISEKI
#define safe cerr << __PRETTY_FUNCTION__ << " line " << __LINE__ << " safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(auto s, auto ...a) {
  cerr << "\e[1;32m(" << s << ") = (";
  int f = 0;
  (..., (cerr << (f++ ? ", " : "") << a));
  cerr << ")\e[0m\n";
}
#include <experimental/iterator>
void orange_(auto s, auto L, auto R) {
  cerr << "\e[1;33m[ " << s << " ] = [ ";
  using namespace experimental;
  copy(L, R, make_ostream_joiner(cerr, ", "));
  cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define orange(...) safe
#define debug(...) safe
#endif

int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int &ai : a)
      cin >> ai;
    map<int, queue<int>> qs;
    for (int i = 1; i <= k; ++i)
      qs[0].push(i);
    for (int i = 0; i < n; ++i) {
      if (a[i] == 1) {
        auto it = qs.begin();
        int x = it->second.front();
        it->second.pop();
        cout << x;
        qs[it->first + 1].push(x);
        if (it->second.empty())
          qs.erase(it);
      } else {
        auto it = prev(qs.end());
        int x = it->second.front();
        it->second.pop();
        cout << x;
        qs[max(it->first - 1, 0)].push(x);
        if (it->second.empty())
          qs.erase(it);
      }
      cout << " \n"[i + 1 == n];
    }
  }
  return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 2 1 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: 0
Accepted
time: 22ms
memory: 3812kb

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 2 1 2 2 1 2 1
1 1 2 1 2 1 2 1 1 2
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 2 3 4 5 6 7 8 9 10
1 2 2 3 3 4 1 4 2 3
1 2 1 2 3 3 1 1 2
1 2 1 3 4 1 2 2
1 2 3 4 5 6 7 1 2 2
1 1 2 3 3 4 5 6 5
1 1 1 1 1 1 1 1 1
1 2 3 1 1 2 2 3 1...

result:

ok Correct (18434 test cases)

Test #3:

score: 0
Accepted
time: 21ms
memory: 3860kb

input:

1
199996 3
1 -1 1 1 1 1 -1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 1 1 1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 -1...

output:

1 1 2 3 1 2 2 3 1 3 1 2 2 3 3 1 1 2 2 3 1 2 3 3 1 2 3 1 1 2 3 1 2 3 1 2 2 3 1 3 2 3 1 2 1 2 3 3 1 1 2 2 3 3 1 1 2 3 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 2 1 3 1 2 2 3 1 2 3 1 3 1 2 3 2 3 1 1 2 2 3 3 1 2 3 1 1 2 2 3 1 3 1 2 2 3 3 1 1 2 3 1 2 3 1 2 3 1 2 2 3 1 2 3 1 3 2 1 3 1 2 2 3 1 2 3 3 1 1 2 3 2 3 1 1 2 ...

result:

ok Correct (1 test case)

Test #4:

score: 0
Accepted
time: 14ms
memory: 3796kb

input:

1
199998 152
-1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 1 -1...

output:

1 2 2 3 4 4 5 6 7 8 9 10 10 11 12 12 13 14 15 15 16 17 17 18 19 18 19 20 21 22 20 21 22 23 23 24 24 25 26 25 26 27 28 29 30 31 32 33 33 34 35 34 35 36 37 36 38 37 39 38 40 39 41 40 42 41 43 42 43 44 44 45 46 47 48 45 49 50 51 46 47 52 48 49 53 54 50 51 52 53 55 54 55 56 56 57 58 57 59 60 58 59 61 60...

result:

ok Correct (1 test case)

Test #5:

score: 0
Accepted
time: 18ms
memory: 3848kb

input:

1
199996 136
-1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1...

output:

1 2 3 4 5 6 2 7 3 4 8 5 9 10 6 7 11 12 13 14 15 8 16 9 10 17 11 18 19 12 13 20 14 15 21 16 22 23 24 25 26 27 17 18 19 20 28 21 22 23 24 25 26 27 28 29 30 31 29 32 33 34 30 35 36 37 38 39 31 32 40 33 41 34 35 42 43 44 45 36 46 37 38 39 40 47 48 41 42 43 44 49 45 50 51 52 53 54 46 47 55 56 57 58 59 60...

result:

ok Correct (1 test case)

Test #6:

score: 0
Accepted
time: 15ms
memory: 4332kb

input:

1
199998 86240
1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1...

output:

1 2 1 3 4 5 6 7 8 2 9 10 3 11 4 5 6 12 13 14 15 16 17 18 7 19 20 21 22 23 8 24 9 10 11 12 13 14 15 16 25 17 18 26 19 20 21 22 27 28 23 24 25 29 30 26 27 31 32 28 33 29 34 30 35 31 36 37 38 39 40 32 41 33 42 34 43 35 36 44 45 46 37 38 39 40 41 42 47 48 49 50 43 44 45 51 52 46 47 53 48 54 55 56 49 50 ...

result:

ok Correct (1 test case)

Test #7:

score: 0
Accepted
time: 19ms
memory: 4732kb

input:

1
199998 196586
1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1...

output:

1 1 2 3 4 4 5 5 6 6 7 8 9 9 10 11 12 12 13 14 15 16 17 17 18 19 20 18 19 20 21 21 22 23 24 25 24 26 25 27 26 28 29 30 27 28 29 30 31 31 32 33 34 34 35 36 36 37 38 39 40 41 42 43 39 44 45 40 46 47 48 49 41 42 43 50 51 44 45 52 53 46 47 48 54 49 50 51 55 52 53 54 56 55 56 57 57 58 58 59 60 60 61 61 62...

result:

ok Correct (1 test case)

Test #8:

score: 0
Accepted
time: 15ms
memory: 4184kb

input:

2
53064 32664
1 1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 ...

output:

1 2 3 1 4 5 6 2 7 8 9 3 4 10 5 6 11 12 13 7 8 14 9 15 16 17 10 11 12 18 13 14 15 16 17 19 18 20 19 20 21 21 22 23 24 23 24 25 26 27 28 29 27 30 28 29 30 31 32 33 34 35 32 36 37 33 38 34 39 35 36 40 37 41 38 39 42 40 43 44 41 45 46 42 43 44 47 48 49 50 51 45 52 53 46 54 55 47 48 49 50 56 57 51 52 53 ...

result:

ok Correct (2 test cases)

Test #9:

score: 0
Accepted
time: 22ms
memory: 3744kb

input:

2
86135 2
1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 1...

output:

1 2 1 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 2 1 2 1 2 1 2 1 1 2 2 1 1 2 1 2 1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 2 1 ...

result:

ok Correct (2 test cases)

Test #10:

score: 0
Accepted
time: 18ms
memory: 4208kb

input:

2
114819 248
-1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -...

output:

1 2 3 4 5 6 6 7 7 8 9 9 10 11 10 12 11 12 13 13 14 15 15 16 16 17 17 18 19 20 21 22 23 24 25 25 26 26 27 28 28 29 30 31 32 29 30 31 32 33 34 35 36 37 33 34 38 35 36 37 39 38 39 40 41 41 42 43 44 43 44 45 46 47 46 47 48 49 49 50 50 51 52 53 54 53 54 55 56 57 58 59 57 58 59 60 61 61 62 63 64 65 66 64 ...

result:

ok Correct (2 test cases)

Test #11:

score: 0
Accepted
time: 21ms
memory: 3928kb

input:

2
51745 1
-1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (2 test cases)

Test #12:

score: 0
Accepted
time: 27ms
memory: 3792kb

input:

2
190655 1
1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (2 test cases)

Test #13:

score: 0
Accepted
time: 18ms
memory: 3820kb

input:

3
509 3
-1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -...

output:

1 2 3 1 3 1 2 3 2 3 1 2 2 3 1 2 3 1 2 3 1 3 1 2 3 1 2 2 3 3 1 2 1 3 2 1 3 2 3 1 2 2 3 1 2 3 1 2 3 1 2 3 1 1 2 2 3 1 2 3 3 1 2 3 3 1 2 2 3 3 1 2 2 3 1 3 1 2 3 3 1 2 1 2 3 1 3 1 2 2 3 1 2 3 1 1 2 2 3 1 2 3 1 2 3 3 1 2 3 1 1 2 2 3 3 1 2 1 2 3 1 2 3 3 1 2 1 2 3 3 1 2 1 3 2 1 2 3 1 2 3 1 2 3 1 1 2 3 2 1 ...

result:

ok Correct (3 test cases)

Test #14:

score: 0
Accepted
time: 21ms
memory: 3912kb

input:

4
25729 81
-1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 1 ...

output:

1 2 3 4 5 5 6 7 8 9 10 11 12 13 13 14 14 15 16 17 17 18 19 19 20 21 22 20 21 23 24 22 25 23 24 26 25 26 27 28 28 29 29 30 31 32 33 34 35 36 35 36 37 37 38 39 40 41 42 43 38 44 45 46 39 40 41 47 48 49 50 51 52 53 42 43 44 45 54 46 47 48 49 55 50 56 51 57 58 52 59 53 60 61 54 55 62 63 64 65 66 67 56 5...

result:

ok Correct (4 test cases)

Test #15:

score: 0
Accepted
time: 19ms
memory: 3980kb

input:

5
7824 2
-1 -1 -1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1...

output:

1 2 1 2 1 2 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 1 2 1 2 2 1 2 1 1 2 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 2 1 1 2 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...

result:

ok Correct (5 test cases)

Test #16:

score: 0
Accepted
time: 21ms
memory: 3984kb

input:

6
7149 4795
-1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1...

output:

1 2 3 3 4 5 6 5 7 8 9 10 6 11 7 8 9 10 11 12 13 14 14 15 16 16 17 18 18 19 20 21 22 23 24 25 22 26 23 27 28 29 24 25 30 26 31 32 33 27 34 35 36 37 28 38 29 39 30 40 31 41 42 43 44 45 46 47 48 32 49 33 34 35 36 37 38 39 40 41 50 51 42 52 53 43 44 45 46 54 55 56 47 57 58 48 59 49 60 50 61 62 51 63 52 ...

result:

ok Correct (6 test cases)

Test #17:

score: 0
Accepted
time: 19ms
memory: 3832kb

input:

7
16819 1
1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (7 test cases)

Test #18:

score: 0
Accepted
time: 14ms
memory: 3856kb

input:

8
29021 106
-1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 ...

output:

1 2 3 4 5 5 6 6 7 7 8 9 10 8 9 11 12 13 14 15 10 11 16 17 12 13 14 18 19 15 16 17 18 19 20 21 22 21 23 24 25 22 23 24 26 27 28 29 30 31 32 33 25 34 26 35 27 28 36 29 37 30 38 31 39 40 32 41 42 33 43 34 35 36 44 45 46 47 37 38 39 40 48 41 49 42 43 50 51 44 45 46 52 47 53 54 48 55 56 57 49 58 50 59 60...

result:

ok Correct (8 test cases)

Test #19:

score: 0
Accepted
time: 23ms
memory: 3876kb

input:

9
37136 1
-1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 ...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (9 test cases)

Test #20:

score: 0
Accepted
time: 18ms
memory: 3788kb

input:

10
5543 1596
1 1 1 -1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 ...

output:

1 2 3 1 4 5 6 2 3 4 7 8 5 6 7 9 8 10 9 10 11 11 12 13 14 15 16 17 18 19 18 20 19 20 21 22 23 22 24 23 24 25 26 26 27 28 27 28 29 30 31 32 33 29 30 34 35 31 36 37 32 38 33 39 40 34 35 36 41 37 42 38 39 43 40 41 42 44 43 44 45 45 46 47 47 48 48 49 50 50 51 52 53 54 55 56 57 58 59 56 57 58 59 60 61 62 ...

result:

ok Correct (10 test cases)

Test #21:

score: 0
Accepted
time: 21ms
memory: 3568kb

input:

100
2336 29
-1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 ...

output:

1 2 3 4 4 5 6 5 6 7 8 8 9 10 11 12 13 14 15 10 11 16 17 12 18 13 14 15 19 16 17 20 21 22 23 18 24 25 19 26 20 27 28 29 21 22 23 24 25 1 2 26 3 4 27 28 5 6 29 1 7 8 2 3 9 4 5 6 10 7 8 9 11 12 13 14 15 10 11 16 12 13 14 15 16 17 18 18 19 20 21 22 23 19 24 25 26 20 27 28 29 21 1 22 2 23 3 4 5 6 7 24 8 ...

result:

ok Correct (100 test cases)

Test #22:

score: 0
Accepted
time: 20ms
memory: 3600kb

input:

101
92 1
1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1
2647 2314
-1 1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 2 3 4 5 6 4 7 8 9 10 5 11 6 7 12 8 9 10 13 11 12 13 14 15 14 15 16 16 17 18 19 20 21 22 21 22 23 24 25 26 27 25 ...

result:

ok Correct (101 test cases)

Test #23:

score: 0
Accepted
time: 20ms
memory: 3636kb

input:

102
8381 7064
-1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1...

output:

1 2 3 4 3 4 5 5 6 7 8 9 10 6 7 11 8 12 9 13 14 15 10 11 12 16 13 17 18 19 20 14 15 16 17 21 22 23 18 19 24 25 20 26 21 27 22 23 28 24 25 29 26 30 31 27 28 32 33 34 29 30 31 35 36 37 38 39 40 32 33 41 34 42 35 36 37 38 43 44 39 45 46 40 41 47 42 43 48 44 45 46 49 47 48 50 49 51 52 50 51 53 54 55 56 5...

result:

ok Correct (102 test cases)

Test #24:

score: 0
Accepted
time: 20ms
memory: 3564kb

input:

103
1976 404
1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -...

output:

1 1 2 3 3 4 5 6 7 8 9 7 10 11 8 9 12 10 13 11 14 12 13 15 16 17 18 14 15 19 20 21 16 22 17 18 23 19 24 20 25 21 26 27 28 29 30 31 22 23 32 24 25 33 34 35 36 37 38 26 27 39 40 41 42 28 29 30 43 31 44 32 45 46 47 48 33 49 34 35 36 37 50 38 39 51 40 41 42 52 43 44 45 53 46 54 55 47 56 57 48 58 49 59 50...

result:

ok Correct (103 test cases)

Test #25:

score: 0
Accepted
time: 18ms
memory: 3652kb

input:

104
3135 3
1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 1 -1...

output:

1 1 2 3 1 2 3 1 2 3 1 2 3 2 3 1 2 3 1 2 3 1 2 3 2 1 3 1 2 3 1 2 3 1 3 1 2 3 1 3 1 2 3 2 3 1 2 2 3 1 3 1 2 3 1 1 2 3 1 1 2 2 3 3 1 1 2 3 1 3 1 2 2 3 1 2 3 3 1 2 3 1 2 3 1 1 2 3 2 3 1 2 3 1 2 3 1 2 1 2 3 1 2 3 3 1 2 3 1 1 2 2 3 1 3 1 2 2 3 1 2 3 3 1 2 1 2 3 3 1 2 3 1 1 2 3 2 3 1 2 1 2 3 3 1 2 3 1 1 2 ...

result:

ok Correct (104 test cases)

Test #26:

score: 0
Accepted
time: 20ms
memory: 3632kb

input:

105
1344 10
1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1...

output:

1 2 3 1 4 2 5 3 4 5 6 7 8 9 10 1 2 8 3 4 5 9 6 10 7 8 9 10 1 1 2 3 2 3 4 5 6 4 7 8 5 9 10 1 6 2 7 8 3 9 4 10 1 5 2 6 7 8 9 10 1 2 3 4 4 5 5 6 7 8 8 9 10 10 1 2 3 1 4 2 5 6 7 8 3 9 10 1 4 2 5 6 7 3 8 4 5 9 6 10 7 8 9 1 10 2 1 3 4 2 3 5 6 4 5 7 6 8 9 10 1 7 2 3 4 8 9 10 5 1 2 6 7 3 4 8 5 6 7 8 9 10 9 ...

result:

ok Correct (105 test cases)

Test #27:

score: 0
Accepted
time: 20ms
memory: 3644kb

input:

1000
1284 8
1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 1 1 -1...

output:

1 2 3 4 1 5 2 3 4 5 6 7 6 7 8 1 2 3 8 4 1 5 6 2 7 8 1 2 3 4 3 5 4 6 5 6 7 7 8 8 1 1 2 3 4 2 3 4 5 6 5 6 7 8 1 2 7 8 1 3 2 3 4 5 4 6 7 5 6 7 8 8 1 1 2 3 4 2 5 6 7 3 8 1 4 2 5 3 6 7 8 4 5 1 6 7 8 1 2 2 3 4 3 5 6 7 4 8 5 1 2 3 4 6 7 8 1 5 2 3 6 7 8 1 2 4 5 3 6 7 4 5 6 8 1 2 7 8 3 1 4 5 2 3 6 7 8 4 1 5 ...

result:

ok Correct (1000 test cases)

Test #28:

score: 0
Accepted
time: 21ms
memory: 3572kb

input:

1001
151 3
1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 1 1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1...

output:

1 2 1 3 2 1 3 2 3 1 1 2 3 1 2 3 1 2 2 3 3 1 1 2 2 3 3 1 1 2 3 2 1 2 3 1 3 2 3 1 2 1 2 3 3 1 1 2 2 3 1 2 3 3 1 2 3 1 2 1 2 3 1 2 3 3 1 2 3 1 1 2 2 3 3 1 2 3 1 2 1 2 3 1 2 3 1 2 3 3 1 1 2 3 1 2 3 1 2 2 3 1 2 3 3 1 2 1 3 1 2 3 1 2 3 1 1 2 3 2 1 3 1 2 2 3 3 1 2 3 1 1 2 3 3 1 1 2 3 1 3 1 2 3 3 1 1 2 2 3 ...

result:

ok Correct (1001 test cases)

Test #29:

score: 0
Accepted
time: 17ms
memory: 3576kb

input:

1002
182 6
1 1 1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1...

output:

1 2 3 4 1 2 5 3 4 6 1 5 2 3 6 4 5 6 1 2 1 2 3 4 3 5 4 5 6 6 1 1 2 3 4 2 5 6 3 4 5 6 1 1 2 3 2 3 4 5 6 4 1 5 2 3 4 6 1 2 5 3 4 5 6 6 1 2 3 4 1 5 2 6 3 4 1 2 5 6 1 2 3 3 4 4 5 6 1 5 6 1 2 3 4 5 2 6 3 4 5 1 6 1 2 3 2 3 4 5 6 1 4 2 5 6 1 2 3 3 4 5 4 6 5 6 1 2 1 3 4 5 2 6 1 3 2 3 4 5 5 6 1 1 2 3 4 5 2 3 ...

result:

ok Correct (1002 test cases)

Test #30:

score: 0
Accepted
time: 21ms
memory: 3648kb

input:

1003
95 16
1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1
526 3
1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...

output:

1 1 2 3 4 5 3 4 5 6 7 8 9 10 8 9 10 11 12 13 14 12 15 13 16 1 14 15 16 1 2 2 3 3 4 5 6 6 7 8 8 9 9 10 11 11 12 13 13 14 15 16 1 2 16 3 4 5 1 2 3 4 6 7 5 8 9 10 11 12 6 7 13 14 8 9 10 15 11 12 13 14 15 16 16 1 2 3 4 5 6 3 4 7 8
1 1 2 3 1 3 1 2 3 1 2 3 1 2 3 1 1 2 3 1 2 3 2 3 1 1 2 3 2 1 3 1 2 3 2 3 1...

result:

ok Correct (1003 test cases)

Test #31:

score: 0
Accepted
time: 16ms
memory: 3784kb

input:

1004
322 257
-1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 -1...

output:

1 2 3 4 5 6 7 2 3 8 9 4 5 6 10 7 8 11 9 12 10 11 12 13 14 15 16 17 18 13 19 20 14 21 15 22 16 23 24 17 25 18 26 27 28 19 29 30 20 21 31 22 32 33 23 24 25 34 26 35 27 36 28 37 38 39 29 40 41 42 30 31 43 44 32 33 34 45 46 47 48 49 50 51 35 36 52 53 54 55 56 57 58 59 37 38 39 60 40 61 41 62 63 42 43 44...

result:

ok Correct (1004 test cases)

Test #32:

score: 0
Accepted
time: 21ms
memory: 3644kb

input:

1005
508 4
1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 1 ...

output:

1 1 2 3 4 1 2 3 4 1 2 4 3 4 1 1 2 2 3 3 4 1 4 2 1 2 3 3 4 4 1 2 1 2 3 3 4 4 1 1 2 3 4 2 1 2 3 4 1 2 3 3 4 4 1 1 2 3 2 3 4 1 4 1 2 2 3 3 4 4 1 1 2 2 3 4 3 4 1 1 2 3 4 2 3 1 2 3 4 4 1 1 2 2 3 3 4 4 1 2 1 2 3 4 3 1 2 3 4 1 2 4 1 3 4 1 2 3 2 4 1 2 3 4 3 1 2 3 4 1 4 2 3 4 1 2 1 3 4 1 2 2 3 4 3 1 2 3 4 1 ...

result:

ok Correct (1005 test cases)

Test #33:

score: 0
Accepted
time: 20ms
memory: 3608kb

input:

9995
9 7
-1 1 -1 -1 -1 1 -1 -1 1
1 1
-1
7 1
-1 -1 -1 -1 1 -1 -1
25 1
1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1
24 22
1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 1 -1 1 -1 -1 1 -1 -1
6 3
1 -1 1 1 -1 -1
6 4
-1 1 -1 -1 -1 1
14 9
-1 -1 1 -1 1 -1 1 1 1 1 1 1 1 -1
24 3
1 -1 -1 -1 1 1 -1 1 1 1 ...

output:

1 2 2 3 4 5 5 6 7
1
1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 2 2 3 3 4 5 6 4 7 8 9 10 5 11 12 6 13 7 8 14 9 10
1 1 2 3 2 3
1 2 2 3 4 1
1 2 3 3 4 4 5 6 7 8 9 1 2 5
1 1 2 3 1 2 1 3 1 2 3 1 2 2 3 1 3 1 2 3 1 2 2 3
1 2 3 4 4 5 6 6 7 7 8 1 8 2 3 1 4 2 5 3 6 7 4 8 1 5 2 6 7 8 1 ...

result:

ok Correct (9995 test cases)

Test #34:

score: 0
Accepted
time: 24ms
memory: 3828kb

input:

9996
27 1
1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1
7 2
1 1 1 1 -1 -1 1
22 3
-1 -1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1
37 4
-1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1
7 1
-1 1 -1 -1 1 1 1
29 1
-1 -1 1 -1 1 -1 1...

output:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 1 2 1 2 1
1 2 3 1 3 1 2 3 1 2 3 1 2 3 1 2 2 3 1 3 1 2
1 2 3 4 4 1 1 2 3 4 1 4 2 3 1 4 2 1 3 2 4 3 1 4 2 1 3 2 3 4 1 2 3 4 4 1 2
1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 2 3 4 5 6 7 8 2 3 4 5 6 9
1 2 1 3 1 2 2 ...

result:

ok Correct (9996 test cases)

Test #35:

score: 0
Accepted
time: 24ms
memory: 3612kb

input:

9997
15 9
-1 1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1
1 1
1
37 20
-1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1
64 2
-1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -...

output:

1 2 3 2 4 5 3 6 4 7 8 9 1 2 3
1
1 2 2 3 4 4 5 6 6 7 8 9 9 10 11 10 12 13 11 12 13 14 15 16 15 17 16 17 18 19 19 20 1 2 3 4 20
1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 1 2 1 2 2 1 1 2 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 2 1 1 2 2 1
1 2 1 2 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 2 1 1 2 ...

result:

ok Correct (9997 test cases)

Test #36:

score: 0
Accepted
time: 24ms
memory: 3628kb

input:

9998
28 3
-1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 1 1
12 2
-1 -1 -1 1 -1 -1 1 -1 1 1 -1 1
8 6
-1 1 1 -1 1 1 1 1
3 1
1 1 -1
12 1
1 -1 1 1 1 -1 1 -1 -1 1 1 -1
3 1
1 -1 -1
77 3
-1 -1 1 1 1 -1 1 -1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 1 -...

output:

1 2 3 2 3 1 2 3 1 2 3 1 2 1 3 2 1 2 3 1 2 3 1 2 3 1 2 3
1 2 1 2 2 1 2 2 1 2 1 1
1 2 3 2 4 5 6 1
1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1
1 2 3 1 2 3 3 1 1 2 3 1 2 3 1 2 3 1 2 2 3 3 1 2 1 2 3 3 1 1 2 2 3 1 2 3 3 1 1 2 3 1 2 2 3 3 1 1 2 3 1 2 3 1 2 3 1 2 3 3 1 1 2 3 1 2 3 2 3 1 2 3 1 1 2 2 3
1 1
1 2 3 3 1 ...

result:

ok Correct (9998 test cases)

Test #37:

score: 0
Accepted
time: 20ms
memory: 3548kb

input:

9999
65 2
-1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1 1 1 1 1 1 1
12 3
1 1 1 1 -1 -1 -1 -1 1 1 -1 -1
75 2
1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1...

output:

1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 1 2 2 1 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1
1 2 3 1 1 2 3 1 2 3 2 3
1 1 2 2 1 2 1 2 1 1 2 2 1 2 1 2 1 2 2 1 1 2 1 2 2 1 2 1 1 2 1 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 1 ...

result:

ok Correct (9999 test cases)

Test #38:

score: 0
Accepted
time: 21ms
memory: 3616kb

input:

10000
15 3
-1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1
3 3
-1 1 1
34 2
-1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1
3 2
1 1 -1
25 2
-1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1
11 1
1 -1 -1 -1 -1 -1 1 -1 -1 -1 1
29 2
-1 -1 -1 1 -1 1 -1 -1 -1 -1...

output:

1 2 2 3 3 1 2 2 3 3 1 1 2 3 1
1 2 3
1 2 1 2 1 1 2 2 1 2 1 2 2 1 2 1 1 2 1 1 2 2 1 2 2 1 2 1 2 1 2 2 1 2
1 2 1
1 2 1 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2 1 2 1 1 2 2 1
1 1 1 1 1 1 1 1 1 1 1
1 2 1 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 1 1 2
1 1 2 3
1 1 1
1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

ok Correct (10000 test cases)

Extra Test:

score: 0
Extra Test Passed