QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244806#7213. Similar Subsequenceucup-team004AC ✓117ms5252kbC++201.6kb2023-11-09 16:06:442023-11-09 16:07:26

Judging History

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

  • [2023-11-09 16:07:26]
  • 评测
  • 测评结果:AC
  • 用时:117ms
  • 内存:5252kb
  • [2023-11-09 16:06:44]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

void chmin(int &a, int b) {
    if (b < a) {
        a = b;
    }
}

void chmax(int &a, int b) {
    if (b > a) {
        a = b;
    }
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n, m;
    std::cin >> n >> m;
    
    std::vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        std::cin >> b[i];
    }
    
    std::vector f(n, std::vector(m, m + 1)), g(n, std::vector(m, 0));
    for (int i = 0; i < m; i++) {
        f[n - 1][i] = b[i];
        g[n - 1][i] = b[i];
    }
    
    for (int i = n - 1; i > 0; i--) {
        for (int j = m - 1; j >= 0; j--) {
            for (int k = j - 1; k >= 0; k--) {
                if (a[i - 1] < a[i]) {
                    if (b[k] < b[j]) {
                        chmin(f[i - 1][k], f[i][j]);
                    }
                    if (b[k] < g[i][j]) {
                        chmin(f[i - 1][k], b[j]);
                    }
                } else {
                    if (b[k] > b[j]) {
                        chmax(g[i - 1][k], g[i][j]);
                    }
                    if (b[k] > f[i][j]) {
                        chmax(g[i - 1][k], b[j]);
                    }
                }
            }
        }
    }
    
    for (int i = 0; i < m; i++) {
        if (f[0][i] <= m || g[0][i] > 0) {
            std::cout << "Yes\n";
            return 0;
        }
    }
    std::cout << "No\n";
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 4
1 2 3
1 3 2 4

output:

Yes

result:

ok answer is YES

Test #2:

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

input:

3 4
1 2 3
4 4 4 4

output:

No

result:

ok answer is NO

Test #3:

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

input:

1 1
1
1

output:

Yes

result:

ok answer is YES

Test #4:

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

input:

3 5
3 1 2
5 3 4 3 3

output:

Yes

result:

ok answer is YES

Test #5:

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

input:

4 5
4 3 1 2
5 4 1 2 5

output:

Yes

result:

ok answer is YES

Test #6:

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

input:

3 5
3 1 2
3 2 2 3 4

output:

No

result:

ok answer is NO

Test #7:

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

input:

2 5
1 2
4 2 2 5 4

output:

Yes

result:

ok answer is YES

Test #8:

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

input:

1 5
1
5 4 2 1 5

output:

Yes

result:

ok answer is YES

Test #9:

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

input:

2 5
1 2
2 1 1 4 1

output:

Yes

result:

ok answer is YES

Test #10:

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

input:

2 5
1 2
2 4 5 3 2

output:

Yes

result:

ok answer is YES

Test #11:

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

input:

1 5
1
5 4 2 1 5

output:

Yes

result:

ok answer is YES

Test #12:

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

input:

1 5
1
3 2 5 5 1

output:

Yes

result:

ok answer is YES

Test #13:

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

input:

1 5
1
4 1 2 1 3

output:

Yes

result:

ok answer is YES

Test #14:

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

input:

1 5
1
4 3 4 3 3

output:

Yes

result:

ok answer is YES

Test #15:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #16:

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

input:

1 5
1
2 2 2 2 2

output:

Yes

result:

ok answer is YES

Test #17:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #18:

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

input:

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

output:

No

result:

ok answer is NO

Test #19:

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

input:

4 5
4 1 3 2
5 5 1 4 3

output:

Yes

result:

ok answer is YES

Test #20:

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

input:

2 5
1 2
2 3 5 3 1

output:

Yes

result:

ok answer is YES

Test #21:

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

input:

4 5
4 3 2 1
4 5 3 2 1

output:

Yes

result:

ok answer is YES

Test #22:

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

input:

1 5
1
4 5 3 1 1

output:

Yes

result:

ok answer is YES

Test #23:

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

input:

2 5
1 2
2 3 1 2 3

output:

Yes

result:

ok answer is YES

Test #24:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #25:

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

input:

1 10
1
2 1 4 7 10 2 6 2 1 4

output:

Yes

result:

ok answer is YES

Test #26:

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

input:

2 10
2 1
6 3 10 6 10 9 4 1 2 4

output:

Yes

result:

ok answer is YES

Test #27:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #28:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #29:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #30:

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

input:

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

output:

No

result:

ok answer is NO

Test #31:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #32:

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

input:

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

output:

No

result:

ok answer is NO

Test #33:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #34:

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

input:

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

output:

No

result:

ok answer is NO

Test #35:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #36:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #37:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #38:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #39:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #40:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #41:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #42:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #43:

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

input:

1 10
1
10 5 3 7 6 1 10 6 6 6

output:

Yes

result:

ok answer is YES

Test #44:

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

input:

3 20
3 1 2
17 13 20 5 7 3 10 15 10 16 16 13 5 8 10 19 18 15 6 5

output:

Yes

result:

ok answer is YES

Test #45:

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

input:

6 20
6 5 4 3 1 2
7 13 6 20 16 19 14 7 15 9 8 9 8 17 7 4 7 9 17 6

output:

Yes

result:

ok answer is YES

Test #46:

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

input:

1 20
1
1 17 5 20 4 6 18 10 15 18 11 10 10 6 8 5 20 10 2 7

output:

Yes

result:

ok answer is YES

Test #47:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #48:

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

input:

5 20
5 1 4 3 2
19 19 8 17 19 1 12 19 15 14 8 6 18 6 3 19 10 20 17 19

output:

Yes

result:

ok answer is YES

Test #49:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #50:

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

input:

2 20
2 1
15 3 9 2 5 6 8 3 20 14 13 9 2 20 11 12 1 7 7 1

output:

Yes

result:

ok answer is YES

Test #51:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #52:

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

input:

