QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209876#5409. PerotationScintilla30 1ms6100kbC++203.6kb2023-10-10 18:43:572023-10-10 18:43:58

Judging History

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

  • [2023-10-10 18:43:58]
  • 评测
  • 测评结果:30
  • 用时:1ms
  • 内存:6100kb
  • [2023-10-10 18:43:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define drep(i, s, e) for (int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)
#define pv(a) cout << #a << " = " << a << endl
#define pa(a, l, r) cout << #a " : "; rep(_, l, r) cout << a[_] << ' '; cout << endl

const int N = 1e5 + 10;
const int M = 333;

int read() {
  int x = 0, f = 1; char c = getchar();
  for (; c < '0' || c > '9'; c = getchar()) if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
  return x * f;
}

int n, m, cnt, B;
int a[N], pos[N], bit[N], id[N], L[M], R[M];
int v[N], b[M][M], d[M][M], c[M];

void upd(int x) {
  for (; x <= n; x += x & -x) bit[x] ^= 1;
}

int qry(int x) {
  int res = 0;
  for (; x; x -= x & -x) res ^= bit[x];
  return res;
}

void psdw(int o) {
  int len = R[o] - L[o] + 1;
  for (int i = 1; i <= len; i++) 
    v[pos[b[o][i]]] = (v[pos[b[o][i-1]]] ^ d[o][i]);
}

void psup(int o) {
  int len = R[o] - L[o] + 1;
  c[o] = 0;
  for (int i = 1; i <= len; i++) 
    c[o] += (d[o][i] = (v[pos[b[o][i]]] ^ v[pos[b[o][i-1]]]));
}

void build() {
  for (int i = 1; i <= n; i++) {
    id[i] = (i - 1) / B + 1;
    if (i == 1 || id[i] != id[i-1]) L[id[i]] = i, cnt++;
    R[id[i]] = max(R[id[i]], i);
  }
  for (int o = 1; o <= cnt; o++) {
    int len = R[o] - L[o] + 1;
    for (int i = 1; i <= len; i++) b[o][i] = a[L[o]+i-1];
    sort(b[o] + 1, b[o] + 1 + len), psup(o);
  }
}

int cg(int o, int x) {
  int len = R[o] - L[o] + 1;
  int p = lower_bound(b[o] + 1, b[o] + 1 + len, x) - b[o];
  int res = ((p - 1) & 1);
  if (p <= len) c[o] -= d[o][p], c[o] += (d[o][p] ^= 1);
  return res;
}

void mdf(int o, int x, int y) {
  int len = R[o] - L[o] + 1, p;
  for (p = 1; p <= len; p++) if (b[o][p] == x) break;
  for (int i = p; i < len; i++) b[o][i] = b[o][i+1];
  for (p = 1; p < len; p++) if (b[o][p] > y) break;
  for (int i = len; i > p; i--) b[o][i] = b[o][i-1];
  b[o][p] = y;
}

void work(int x, int y) {
  if (id[x] == id[y]) {
    psdw(id[x]);
    for (int i = x + 1; i < y; i++) v[i] ^= ((a[i] > a[y]) ^ (a[i] > a[x]));
    for (int i = x; i < y; i++) if (a[y] > a[i]) v[y] ^= 1;
    for (int i = y; i > x; i--) if (a[x] > a[i]) v[x] ^= 1; 
    swap(a[x], a[y]), swap(pos[a[x]], pos[a[y]]), swap(v[x], v[y]);
    return psup(id[x]);
  }
  psdw(id[x]), psdw(id[y]);
  for (int i = x + 1; id[i] == id[x]; i++) v[i] ^= ((a[i] > a[y]) ^ (a[i] > a[x]));
  for (int i = y - 1; id[i] == id[y]; i--) v[i] ^= ((a[i] > a[y]) ^ (a[i] > a[x]));
  for (int i = x; id[i] == id[x]; i++) if (a[y] > a[i]) v[y] ^= 1;
  for (int i = y - 1; id[i] == id[y]; i--) if (a[y] > a[i]) v[y] ^= 1;
  for (int i = x + 1; id[i] == id[x]; i++) if (a[x] > a[i]) v[x] ^= 1;
  for (int i = y; id[i] == id[y]; i--) if (a[x] > a[i]) v[x] ^= 1;
  for (int i = id[x] + 1; i < id[y]; i++) v[x] ^= cg(i, a[x]), v[y] ^= cg(i, a[y]);
  mdf(id[x], a[x], a[y]), mdf(id[y], a[y], a[x]);
  swap(a[x], a[y]), swap(pos[a[x]], pos[a[y]]), swap(v[x], v[y]);
  psup(id[x]), psup(id[y]);
}

int calc() {
  int p = cnt;
  while (p >= 1 && !c[p]) p--;
  if (!p) return 1;
  psdw(p);
  int x = R[p];
  while (x >= L[p] && !v[x]) x--;
  psup(p);
  return x + 1;
}

int main() {
  n = read(), m = read(), B = min(n, int(sqrt(n) / __lg(n + 1) + 1));
  rep(i, 1, n) a[i] = read(), pos[a[i]] = i;
  drep(i, n, 1) v[i] = qry(a[i]), upd(a[i]);
  build();
  rep(i, 1, m) {
    int x = read(), y = read();
    if (x > y) swap(x, y);
    work(x, y);
    printf("%d\n", calc());
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3892kb

input:

2 1
1 2
2 1

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

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

output:

7
7
7
7
7
7
7

result:

ok 7 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 5872kb

input:

7 7
6 7 2 1 5 3 4
3 1
3 1
7 5
1 6
6 5
6 1
1 7

output:

3
4
6
7
4
4
4

result:

ok 7 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

7 7
2 4 3 1 5 6 7
7 6
6 3
3 1
1 4
3 4
2 5
4 1

output:

7
6
6
6
6
6
6

result:

ok 7 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

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

output:

1
3
4
6
6
6

result:

ok 6 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 3964kb

input:

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

output:

4
8
10
10
10
8
6
8
8

result:

ok 9 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

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

output:

8
8
8
8
8
8
8
8

result:

ok 8 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 3972kb

input:

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

output:

8
8
8
8
8
8
8
8

result:

ok 8 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

6 8
6 1 2 5 3 4
6 1
4 5
2 5
5 3
4 6
4 1
2 4
4 2

output:

5
2
5
5
3
2
3
2

result:

ok 8 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 3916kb

input:

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

output:

10
10
10
10
10
10
10

result:

ok 7 numbers

Test #11:

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

input:

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

output:

8
8
8
8
8
8
8

result:

ok 7 numbers

Subtask #2:

score: 20
Accepted

Dependency #1:

100%
Accepted

Test #12:

score: 20
Accepted
time: 1ms
memory: 5960kb

input:

90 83
53 72 1 6 48 45 55 24 20 78 36 82 67 35 63 7 61 69 90 52 21 80 65 32 71 81 38 43 34 64 60 40 4 49 28 89 56 77 51 46 2 18 5 62 19 57 3 88 39 85 86 23 75 10 83 27 22 68 9 37 76 50 87 79 16 11 25 26 14 8 74 41 66 58 84 12 54 17 33 42 15 44 13 73 30 29 70 59 47 31
76 86
30 50
85 3
23 51
42 59
37 8...

output:

90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
90
89
89
89
89
89
89
89
89
89
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88

result:

ok 83 numbers

Test #13:

score: 0
Accepted
time: 0ms
memory: 5956kb

input:

87 95
69 48 22 37 65 67 72 78 59 85 74 26 25 28 53 51 23 56 50 52 81 76 57 30 10 49 21 87 34 16 15 80 43 47 2 20 86 13 29 36 58 71 83 35 40 46 38 54 14 18 84 39 27 3 61 77 64 8 6 68 11 31 7 73 1 9 4 79 55 63 82 75 33 32 24 5 19 45 41 60 44 66 70 17 42 62 12
53 8
8 34
49 54
16 33
64 78
11 2
73 85
51 ...

output:

87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
85
85
85
85
85
85
85
85
85
85
83
83
83
83
83
83
83
83
83
83
83
83
85
85
85
85
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87
87

result:

ok 95 numbers

Test #14:

score: 0
Accepted
time: 1ms
memory: 5976kb

input:

87 90
19 70 69 56 20 16 66 9 21 47 81 5 50 7 24 85 1 80 4 73 37 52 12 75 64 3 57 71 77 28 40 17 82 65 45 22 6 79 87 63 27 39 42 83 38 11 14 41 31 74 15 60 62 86 34 23 49 33 68 51 61 32 67 59 35 58 30 29 36 25 48 84 13 54 10 53 46 78 76 26 43 72 2 8 18 44 55
58 62
14 17
36 78
11 20
35 15
85 21
74 64
...

output:

83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
83
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
86
84
84
84
84
84
84
84
84
84
84
84
84
84
84
86
86
86
86
86
86

result:

ok 90 numbers

Test #15:

score: 0
Accepted
time: 0ms
memory: 4084kb

input:

91 71
40 81 83 16 76 5 85 64 84 82 63 42 32 71 73 3 51 11 30 65 17 20 56 31 4 54 49 38 52 86 34 48 80 6 26 87 8 25 36 23 2 7 70 62 67 88 72 47 55 77 29 66 68 69 91 37 79 22 44 61 45 41 74 89 28 15 13 39 75 14 46 21 33 35 43 18 58 53 90 57 19 10 12 50 59 60 1 9 24 27 78
44 18
42 5
41 26
41 29
40 1
38...

output:

45
45
45
45
45
45
45
45
45
45
45
45
45
73
74
73
72
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80
80

result:

ok 71 numbers

Test #16:

score: 0
Accepted
time: 0ms
memory: 4000kb

input:

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

output:

40
40
40
40
40
40
47
55
55
55
55
55
55
55
55
55
72
72
72
72
72
72
72
72
72
72
72
72
72
72
72
72
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
70
72
72
70

result:

ok 66 numbers

Test #17:

score: 0
Accepted
time: 1ms
memory: 6056kb

input:

100 100
15 10 37 71 30 22 78 12 33 13 29 26 27 11 3 24 42 18 21 28 73 23 53 57 91 32 20 6 4 5 82 16 95 80 14 17 76 25 9 8 31 7 99 19 96 49 59 2 65 93 70 58 60 43 44 50 74 92 35 86 98 84 90 52 67 72 83 62 56 100 46 89 69 36 45 38 77 61 81 63 41 55 87 79 39 88 54 85 64 75 48 97 68 94 40 66 1 51 34 47
...

output:

68
64
68
68
68
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
85
90
90
90
90
90
90
90
90
90
90
90
90

result:

ok 100 numbers

Test #18:

score: 0
Accepted
time: 1ms
memory: 6100kb

input:

94 100
85 86 55 56 3 4 67 68 61 62 77 78 65 66 89 90 73 74 45 46 11 12 49 50 37 38 51 52 43 44 83 84 41 42 31 32 5 6 25 26 7 8 79 80 1 2 47 48 91 92 35 36 23 24 29 30 93 94 17 18 15 16 71 72 53 54 27 28 21 22 75 76 19 20 63 64 57 58 39 40 59 60 69 70 33 34 13 14 81 82 87 88 9 10
56 78
86 68
55 77
85...

output:

78
86
86
1
23
31
23
1
18
1
53
1
90
1
91
1
29
1
55
77
77
77
18
1
85
85
85
1
26
1
54
87
87
1
66
1
73
1
50
82
82
1
80
84
80
1
78
88
94
88
78
1
91
1
79
79
79
1
49
1
65
1
44
1
27
77
27
1
60
60
47
1
92
1
75
1
74
1
57
94
94
87
57
1
68
68
81
81
81
1
47
53
53
1
34
1
33
65
33
1

result:

ok 100 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 6040kb

input:

100 100
43 44 77 78 75 76 99 100 1 2 5 6 19 20 89 90 47 48 41 42 65 66 67 68 25 26 91 92 95 96 71 72 97 98 49 50 23 24 17 18 81 82 55 56 45 46 27 28 21 22 29 30 15 16 51 52 11 12 31 32 61 62 87 88 57 58 35 36 73 74 9 10 59 60 7 8 85 86 83 84 33 34 39 40 53 54 37 38 69 70 13 14 93 94 79 80 63 64 3 4
...

output:

96
96
96
1
36
1
56
1
88
1
81
1
68
1
37
1
90
1
28
1
98
98
98
1
55
86
86
1
93
1
84
84
69
69
65
1
99
1
55
1
61
61
42
1
88
1
30
1
38
1
49
49
44
1
96
96
85
85
85
1
50
1
60
60
60
1
45
45
26
1
27
1
42
78
78
1
53
53
100
100
100
1
94
94
64
88
88
1
87
96
96
1
98
98
98
97
97
1
83
1

result:

ok 100 numbers

Test #20:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

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

output:

13
1
63
63
63
78
63
68
68
1
33
23
33
1
48
1
63
1
33
1
60
1
40
51
80
80
80
1
75
61
74
1
58
1
72
1
31
51
31
1
62
1
39
73
73
79
79
1
67
1
74
75
74
74
74
76
76
1
39
1
4
1
82
82
76
76
76
1
22
23
23
1
78
1
52
1
47
57
57
1
75
1
59

result:

ok 83 numbers

Test #21:

score: 0
Accepted
time: 1ms
memory: 6012kb

input:

100 100
79 80 63 64 23 24 41 42 87 88 33 34 99 100 65 66 73 74 11 12 69 70 71 72 19 20 59 60 75 76 35 36 15 16 3 4 67 68 17 18 93 94 39 40 9 10 81 82 13 14 89 90 49 50 31 32 43 44 97 98 95 96 77 78 57 58 55 56 29 30 51 52 61 62 27 28 53 54 47 48 25 26 91 92 5 6 83 84 7 8 37 38 45 46 1 2 21 22 85 86
...

output:

75
1
33
1
59
1
80
98
98
98
98
98
17
1
80
80
80
80
80
80
80
89
89
1
75
75
75
54
74
74
54
1
48
1
87
87
84
88
88
1
62
1
61
1
95
1
86
86
86
86
30
1
47
1
86
86
39
1
83
1
10
1
90
90
90
1
26
1
41
66
66
1
67
1
94
1
46
1
71
71
70
1
82
1
96
96
96
1
14
68
68
68
40
1
79
79
79
1
48
1

result:

ok 100 numbers

Test #22:

score: 0
Accepted
time: 0ms
memory: 4008kb

input:

95 82
65 66 53 54 1 2 83 84 19 20 43 44 89 90 5 6 11 12 67 68 55 56 87 88 77 78 17 18 7 8 49 50 9 10 57 58 79 80 71 72 23 24 81 82 93 94 3 4 39 40 13 14 21 22 59 60 25 26 91 92 63 64 15 16 69 70 47 48 61 62 41 42 33 34 31 32 27 28 35 36 45 46 73 74 37 38 29 30 51 52 85 86 75 76 95
74 62
73 61
8 50
7...

output:

73
1
45
1
72
1
11
92
92
92
92
87
87
87
87
87
87
87
87
87
27
1
88
1
82
82
82
82
82
69
84
84
84
84
84
68
68
1
78
78
78
92
92
92
92
92
92
92
92
92
81
81
68
1
43
43
43
1
77
77
39
1
71
71
71
71
60
60
94
60
60
1
73
1
33
52
52
46
33
1
70
1

result:

ok 82 numbers

Test #23:

score: 0
Accepted
time: 1ms
memory: 5944kb

input:

100 100
55 56 49 50 81 82 37 38 51 52 35 36 89 90 57 58 7 8 27 28 99 100 65 66 5 6 87 88 83 84 53 54 91 92 77 78 13 14 29 30 41 42 9 10 45 46 63 64 93 94 59 60 23 24 1 2 3 4 97 98 69 70 85 86 21 22 25 26 31 32 11 12 39 40 95 96 19 20 73 74 79 80 47 48 71 72 43 44 15 16 67 68 61 62 75 76 17 18 33 34
...

output:

47
55
69
55
55
64
64
64
64
64
84
84
84
84
84
1
96
96
96
96
72
1
31
89
91
91
31
38
38
55
38
94
38
1
26
26
96
96
96
96
96
96
96
96
96
96
90
90
90
1
65
92
92
92
92
92
92
92
92
92
92
92
27
1
68
68
57
66
73
73
57
57
62
62
62
62
62
89
89
97
97
1
78
1
57
91
91
59
91
91
82
1
86
1
69
1
75
1
46
1

result:

ok 100 numbers

Test #24:

score: 0
Accepted
time: 1ms
memory: 6044kb

input:

100 100
53 54 83 84 29 30 95 96 11 12 45 46 91 92 17 18 5 6 39 40 87 88 57 58 93 94 81 82 67 68 85 86 59 60 73 74 71 72 99 100 19 20 31 32 65 66 23 24 43 44 25 26 1 2 9 10 61 62 7 8 35 36 89 90 69 70 37 38 51 52 79 80 63 64 55 56 47 48 3 4 13 14 49 50 97 98 27 28 41 42 33 34 21 22 75 76 15 16 77 78
...

output:

97
1
39
1
80
1
27
1
25
1
7
1
79
1
60
1
63
1
84
1
60
1
27
1
78
1
33
1
44
1
41
1
90
1
69
1
94
1
99
1
92
1
59
1
59
1
87
1
83
1
63
1
82
1
94
1
25
1
91
1
83
1
50
1
77
1
71
1
46
1
89
1
18
1
36
1
51
1
14
1
48
1
76
1
7
1
42
1
57
1
17
1
68
1
98
1
52
1
49
1

result:

ok 100 numbers

Test #25:

score: 0
Accepted
time: 0ms
memory: 4036kb

input:

100 100
3 4 63 64 21 22 49 50 35 36 99 100 65 66 85 86 25 26 17 18 23 24 69 70 33 34 13 14 41 42 81 82 11 12 67 68 57 58 29 30 15 16 1 2 55 56 31 32 83 84 37 38 91 92 45 46 43 44 79 80 93 94 9 10 73 74 95 96 61 62 39 40 7 8 53 54 87 88 5 6 59 60 47 48 75 76 89 90 27 28 19 20 71 72 97 98 51 52 77 78
...

output:

7
7
7
7
7
7
10
10
10
10
46
46
99
46
89
46
77
46
100
46
92
46
82
46
46
46
59
66
99
66
100
66
66
66
83
66
66
66
65
66
95
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
99
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
100
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96
96

result:

ok 100 numbers

Test #26:

score: 0
Accepted
time: 1ms
memory: 6040kb

input:

100 100
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
...

output:

100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1
100
1

result:

ok 100 numbers

Subtask #3:

score: 0
Runtime Error

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #27:

score: 0
Runtime Error

input:

3695 3785
270 3225 1936 1747 2487 1557 2343 3313 2544 1941 1095 1919 3206 901 327 3076 557 29 112 2617 201 53 2643 678 1666 680 1523 3380 1353 2059 2566 1743 523 1131 168 509 2138 3577 109 2930 1114 3563 3395 2075 2271 1228 3462 1952 1535 1087 2548 653 2713 1749 336 1658 2470 466 958 639 3184 2451 1...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%