4 20
1 4 3 2
8 18 6 16 11 15 3 19 19 14 18 3 5 18 1 12 3 9 11 4

output:

Yes

result:

ok answer is YES

Test #53:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #54:

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

input:

5 20
1 2 5 4 3
1 7 7 2 20 10 4 12 8 11 15 10 8 13 20 19 1 14 6 20

output:

Yes

result:

ok answer is YES

Test #55:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #56:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #57:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #58:

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

input:

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

output:

No

result:

ok answer is NO

Test #59:

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

input:

4 20
4 1 2 3
18 3 13 4 18 19 3 11 3 13 9 7 2 2 18 6 16 12 15 3

output:

Yes

result:

ok answer is YES

Test #60:

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

input:

2 20
2 1
7 6 7 19 15 2 7 8 15 15 1 13 20 14 13 18 3 17 19 4

output:

Yes

result:

ok answer is YES

Test #61:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #62:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #63:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #64:

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

input:

11 50
1 11 2 3 4 10 5 9 8 6 7
10 7 43 37 43 36 4 10 23 27 42 30 46 37 30 5 40 38 30 27 21 49 27 10 20 7 23 17 49 12 41 10 30 8 4 33 9 13 40 9 48 41 3 22 22 23 41 30 24 33

output:

No

result:

ok answer is NO

Test #65:

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

input:

8 50
1 8 2 3 4 5 7 6
44 43 31 23 1 45 6 20 28 50 1 20 36 45 36 7 4 46 21 19 10 34 15 27 5 5 13 13 26 2 24 3 37 8 13 17 34 40 24 36 23 50 43 42 5 7 41 2 15 3

output:

Yes

result:

ok answer is YES

Test #66:

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

input:

2 50
1 2
2 48 4 50 20 34 17 46 13 19 5 3 31 45 33 44 2 34 35 20 7 2 10 2 1 13 27 5 26 40 50 32 45 47 3 29 24 45 49 35 5 1 17 25 42 50 40 25 28 43

output:

Yes

result:

ok answer is YES

Test #67:

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

input:

2 50
1 2
10 40 32 3 29 32 49 46 40 20 32 26 21 5 5 41 46 30 31 5 19 13 29 1 30 43 37 27 28 11 36 37 48 44 45 33 17 31 22 11 49 35 38 10 29 25 4 44 35 34

output:

Yes

result:

ok answer is YES

Test #68:

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

input:

14 50
1 14 2 3 13 4 12 5 11 10 9 8 7 6
33 39 35 34 43 48 1 1 35 4 28 11 6 35 21 23 37 4 44 29 23 37 49 50 39 42 40 33 35 22 21 4 47 41 13 21 47 35 7 35 23 40 18 36 44 31 23 29 6 10

output:

No

result:

ok answer is NO

Test #69:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #70:

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

input:

11 50
1 2 11 3 4 10 5 6 7 9 8
25 4 30 40 40 32 16 43 12 13 25 8 9 9 28 2 8 10 41 44 23 37 33 9 14 46 9 11 34 36 30 26 43 30 25 6 16 35 10 12 38 20 7 43 44 5 38 1 14 20

output:

No

result:

ok answer is NO

Test #71:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #72:

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

input:

38 50
38 1 37 36 35 34 33 2 32 31 30 29 28 27 26 25 3 24 4 5 6 7 23 8 9 22 10 21 20 19 11 18 17 16 15 12 14 13
18 27 31 20 17 14 30 41 11 8 12 3 35 34 24 21 16 7 1 35 8 43 21 48 5 43 48 49 27 40 2 3 26 48 5 17 13 4 38 27 38 35 31 33 35 48 36 13 34 29

output:

No

result:

ok answer is NO

Test #73:

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

input:

31 50
31 1 2 30 3 4 29 28 27 26 25 24 5 23 22 21 6 20 19 7 18 17 8 9 10 16 11 12 13 14 15
50 1 2 49 27 3 4 45 43 4 39 38 7 1 7 35 23 16 49 32 2 33 5 32 29 28 7 33 6 41 27 16 26 7 25 8 24 8 9 4 10 23 12 15 16 16 38 8 19 22

output:

Yes

result:

ok answer is YES

Test #74:

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

input:

22 50
22 21 1 2 20 3 19 4 5 6 7 8 9 10 18 17 16 15 14 11 12 13
13 13 4 5 49 2 35 26 4 15 36 27 30 31 42 36 33 24 22 18 4 39 39 20 20 37 31 42 50 37 36 48 48 11 46 37 11 26 18 7 35 12 40 1 45 3 43 37 1 32

output:

No

result:

ok answer is NO

Test #75:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #76:

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

input:

3 50
3 2 1
3 33 50 23 48 6 13 24 33 9 9 38 29 35 36 26 1 3 12 33 19 30 27 45 29 29 43 3 33 25 32 8 12 39 49 44 20 18 16 49 10 40 41 25 28 3 39 27 33 36

output:

Yes

result:

ok answer is YES

Test #77:

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

input:

28 50
1 28 27 2 3 4 5 6 7 8 9 26 10 25 11 24 12 23 13 14 15 22 16 21 17 20 18 19
1 50 29 23 26 34 49 2 3 2 5 7 34 37 10 38 16 7 37 4 14 35 17 18 46 19 25 9 45 20 43 9 23 41 25 50 27 29 33 39 30 38 6 46 32 28 50 36 34 35

output:

Yes

result:

ok answer is YES

Test #78:

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

input:

3 50
3 2 1
46 4 44 18 8 13 19 23 34 7 15 45 19 40 26 25 28 23 48 14 25 3 32 46 9 22 15 14 14 18 32 43 47 39 17 13 9 9 10 40 39 2 12 34 19 22 27 38 36 44

output:

Yes

result:

ok answer is YES

Test #79:

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

input:

23 50
1 23 22 21 20 2 19 3 4 5 6 18 17 7 8 9 10 16 11 15 14 13 12
27 1 40 50 12 49 3 48 47 47 36 2 43 3 8 27 33 9 10 14 42 30 40 23 15 5 10 13 16 11 6 22 23 42 40 33 24 33 32 20 19 48 27 41 8 30 2 31 26 25

output:

Yes

result:

ok answer is YES

Test #80:

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

input:

16 50
1 2 3 4 5 6 16 15 14 7 13 8 12 11 9 10
33 12 21 38 34 22 38 30 25 4 42 32 12 33 21 29 11 37 21 25 32 26 28 5 46 4 27 10 11 37 39 48 49 16 11 24 48 2 18 37 28 37 29 24 5 39 10 22 36 11

output:

No

result:

ok answer is NO

Test #81:

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

input:

13 50
13 1 12 2 11 3 10 4 5 6 7 8 9
44 47 33 45 25 6 34 34 35 23 43 2 21 23 40 50 2 6 43 28 35 40 9 3 8 42 23 24 5 14 18 41 21 24 26 10 40 23 25 35 28 35 27 49 9 22 28 37 23 50

output:

Yes

result:

ok answer is YES

Test #82:

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

input:

14 50
14 13 12 1 2 3 4 5 11 10 6 7 9 8
35 34 24 50 4 32 1 45 11 32 39 2 42 41 35 7 38 21 38 6 23 23 12 16 45 26 25 47 35 44 45 45 38 47 23 35 19 37 7 41 21 49 10 33 36 37 12 23 23 31

output:

No

result:

ok answer is NO

Test #83:

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

input:

32 50
32 31 30 1 29 2 3 28 27 26 4 25 5 24 6 23 7 22 8 9 21 10 11 20 12 13 14 19 18 15 17 16
49 50 49 47 1 45 35 2 33 5 44 40 39 5 7 10 1 38 29 10 5 37 30 11 8 36 13 35 36 15 16 47 33 24 29 9 18 20 32 21 22 23 31 29 25 11 27 26 39 26

output:

Yes

result:

ok answer is YES

Test #84:

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

input:

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

output:

No

result:

ok answer is NO

Test #85:

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

input:

12 100
1 12 2 3 4 11 5 10 9 6 8 7
29 13 97 42 98 76 10 53 91 54 36 24 98 13 34 66 74 94 14 9 5 89 67 23 57 52 23 58 25 13 1 1 23 78 59 6 54 61 45 27 25 78 25 49 88 29 97 34 86 83 37 16 67 58 13 78 18 94 61 22 19 62 3 68 32 65 6 33 36 26 84 40 6 43 100 41 80 44 19 85 53 75 54 59 32 23 80 46 77 20 34 ...

output:

Yes

result:

ok answer is YES

Test #86:

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

input:

35 100
35 1 34 2 33 3 32 4 5 6 31 30 29 28 7 8 27 26 9 25 10 11 12 24 13 23 22 21 14 15 20 19 18 17 16
33 48 36 10 89 53 62 89 8 91 29 62 69 54 37 4 22 73 61 6 26 48 83 36 40 18 20 10 94 47 48 91 62 74 91 35 13 72 59 18 67 8 56 11 56 78 58 33 71 44 31 86 21 8 98 23 62 19 100 81 45 31 31 71 55 98 46 ...

output:

No

result:

ok answer is NO

Test #87:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #88:

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

input:

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

output:

No

result:

ok answer is NO

Test #89:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #90:

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

input:

24 100
1 24 2 23 3 22 4 21 20 19 18 17 16 5 15 6 7 8 14 9 10 11 13 12
63 49 46 49 42 69 69 87 16 28 29 12 73 29 43 63 66 40 56 31 71 69 88 100 50 11 56 10 54 31 44 36 68 98 62 14 73 87 33 59 94 38 63 64 47 22 63 67 33 75 88 77 28 61 15 25 29 32 77 2 37 26 23 93 37 20 53 77 8 17 76 21 71 85 19 65 72 ...

output:

No

result:

ok answer is NO

Test #91:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #92:

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

input:

33 100
1 33 32 2 3 4 5 6 31 30 29 7 8 9 28 10 27 26 25 24 11 23 22 12 21 13 14 15 16 20 17 19 18
57 4 50 80 26 54 44 21 37 36 43 15 87 43 10 2 100 85 6 92 22 61 83 72 9 79 49 51 10 98 44 14 29 97 9 33 49 67 35 67 36 78 22 36 4 72 51 57 67 41 74 84 79 50 27 49 27 18 86 2 33 27 55 96 59 90 66 59 6 76 ...

output:

No

result:

ok answer is NO

Test #93:

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

input:

55 100
55 54 53 52 51 1 2 3 50 49 48 47 4 5 6 46 7 45 8 9 44 43 42 41 10 40 11 39 38 37 12 36 35 13 34 14 33 32 15 31 30 16 29 28 27 17 18 19 26 20 21 22 25 24 23
99 98 3 96 17 95 94 93 1 3 21 4 45 93 97 60 92 88 38 29 87 10 78 13 47 14 83 63 74 16 82 17 34 19 98 81 25 85 100 57 93 48 79 78 79 30 28...

output:

Yes

result:

ok answer is YES

Test #94:

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

input:

2 100
1 2
69 84 31 81 3 95 78 2 75 44 92 32 32 61 3 72 66 81 12 71 56 87 89 78 91 93 91 52 37 9 24 91 75 87 99 23 76 37 75 25 20 50 51 5 13 28 53 85 5 98 27 4 82 34 77 17 88 88 29 45 63 21 38 28 31 58 24 60 78 10 93 92 65 75 52 58 28 78 81 10 9 50 26 29 69 65 70 31 79 7 88 41 79 1 4 24 64 67 50 20

output:

Yes

result:

ok answer is YES

Test #95:

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

input:

36 100
36 35 34 1 2 3 33 4 5 32 6 7 8 31 9 30 10 29 28 11 27 26 12 25 24 13 14 23 15 22 21 16 17 20 18 19
56 88 56 45 72 99 59 18 98 12 97 12 1 11 72 5 12 96 88 13 4 10 43 36 47 63 9 19 50 55 86 58 88 21 22 59 23 28 79 48 98 80 14 26 47 12 41 6 89 67 78 2 27 77 84 61 76 29 5 80 68 24 85 12 67 32 55 ...

output:

Yes

result:

ok answer is YES

Test #96:

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

input:

31 100
31 1 30 29 2 28 3 4 5 27 26 6 7 25 24 8 23 9 22 10 11 21 12 20 19 18 13 14 15 16 17
22 25 9 50 25 5 15 91 18 29 22 3 66 95 19 68 41 97 75 33 98 61 95 3 89 93 20 5 23 7 72 25 6 65 27 69 14 14 75 94 89 28 48 48 32 56 9 84 8 5 41 77 10 77 79 88 3 82 42 48 16 86 58 26 35 28 5 34 68 45 35 8 97 48 ...

output:

No

result:

ok answer is NO

Test #97:

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

input:

14 100
14 1 2 3 13 12 4 11 10 5 9 8 6 7
6 46 75 21 6 73 80 73 15 64 73 10 63 32 68 4 72 43 51 72 43 66 87 94 13 22 84 86 23 10 6 61 64 17 24 5 95 31 12 29 55 98 38 72 85 68 93 9 1 22 31 46 65 55 86 58 59 53 58 65 4 69 83 10 24 81 70 20 100 70 28 58 96 100 97 55 88 17 25 73 64 37 45 59 40 27 84 18 30...

output:

Yes

result:

ok answer is YES

Test #98:

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

input:

13 100
13 1 2 3 4 12 11 10 5 6 7 9 8
69 44 1 96 69 29 8 74 89 77 25 99 2 32 41 40 38 6 18 33 43 25 63 12 20 9 99 84 11 91 81 39 45 39 59 53 64 54 98 99 86 28 40 97 35 11 59 89 7 82 95 85 18 95 59 96 90 6 65 58 96 31 77 72 59 40 34 29 76 45 82 23 28 6 37 91 49 13 25 85 66 81 77 52 78 8 65 32 57 78 92...

output:

Yes

result:

ok answer is YES

Test #99:

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

input:

4 100
1 2 4 3
55 99 72 50 72 73 67 69 83 22 5 65 2 66 88 14 36 95 55 41 38 60 6 54 53 26 32 100 59 70 44 65 32 55 83 60 13 36 73 70 3 98 16 58 36 14 58 44 74 55 25 14 80 64 47 96 8 71 82 2 68 24 93 61 14 71 37 78 52 45 82 66 44 24 15 75 72 40 63 25 25 43 22 36 62 35 45 68 87 60 37 68 86 37 8 74 29 7...

output:

Yes

result:

ok answer is YES

Test #100:

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

input:

37 100
1 37 2 36 3 4 35 34 5 6 7 8 9 10 11 12 13 33 14 15 32 31 16 30 29 17 28 18 27 19 26 20 21 25 24 23 22
13 24 84 38 99 74 97 79 59 93 77 1 53 82 94 30 73 49 95 1 39 32 98 70 38 47 84 9 17 29 8 83 9 9 32 88 56 18 30 80 6 88 61 45 18 17 53 66 78 25 75 7 52 66 34 75 74 32 19 69 51 82 66 23 71 40 8...

output:

No

result:

ok answer is NO

Test #101:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #102:

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

input:

33 100
33 1 2 3 4 5 6 7 32 8 9 31 10 30 29 11 28 27 26 25 24 23 12 13 14 22 21 20 15 19 18 16 17
73 91 41 25 53 52 33 97 80 100 7 31 36 99 52 51 91 74 39 42 43 13 12 43 84 45 21 25 33 55 5 11 55 23 80 50 81 30 88 67 46 100 87 95 42 55 55 48 45 30 88 79 15 79 53 85 74 66 100 56 95 32 62 72 90 89 88 3...

output:

No

result:

ok answer is NO

Test #103:

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

input:

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

output:

Yes

result:

ok answer is YES

Test #104:

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

input:

28 200
1 28 27 2 3 4 5 6 7 8 26 25 24 9 10 23 22 21 11 12 20 19 13 14 15 16 18 17
16 114 171 134 197 181 140 31 88 102 10 5 194 160 193 68 106 136 151 84 121 90 56 171 101 84 5 33 31 178 176 91 29 152 25 73 152 155 36 177 175 49 153 121 11 83 11 120 185 50 2 174 27 152 25 175 103 75 24 68 22 181 75 ...

output:

No

result:

ok answer is NO

Test #105:

score: 0
Accepted
time: 3ms
memory: 3688kb

input:

56 200
1 56 55 54 2 53 3 52 51 4 50 5 49 6 48 47 7 8 9 10 46 45 11 12 44 13 14 43 42 41 40 15 39 16 17 38 37 36 35 34 18 33 19 20 21 32 22 23 24 31 25 30 29 28 26 27
28 31 7 197 31 24 152 53 193 65 191 95 118 8 64 86 171 190 57 160 67 197 120 12 189 74 187 57 76 15 185 174 109 156 2 138 198 22 181 2...

output:

Yes

result:

ok answer is YES

Test #106:

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

input:

48 200
48 47 46 45 1 44 2 3 43 4 5 6 7 8 9 42 10 41 11 12 13 14 15 40 39 38 37 16 17 18 19 20 21 22 23 36 35 24 25 34 26 33 32 27 31 30 28 29
173 175 76 67 135 75 130 185 147 185 97 122 11 87 86 162 76 146 162 125 66 72 65 197 145 44 194 173 93 197 58 200 51 87 193 138 150 128 147 6 139 92 40 71 77 ...

output:

No

result:

ok answer is NO

Test #107:

score: 0
Accepted
time: 2ms
memory: 3592kb

input:

42 200
1 42 2 3 4 5 41 6 7 8 9 40 10 11 39 12 38 13 37 36 35 34 33 14 15 32 31 16 30 29 17 28 18 19 20 27 26 21 22 25 23 24
79 122 70 193 79 70 4 190 71 142 121 38 72 4 93 121 177 12 29 14 84 13 14 98 15 137 189 196 160 18 59 18 11 139 58 197 138 155 8 24 93 46 52 126 68 53 14 21 145 196 125 161 20 ...

output:

Yes

result:

ok answer is YES

Test #108:

score: 0
Accepted
time: 3ms
memory: 3708kb

input:

71 200
71 1 2 3 4 70 69 5 68 67 66 65 64 63 62 61 60 6 59 58 57 56 7 8 55 54 9 10 11 53 12 13 14 15 52 51 16 50 17 18 19 20 49 21 48 47 46 45 22 23 24 25 26 44 27 43 28 42 41 40 39 29 38 30 37 31 36 35 34 32 33
176 183 100 81 18 1 48 114 26 179 30 161 110 196 78 165 143 47 4 109 180 179 39 87 197 13...

output:

No

result:

ok answer is NO

Test #109:

score: 0
Accepted
time: 4ms
memory: 3976kb

input:

123 200
1 2 123 122 121 3 120 4 119 5 118 6 7 8 9 10 11 12 117 116 115 114 113 13 14 112 111 15 16 17 110 18 109 108 107 19 106 105 104 20 103 102 21 22 101 100 23 99 24 25 26 27 98 28 97 96 95 94 29 93 30 92 91 31 90 89 32 33 34 88 87 35 86 36 85 37 84 38 39 40 83 82 81 41 42 80 79 78 77 76 75 43 7...

output:

Yes

result:

ok answer is YES

Test #110:

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

input:

6 200
6 1 5 4 2 3
176 122 93 74 99 11 160 100 72 60 118 169 198 27 61 89 59 50 43 54 97 71 132 187 68 68 13 74 165 144 116 188 154 60 157 38 43 102 30 190 143 25 76 154 29 164 108 49 172 191 155 200 19 97 166 142 9 124 123 136 30 127 134 102 80 51 14 60 168 71 117 2 162 61 3 61 25 178 43 27 80 81 60...

output:

Yes

result:

ok answer is YES

Test #111:

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

input:

5 200
1 2 5 4 3
23 154 25 121 41 53 55 121 84 70 167 88 24 123 36 167 89 74 83 1 142 126 11 13 79 195 12 177 41 151 33 179 55 150 151 143 78 117 33 72 199 24 10 122 95 71 121 31 25 44 105 50 82 165 35 180 11 174 89 74 171 140 36 85 66 146 160 65 71 88 27 70 171 111 169 194 164 46 147 182 99 96 187 1...

output:

Yes

result:

ok answer is YES

Test #112:

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

input:

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

output:

No

result:

ok answer is NO

Test #113:

score: 0
Accepted
time: 4ms
memory: 3756kb

input:

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

output:

Yes

result:

ok answer is YES

Test #114:

score: 0
Accepted
time: 2ms
memory: 3836kb

input:

37 200
1 37 36 2 3 35 34 4 5 33 32 6 31 7 30 8 29 28 27 26 25 9 24 23 10 11 22 12 13 14 21 20 19 18 15 16 17
86 191 29 170 23 11 125 6 34 68 165 172 132 78 52 89 31 117 197 76 14 45 71 122 108 36 198 171 126 2 121 115 36 8 98 178 164 38 73 36 103 75 121 154 138 168 18 32 23 29 141 93 25 3 107 54 171...

output:

No

result:

ok answer is NO

Test #115:

score: 0
Accepted
time: 3ms
memory: 3752kb

input:

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

output:

Yes

result:

ok answer is YES

Test #116:

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

input:

8 200
8 7 1 6 2 5 3 4
132 49 111 164 7 60 146 27 153 111 43 163 3 156 196 10 18 8 108 37 151 164 173 90 126 64 86 56 152 187 1 10 25 12 94 145 146 148 127 79 128 121 194 148 123 117 138 52 80 21 159 6 112 131 1 175 95 125 136 77 197 59 119 173 8 124 21 126 144 154 131 148 170 73 128 189 182 172 152 ...

output:

Yes

result:

ok answer is YES

Test #117:

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

input:

170 200
170 169 1 168 2 167 3 166 165 164 163 162 161 4 160 5 159 158 157 6 7 8 9 156 10 155 154 11 12 153 152 151 150 13 14 149 148 147 15 16 17 146 18 19 20 21 22 145 23 144 24 25 143 26 142 141 27 140 28 29 139 30 31 138 32 137 33 136 34 35 36 37 38 39 40 41 135 42 134 43 44 133 45 132 131 130 12...

output:

Yes

result:

ok answer is YES

Test #118:

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

input:

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

output:

No

result:

ok answer is NO

Test #119:

score: 0
Accepted
time: 5ms
memory: 3768kb

input:

148 200
148 1 147 2 146 3 145 144 4 5 6 7 8 9 143 10 11 142 141 140 12 139 13 138 137 14 15 16 17 18 19 20 21 136 22 135 134 23 133 132 24 25 131 130 26 129 128 27 127 28 29 126 30 31 32 33 125 124 34 123 35 122 36 37 38 121 39 40 120 119 41 42 118 117 43 44 116 115 45 46 114 47 113 112 48 111 49 50...

output:

Yes

result:

ok answer is YES

Test #120:

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

input:

29 200
29 1 28 2 3 4 5 27 26 6 25 7 8 9 10 11 24 23 12 22 13 21 14 20 19 18 17 16 15
43 142 100 134 27 28 139 173 180 134 180 30 197 157 168 130 176 52 106 23 100 147 140 192 91 68 50 1 36 185 181 67 98 20 49 142 115 100 71 170 193 39 20 173 141 90 24 64 151 35 104 18 47 72 21 75 72 85 155 130 47 18...

output:

No

result:

ok answer is NO

Test #121:

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

input:

30 200
1 2 30 29 28 3 27 4 26 5 25 24 6 23 22 7 21 20 8 19 9 18 17 10 11 12 13 16 15 14
116 76 132 86 173 4 95 11 24 81 20 108 198 145 34 100 149 167 63 183 32 169 168 158 130 162 195 125 2 197 91 132 87 38 87 180 78 41 57 146 12 28 53 194 28 25 189 54 135 182 178 157 88 10 160 143 29 30 2 29 136 15...

output:

Yes

result:

ok answer is YES

Test #122:

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

input:

4 200
4 1 3 2
165 126 88 137 161 83 154 81 173 41 79 11 101 116 196 83 20 64 61 25 13 143 9 42 83 2 123 86 138 128 19 168 171 112 171 25 188 173 187 78 86 157 158 93 69 34 43 188 196 65 36 170 134 85 2 4 118 196 31 169 144 65 90 143 37 57 63 76 51 22 68 85 75 183 102 98 114 174 186 56 184 8 140 142 ...

output:

Yes

result:

ok answer is YES

Test #123:

score: 0
Accepted
time: 2ms
memory: 4060kb

input:

152 200
152 151 1 150 2 3 4 5 149 6 7 148 8 147 146 145 9 144 143 142 141 10 140 11 139 12 13 138 14 137 136 15 16 135 134 17 18 133 132 19 131 20 21 22 130 23 24 129 25 26 128 27 28 127 126 29 125 124 30 31 32 123 122 33 121 34 35 36 37 120 119 38 118 39 117 116 40 41 115 114 113 112 42 111 110 109...

output:

Yes

result:

ok answer is YES

Test #124:

score: 0
Accepted
time: 72ms
memory: 4412kb

input:

295 500
1 2 295 3 4 5 6 294 293 292 7 291 8 290 289 9 288 287 286 285 284 10 11 283 282 281 12 280 13 279 278 277 14 15 16 17 18 276 19 275 274 20 273 21 272 22 271 270 23 269 24 268 25 26 27 28 29 267 30 266 265 264 263 262 261 31 32 33 260 34 35 36 37 38 259 258 257 39 256 40 41 255 42 254 43 44 4...

output:

No

result:

ok answer is NO

Test #125:

score: 0
Accepted
time: 87ms
memory: 5252kb

input:

489 500
489 1 2 3 4 488 5 6 487 486 7 8 9 485 10 484 11 12 483 13 482 481 480 479 478 477 14 15 16 17 18 19 476 20 475 21 474 473 472 22 471 470 23 469 468 467 24 25 466 26 465 27 464 28 29 463 462 461 30 460 459 31 32 33 458 34 35 36 37 38 39 40 41 42 457 456 455 43 44 454 45 453 452 451 450 449 44...

output:

Yes

result:

ok answer is YES

Test #126:

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

input:

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

output:

No

result:

ok answer is NO

Test #127:

score: 0
Accepted
time: 42ms
memory: 3836kb

input:

175 500
175 1 174 2 3 4 5 6 7 173 172 171 170 169 168 167 166 8 165 9 164 163 10 162 161 11 12 13 160 14 159 15 158 157 156 155 16 17 18 154 19 153 152 20 151 21 150 22 23 149 24 148 147 25 26 146 27 28 145 29 30 144 31 143 32 33 34 142 141 35 140 36 139 138 137 136 135 134 133 132 131 37 38 39 40 1...

output:

Yes

result:

ok answer is YES

Test #128:

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

input:

64 500
1 2 64 3 4 63 62 5 6 61 7 60 8 9 59 10 11 12 13 14 58 15 57 56 55 54 53 52 51 16 50 49 17 18 19 48 47 46 45 44 20 21 22 43 42 23 24 25 26 27 41 40 39 28 29 30 31 32 33 38 34 35 37 36
400 251 7 367 117 128 452 327 221 341 106 128 354 475 142 149 90 11 27 33 224 263 247 396 325 379 463 304 151 ...

output:

No

result:

ok answer is NO

Test #129:

score: 0
Accepted
time: 73ms
memory: 4660kb

input:

361 500
361 360 359 358 357 1 356 355 354 353 2 3 352 351 350 349 348 4 347 5 346 6 7 8 9 10 11 345 344 12 13 343 14 15 342 341 16 340 339 17 18 338 19 337 20 336 21 335 334 22 333 332 331 330 329 23 24 25 26 27 328 28 29 30 31 32 327 33 34 35 36 37 326 325 324 323 38 39 40 41 42 43 322 44 321 45 46...

output:

Yes

result:

ok answer is YES

Test #130:

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

input:

117 500
117 116 115 114 1 2 113 3 4 5 6 7 8 9 10 11 112 12 13 111 14 110 109 15 16 17 108 107 106 105 18 104 19 103 102 101 20 100 99 21 22 23 24 25 98 26 97 27 96 95 94 93 92 28 91 90 29 89 88 30 31 87 86 32 33 85 34 84 35 36 83 37 38 39 40 41 82 42 81 80 79 78 77 43 76 75 44 74 45 46 73 72 47 48 7...

output:

No

result:

ok answer is NO

Test #131:

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

input:

46 500
46 45 1 2 3 44 4 43 5 42 41 40 39 6 38 7 8 9 10 37 36 11 35 12 13 34 33 32 14 31 30 15 29 16 17 18 19 28 20 21 27 22 26 23 24 25
29 490 435 243 457 494 22 17 362 496 286 198 240 482 49 92 148 101 269 360 349 259 6 372 329 10 319 324 12 434 117 423 393 12 274 337 187 449 20 188 445 252 91 187 ...

output:

Yes

result:

ok answer is YES

Test #132:

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

input:

184 500
184 183 1 182 2 3 181 4 180 5 179 178 177 176 6 7 8 175 9 174 173 10 172 11 171 12 13 170 14 15 16 17 18 169 19 20 21 22 23 168 167 166 165 24 164 25 26 27 163 28 162 161 29 160 30 31 159 32 33 158 34 35 36 157 37 38 39 40 156 155 154 153 152 41 42 151 150 149 43 148 147 44 146 45 46 145 144...

output:

No

result:

ok answer is NO

Test #133:

score: 0
Accepted
time: 82ms
memory: 4872kb

input:

424 500
1 424 423 2 3 4 5 422 421 6 7 8 9 10 420 11 419 12 13 418 14 15 417 16 416 415 414 17 18 413 19 412 20 411 21 410 409 22 408 407 23 24 25 406 405 26 27 404 28 403 402 29 401 400 30 399 31 398 32 33 397 396 395 394 34 35 36 37 38 393 392 391 390 39 40 389 388 41 387 42 386 43 44 385 45 384 38...

output:

Yes

result:

ok answer is YES

Test #134:

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

input:

30 500
1 2 30 3 4 29 5 28 27 6 7 8 9 26 10 11 12 25 24 13 23 22 21 20 14 15 16 17 18 19
257 388 106 482 110 421 388 84 131 415 344 309 84 146 374 1 41 372 444 153 477 96 351 289 488 168 454 215 413 416 413 282 64 300 271 240 409 117 284 377 384 53 216 413 58 483 482 126 11 436 62 220 234 141 460 216...

output:

Yes

result:

ok answer is YES

Test #135:

score: 0
Accepted
time: 65ms
memory: 4336kb

input:

314 500
1 2 3 314 313 4 312 5 6 7 311 310 8 9 10 11 12 13 309 308 14 15 16 17 307 18 19 20 306 21 305 304 22 23 303 302 301 300 24 299 25 26 298 27 28 297 296 29 295 30 31 294 32 293 33 34 35 36 292 291 37 38 290 39 40 41 42 289 288 287 43 286 285 44 45 284 46 283 47 282 48 49 281 280 279 278 50 51 ...

output:

Yes

result:

ok answer is YES

Test #136:

score: 0
Accepted
time: 43ms
memory: 3840kb

input:

178 500
1 2 3 178 4 177 5 176 175 6 174 173 172 7 8 171 170 9 169 168 10 11 12 13 167 166 14 15 16 17 165 18 164 163 19 162 20 21 161 160 22 23 159 158 157 24 156 155 154 153 25 152 26 151 27 28 150 149 148 29 30 31 147 32 33 34 35 146 145 144 36 37 143 142 38 141 140 39 40 41 139 42 138 137 136 43 ...

output:

No

result:

ok answer is NO

Test #137:

score: 0
Accepted
time: 92ms
memory: 5216kb

input:

500 500
1 2 3 4 5 500 6 7 499 8 9 10 11 498 12 497 496 13 495 14 15 494 493 16 17 492 18 491 490 19 20 21 489 488 487 22 23 486 24 25 485 26 27 484 28 29 30 483 31 482 481 480 32 479 478 33 477 34 35 36 476 475 474 473 472 37 471 38 470 469 39 468 40 467 41 466 42 43 465 464 463 462 461 460 44 459 4...

output:

Yes

result:

ok answer is YES

Test #138:

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

input:

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

output:

No

result:

ok answer is NO

Test #139:

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

input:

185 500
1 185 184 2 183 3 4 5 182 181 180 6 179 178 7 177 8 9 10 11 12 176 175 174 13 173 172 171 14 15 170 169 16 168 167 166 17 18 165 19 20 21 22 23 164 163 162 161 24 160 25 26 27 159 158 157 156 155 154 153 28 152 29 30 31 32 151 33 34 35 150 149 148 147 36 146 145 144 37 143 38 142 39 40 41 42...

output:

Yes

result:

ok answer is YES

Test #140:

score: 0
Accepted
time: 31ms
memory: 3728kb

input:

126 500
126 125 124 1 2 3 4 5 6 123 7 122 121 120 119 118 117 116 8 9 10 11 12 13 115 14 114 15 113 16 17 112 111 18 19 20 110 109 21 108 107 22 23 24 106 25 26 27 28 105 104 103 102 29 30 31 32 33 101 34 100 99 98 35 97 36 37 96 38 95 39 40 41 94 42 93 92 91 43 44 45 46 90 89 47 88 48 87 86 49 85 5...

output:

No

result:

ok answer is NO

Test #141:

score: 0
Accepted
time: 74ms
memory: 4676kb

input:

371 500
371 370 1 369 368 2 367 3 4 366 5 365 364 363 6 7 362 8 9 10 11 361 12 360 359 13 358 357 14 356 15 16 355 17 18 354 19 353 20 352 21 22 351 350 349 23 24 25 348 26 347 27 28 29 30 346 31 345 344 343 342 32 33 341 34 35 36 340 339 37 38 338 337 39 336 335 334 40 41 42 43 44 333 45 332 46 331...

output:

Yes

result:

ok answer is YES

Test #142:

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

input:

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

output:

No

result:

ok answer is NO

Test #143:

score: 0
Accepted
time: 91ms
memory: 5228kb

input:

485 500
1 2 3 4 5 6 7 485 484 483 482 481 480 8 9 10 11 479 478 12 477 13 14 15 476 475 474 16 17 18 473 19 472 471 20 470 469 468 467 21 22 466 23 465 24 25 26 464 463 27 462 461 460 28 459 458 29 30 31 32 33 457 456 455 454 453 34 35 36 37 38 452 451 450 449 39 448 40 41 42 43 44 447 446 45 445 46...

output:

Yes

result:

ok answer is YES

Test #144:

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

input:

41 500
1 2 3 4 5 41 6 7 8 40 39 9 10 11 38 37 12 36 13 35 34 14 33 32 15 16 31 17 18 19 20 30 29 21 22 28 27 23 26 25 24
40 311 55 38 252 284 249 471 117 75 302 266 396 472 290 74 27 51 487 251 362 469 232 439 26 476 381 344 249 227 264 8 419 103 297 289 451 383 103 261 344 393 61 416 352 483 222 29...

output:

No

result:

ok answer is NO

Test #145:

score: 0
Accepted
time: 12ms
memory: 3992kb

input:

41 500
1 2 3 4 41 5 40 6 39 38 7 37 36 8 35 9 34 33 10 11 32 31 30 29 28 12 27 13 14 15 26 16 17 25 18 24 23 22 21 19 20
237 494 234 389 273 143 390 490 360 244 44 428 319 204 349 469 28 8 474 52 329 153 197 472 332 252 344 235 21 156 52 92 100 171 99 474 92 422 246 135 473 348 428 25 442 143 306 12...

output:

Yes

result:

ok answer is YES

Test #146:

score: 0
Accepted
time: 12ms
memory: 3992kb

input:

41 500
1 41 40 39 38 37 2 3 4 36 35 5 34 33 32 6 7 31 30 8 29 28 9 27 26 25 10 24 23 22 11 21 20 12 19 13 18 17 14 15 16
231 189 105 251 293 298 19 9 499 313 93 386 433 423 407 364 326 261 448 45 284 325 365 6 38 119 306 423 101 381 135 473 384 443 1 159 233 268 82 496 101 99 104 430 247 100 94 251 ...

output:

Yes

result:

ok answer is YES

Test #147:

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

input:

41 500
41 40 1 2 3 39 4 38 37 5 6 36 35 34 7 8 9 33 32 31 30 29 10 28 11 12 13 27 26 25 24 14 23 15 22 21 16 17 20 19 18
225 476 180 410 122 465 161 231 445 278 39 240 355 347 466 260 327 422 435 242 240 202 34 143 436 191 473 110 78 311 219 46 361 24 495 47 374 115 226 73 26 259 176 336 41 260 371 ...

output:

Yes

result:

ok answer is YES

Test #148:

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

input:

41 500
41 40 39 1 38 2 37 36 3 4 35 5 6 34 7 33 32 31 8 30 29 28 27 26 9 10 11 25 12 13 14 15 16 24 23 22 17 21 18 20 19
423 467 51 260 143 120 290 58 84 51 293 402 265 374 24 51 125 175 218 235 3 78 307 176 38 58 140 1 362 432 7 130 145 296 500 220 219 258 369 446 154 10 351 49 143 420 159 101 87 1...

output:

No

result:

ok answer is NO

Test #149:

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

input:

41 500
41 1 40 39 38 37 2 36 35 3 4 34 5 6 7 33 8 32 9 31 30 10 29 11 28 27 26 12 13 14 25 24 23 15 16 17 18 22 21 19 20
121 458 218 419 460 479 227 77 31 16 238 256 187 298 83 242 126 132 397 432 162 250 476 6 244 130 103 188 146 157 295 11 121 68 198 108 360 309 205 320 79 169 219 454 232 81 447 1...

output:

Yes

result:

ok answer is YES

Test #150:

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

input:

41 500
41 1 2 3 4 40 5 6 7 39 38 8 9 10 11 12 37 36 13 14 15 16 17 18 35 34 33 19 32 20 21 22 31 30 23 29 28 24 25 27 26
115 245 89 270 289 134 368 3 466 288 492 418 313 221 141 342 424 89 180 233 130 330 145 347 346 201 270 79 418 87 379 84 406 148 396 89 1 155 349 385 208 421 99 359 26 445 224 451...

output:

No

result:

ok answer is NO

Test #151:

score: 0
Accepted
time: 12ms
memory: 3688kb

input:

41 500
1 41 40 2 39 3 38 4 37 36 5 6 35 7 34 8 9 33 32 10 11 12 13 14 15 16 17 31 30 29 28 27 18 26 19 25 24 23 20 22 21
108 440 460 132 310 493 201 330 412 61 437 272 428 249 496 237 425 342 463 226 85 3 109 176 52 273 437 162 203 4 463 168 382 421 198 477 346 298 289 54 336 376 466 265 128 298 12 ...

output:

Yes

result:

ok answer is YES

Test #152:

score: 0
Accepted
time: 13ms
memory: 3976kb

input:

41 500
1 41 2 40 3 39 4 5 6 38 7 37 36 35 34 8 33 32 31 9 10 30 29 11 28 12 13 27 14 26 15 25 24 16 23 17 18 22 21 19 20
102 432 343 187 330 148 138 349 51 26 487 434 350 172 259 325 19 4 141 219 40 175 278 210 154 140 400 349 283 137 354 49 167 1 100 162 487 145 420 427 465 331 142 182 421 254 4 40...

output:

Yes

result:

ok answer is YES

Test #153:

score: 0
Accepted
time: 11ms
memory: 3656kb

input:

41 500
41 1 2 3 4 40 5 6 7 39 38 37 36 35 34 33 8 32 9 10 31 30 29 28 11 12 13 14 27 26 25 24 15 23 22 16 17 18 19 21 20
46 235 177 429 293 239 225 227 171 38 488 35 138 25 316 156 322 303 104 76 25 96 95 67 369 226 191 289 417 391 275 1 136 325 297 362 265 477 266 70 89 53 245 329 500 366 183 415 4...

output:

No

result:

ok answer is NO

Test #154:

score: 0
Accepted
time: 117ms
memory: 5216kb

input:

500 500
1 500 2 499 498 497 3 496 4 5 6 7 8 9 495 494 493 10 492 491 11 490 12 13 14 15 489 488 16 487 486 485 484 483 17 482 481 480 18 19 479 478 20 21 22 477 23 24 25 26 476 27 28 29 30 31 475 32 474 33 473 472 34 471 35 470 36 37 38 39 40 469 468 41 42 467 43 44 45 466 46 47 465 464 48 49 50 51 ...

output:

No

result:

ok answer is NO

Test #155:

score: 0
Accepted
time: 90ms
memory: 5152kb

input:

500 500
1 500 2 499 498 497 3 496 4 5 6 7 8 9 495 494 493 10 492 491 11 490 12 13 14 15 489 488 16 487 486 485 484 483 17 482 481 480 18 19 479 478 20 21 22 477 23 24 25 26 476 27 28 29 30 31 475 32 474 33 473 472 34 471 35 470 36 37 38 39 40 469 468 41 42 467 43 44 45 466 46 47 465 464 48 49 50 51 ...

output:

Yes

result:

ok answer is YES

Extra Test:

score: 0
Extra Test Passed