QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#389102#8551. DFS Order 5ucup-team197#AC ✓208ms24896kbC++175.1kb2024-04-14 02:23:182024-04-14 02:23:19

Judging History

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

  • [2024-04-14 02:23:19]
  • 评测
  • 测评结果:AC
  • 用时:208ms
  • 内存:24896kb
  • [2024-04-14 02:23:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef unsigned long long ull ;
typedef pair < int , int > pii ;
typedef vector<int> vi;
#define fi first
#define se second
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()

const int MAXN = 1e5 + 7 ;
const int LOG = 20 ;

int n , q ;
vector < int > v[ MAXN ] ;
int sub[ MAXN ] ;

int st[ MAXN ] , en[ MAXN ] , tp ;
int LCA[ MAXN ][ LOG ] , lvl[ MAXN ] ;

void init ( int x , int prv ) {
    st[ x ] = ++ tp ;
    sub[ x ] = 1 ;
    for ( int i = 1 ; i < LOG ; ++ i ) {
        LCA[ x ][ i ] = LCA[ LCA[ x ][ i - 1 ] ][ i - 1 ] ;
    }
    for ( auto y : v[ x ] ) {
        if ( y == prv ) { continue ; }
        lvl[ y ] = lvl[ x ] + 1 ;
        LCA[ y ][ 0 ] = x ;
        init ( y , x ) ;
        sub[ x ] += sub[ y ] ;
    }
    en[ x ] = tp ;
}

int get_lca ( int x , int y ) {
    for ( int i = LOG - 1 ; i >= 0 ; -- i ) {
        if ( lvl[ x ] - ( 1 << i ) >= lvl[ y ] ) {
            x = LCA[ x ][ i ] ;
        }
        if ( lvl[ y ] - ( 1 << i ) >= lvl[ x ] ) {
            y = LCA[ y ][ i ] ;
        }
    }
    for ( int i = LOG - 1 ; i >= 0 ; -- i ) {
        if ( LCA[ x ][ i ] != LCA[ y ][ i ] ) {
            x = LCA[ x ][ i ] ;
            y = LCA[ y ][ i ] ;
        }
    }
    if ( x != y ) { x = LCA[ x ][ 0 ] ; }
    return x ;
}

int tr[ MAXN ] ;
void update ( int x , int val ) {
    while ( x <= n ) {
        if ( val < 0 ) { tr[ x ] = 0 ; }
        else { tr[ x ] += val ; }
        x += ( x & -x ) ;
    }
}
int query ( int x ) {
    int ans = 0 ;
    while ( x > 0 ) {
        ans += tr[ x ] ;
        x -= ( x & -x ) ;
    }
    return ans ;
}

int in_sub ( int x ) {
    return query ( en[ x ] ) - query ( st[ x ] - 1 ) ;
}

int k ;
int a[ MAXN ] ;

bool rec_check ( int x , int lo , int hi ) {
    set < int > children ;
    for ( int i = lo + 1 ; i <= hi ; ++ i ) {
        if ( LCA[ a[ i ] ][ 0 ] != x ) { return false ; }
        if ( children.find ( a[ i ] ) != children.end ( ) ) { return false ; }
        children.insert ( a[ i ] ) ;
        if ( rec_check ( a[ i ] , i , i + sub[ a[ i ] ] - 1 ) == false ) { return false ; }
        i = i + sub[ a[ i ] ] - 1 ;
    }
    return true ;
}

void solve ( ) {
    cin >> n >> q ;
    for ( int i = 1 , x , y ; i < n ; ++ i ) {
        cin >> x >> y ;
        v[ x ].push_back ( y ) ;
        v[ y ].push_back ( x ) ;
    }
    init ( 1 , -1 ) ;
    while ( q -- ) {
        for ( int i = 1 ; i <= k ; ++ i ) {
            update ( st[ a[ i ] ] , -1 ) ;
        }
        cin >> k ;
        for ( int i = 1 ; i <= k ; ++ i ) {
            cin >> a[ i ] ;
        }
        if ( k > n ) {
            cout << "No\n" ;
            continue ;
        }
        int i = 1 ;
        bool good = true ;
        int x = LCA[ a[ 1 ] ][ 0 ] ;
        while ( i <= k ) {
            if ( i + sub[ a[ i ] ] - 1 > k ) { break ; }
            if ( in_sub ( a[ i ] ) > 0 ) {
                good = false ;
                break ;
            }
            // printf ( "%d %d\n" , x , a[ i ] ) ;
            x = get_lca ( x , a[ i ] ) ;
            if ( LCA[ a[ i ] ][ 0 ] != x ) {
                good = false ;
                break ;
            }
            if ( i + sub[ a[ i ] ] - 1 <= k ) {
                if ( rec_check ( a[ i ] , i , i + sub[ a[ i ] ] - 1 ) == false ) {
                    good = false ;
                    break ;
                }
                for ( int j = i ; j <= i + sub[ a[ i ] ] - 1 ; ++ j ) {
                    update ( st[ a[ j ] ] , 1 ) ;
                }
                i += sub[ a[ i ] ] ;
            }
            else { break ; }
        }
        if ( good == false ) {
            cout << "No\n" ;
            continue ;
        }
        if ( i > k ) {
            cout << "Yes\n" ;
            continue ;
        }
        if ( i > 1 ) {
            x = get_lca ( x , a[ i ] ) ;
            if ( LCA[ a[ i ] ][ 0 ] != x ) {
                cout << "No\n" ;
                continue ;
            }
        }
        set < int > children ;
        while ( i <= k ) {
            if ( in_sub ( a[ i ] ) > 0 ) {
                good = false ;
                break ;
            }
            if ( LCA[ a[ i ] ][ 0 ] != x ) {
                good = false ;
                break ;
            }
            if ( children.find ( a[ i ] ) != children.end ( ) ) {
                good = false ;
                break ;
            }
            children.insert ( a[ i ] ) ;
            if ( i + sub[ a[ i ] ] - 1 <= k ) {
                if ( rec_check ( a[ i ] , i , i + sub[ a[ i ] ] - 1 ) == false ) {
                    good = false ;
                    break ;
                }
                i += sub[ a[ i ] ] ;
            }
            else {
                children.clear ( ) ;
                x = a[ i ] ;
                ++ i ;
            }
        }
        if ( good == false ) { cout << "No\n" ; }
        else { cout << "Yes\n" ; }
    }
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    int t = 1 ; // cin >> t ;
    while ( t -- ) { solve ( ) ; }
    return 0 ;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5940kb

input:

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

output:

No
No
Yes
No
No
Yes
Yes

result:

ok 7 tokens

Test #2:

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

input:

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

output:

No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 100000 tokens

Test #3:

score: 0
Accepted
time: 59ms
memory: 6236kb

input:

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

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No...

result:

ok 95326 tokens

Test #4:

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

input:

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

output:

No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 64393 tokens

Test #5:

score: 0
Accepted
time: 49ms
memory: 6004kb

input:

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

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 48628 tokens

Test #6:

score: 0
Accepted
time: 51ms
memory: 6016kb

input:

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

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 39193 tokens

Test #7:

score: 0
Accepted
time: 38ms
memory: 6068kb

input:

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

output:

No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #8:

score: 0
Accepted
time: 35ms
memory: 5904kb

input:

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

output:

No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #9:

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

input:

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

output:

No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #10:

score: 0
Accepted
time: 40ms
memory: 6180kb

input:

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

output:

No
No
No
No
Yes
No
No
Yes
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
...

result:

ok 100000 tokens

Test #11:

score: 0
Accepted
time: 34ms
memory: 5952kb

input:

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

output:

No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No...

result:

ok 100000 tokens

Test #12:

score: 0
Accepted
time: 63ms
memory: 6008kb

input:

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

output:

No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
N...

result:

ok 95326 tokens

Test #13:

score: 0
Accepted
time: 54ms
memory: 6256kb

input:

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

output:

No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 64393 tokens

Test #14:

score: 0
Accepted
time: 50ms
memory: 6008kb

input:

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

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 48628 tokens

Test #15:

score: 0
Accepted
time: 52ms
memory: 6180kb

input:

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

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 39193 tokens

Test #16:

score: 0
Accepted
time: 30ms
memory: 6208kb

input:

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

output:

No
No
Yes
No
Yes
No
No
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes...

result:

ok 100000 tokens

Test #17:

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

input:

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

output:

Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
Y...

result:

ok 100000 tokens

Test #18:

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

input:

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

output:

Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #19:

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

input:

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

output:

Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Y...

result:

ok 100000 tokens

Test #20:

score: 0
Accepted
time: 35ms
memory: 6004kb

input:

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

output:

No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
No
Yes
Yes
Yes
No
Ye...

result:

ok 100000 tokens

Test #21:

score: 0
Accepted
time: 52ms
memory: 6236kb

input:

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

output:

No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
No
Yes...

result:

ok 100000 tokens

Test #22:

score: 0
Accepted
time: 71ms
memory: 6076kb

input:

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

output:

Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
No
Yes
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
No
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
No
Yes
No
No...

result:

ok 100000 tokens

Test #23:

score: 0
Accepted
time: 79ms
memory: 5948kb

input:

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

output:

Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
Y...

result:

ok 92713 tokens

Test #24:

score: 0
Accepted
time: 79ms
memory: 6216kb

input:

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

output:

No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
No
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
No
Yes
No
No
No
No
Yes
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
No
No
No
Yes
No
Yes
No
Yes
No...

result:

ok 75394 tokens

Test #25:

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

input:

100000 100000
22031 19709
79977 20677
72195 10689
88600 65820
9422 9595
3821 93983
96434 92645
72154 63751
88298 50712
58441 10216
66429 11541
80376 50932
50750 3251
39637 9534
35886 1323
34267 26052
61878 74481
49528 38924
69738 16187
99731 43694
18246 31836
68871 3281
17124 1158
95557 48000
65959 ...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 100000 tokens

Test #26:

score: 0
Accepted
time: 75ms
memory: 19068kb

input:

100000 100000
6390 17242
19936 20882
46229 37775
87701 45891
93858 43746
24030 30025
21273 3891
8969 19204
31507 99402
31610 22619
57908 71859
86596 48565
69684 42945
81569 46463
11482 1436
69395 25798
83954 12570
38345 22133
99955 65046
47955 34204
37747 85317
19733 67085
12058 1916
8229 88515
3055...

output:

No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 100000 tokens

Test #27:

score: 0
Accepted
time: 67ms
memory: 18872kb

input:

100000 100000
65796 41231
47215 20437
14648 92497
7368 16204
1057 12939
57423 58031
90889 26728
19075 73300
16433 75923
44452 80414
69850 59598
99777 15742
35503 49371
20702 80793
88570 51926
92517 94171
37244 20383
29247 19506
81624 62559
2926 63517
96697 65725
29639 38173
74903 34618
313 16309
299...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #28:

score: 0
Accepted
time: 71ms
memory: 19148kb

input:

100000 100000
49565 66073
21944 4457
28322 40724
77401 81004
433 54017
3920 51304
21061 36288
14752 22530
92090 5883
9978 78398
92537 35543
88335 45607
83800 53358
77729 40863
1541 42486
96162 58764
41980 21524
83274 15162
84917 67941
74664 63431
54624 33582
35792 18967
29901 70394
38286 61456
86428...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #29:

score: 0
Accepted
time: 67ms
memory: 19232kb

input:

100000 100000
1766 4748
32844 9107
73356 52002
29127 35776
77551 96310
6586 12633
931 30529
97055 93805
71514 17120
15322 89816
48447 85139
69178 18689
88038 53343
18983 2203
31527 99630
92008 23951
82997 93138
74484 96972
36465 83542
10207 38726
70768 90541
6516 33979
57143 27898
2602 94702
72636 2...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 100000 tokens

Test #30:

score: 0
Accepted
time: 174ms
memory: 20544kb

input:

100000 100000
38656 38649
49244 49240
72097 72092
16362 16367
89712 89708
31833 31828
1776 1769
28913 28906
61888 61878
7131 7124
28437 28442
20338 20329
68540 68539
31334 31328
83244 83234
6344 6343
53941 53948
78386 78388
40417 40413
97136 97140
17048 17039
74885 74879
37932 37939
72242 72240
9052...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #31:

score: 0
Accepted
time: 189ms
memory: 19296kb

input:

100000 100000
91113 91209
82125 82196
17061 17030
63492 63450
86825 86766
20090 20048
98842 98857
83335 83270
8996 9015
65800 65720
49122 49155
84038 84135
45583 45609
71664 71592
80151 80184
55978 56066
84122 84142
47884 47984
6616 6659
24124 24141
44203 44230
88031 87936
21094 21143
52361 52425
93...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #32:

score: 0
Accepted
time: 198ms
memory: 18984kb

input:

100000 100000
50728 50654
44261 45163
22208 22565
58688 58373
32612 33030
71660 71873
89913 89664
75805 76744
71503 71934
27322 28111
55812 55356
33720 32754
48440 48264
41048 41781
93214 94182
17629 17722
17561 18146
28329 27383
98169 98356
1216 1055
84703 84515
2881 2084
87390 88222
21264 21663
43...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #33:

score: 0
Accepted
time: 200ms
memory: 18852kb

input:

100000 100000
31222 33552
41521 44119
50990 49903
44464 43003
15190 22921
47485 53253
74261 79380
85164 93724
59780 55724
93738 98324
63895 60609
21017 18180
433 773
93075 97786
8027 11031
12196 12724
97981 90548
96946 87968
93529 86667
20125 16341
63577 54107
90336 99374
52847 52441
35212 35612
691...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #34:

score: 0
Accepted
time: 208ms
memory: 18988kb

input:

100000 100000
12095 71885
9520 19536
6341 58535
9549 31319
17658 31062
26096 84345
55575 98102
41278 39200
54189 4024
9555 15722
84991 33220
57827 29323
17571 57697
89020 37327
13499 12471
15923 46106
46684 27028
68544 94977
72265 95916
25582 17437
84373 12019
40053 70207
30578 14849
99726 5741
8896...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #35:

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

input:

100000 100000
58286 1
92801 1
1 23835
31111 1
63517 1
1 64597
85533 1
22562 1
1 88412
75722 1
1 59697
92715 1
1 81332
74340 1
871 1
1 21972
1 54497
66797 1
10937 1
1 80448
29777 1
8287 1
1 65626
82496 1
88110 1
81770 1
79830 1
64455 1
1 5287
54867 1
19241 1
84920 1
40595 1
1 91660
86005 1
9536 1
1 4...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #36:

score: 0
Accepted
time: 57ms
memory: 18916kb

input:

100000 100000
1 31153
1 70648
65640 2
2 42097
1 30566
79120 79118
79694 79695
1 15175
58998 58996
46344 2
60522 1
69811 69809
2 10516
2 29288
84465 2
43108 2
46861 1
1 79362
85016 1
2 33704
2 65391
83512 83511
96951 1
62813 62814
1 80646
2 54179
88522 88521
29945 2
57863 2
2 22120
86745 1
8607 2
325...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #37:

score: 0
Accepted
time: 66ms
memory: 19084kb

input:

100000 100000
4 6165
61280 61285
79316 79317
75138 75139
3294 3
1 81489
10503 4
11462 4
95690 95693
6053 2
3 34295
66316 66320
9365 4
35707 5
2 4704
1 51638
13980 4
17619 5
14348 5
1 1157
38076 3
99377 99376
42362 3
58971 58969
2 48323
70177 3
5 10946
76634 76633
1 97298
5 44538
77954 1
16166 4
7346...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #38:

score: 0
Accepted
time: 75ms
memory: 19160kb

input:

100000 100000
69019 69027
10 20115
79300 79296
66171 66164
98706 98700
4 47454
57286 57289
78954 78960
92664 92658
5 24956
1 3044
55786 55795
73188 8
9 2296
67932 67937
8528 9
81852 81842
33011 10
51298 51293
67010 2
95125 95119
54265 4
1 35228
61407 61406
82568 82562
3 26672
5 16416
74458 74467
296...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #39:

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

input:

100000 100000
35 23329
87458 87437
35 99794
57784 57747
39576 3
76333 76305
49205 29
2218 21
65211 65244
36543 48
96822 96776
10507 12
77139 77096
17 337
11 19269
63630 63601
26 2484
23942 26
6 19197
89865 89888
87821 87823
15698 22
2617 8
38048 3
37076 28
17 2205
66500 66504
51236 51277
86214 86203...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #40:

score: 0
Accepted
time: 81ms
memory: 19224kb

input:

100000 100000
46 29253
32 11065
75112 75016
97872 97943
83462 83559
55450 55378
2 14708
89044 88960
98802 98709
88777 88765
83571 83601
37363 60
57778 57821
12825 71
42 13650
68 27305
9 25066
52407 52445
92990 92923
79698 79702
38704 66
75102 75030
64 3133
47898 1
3047 64
41 46208
51715 51738
93 669...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #41:

score: 0
Accepted
time: 69ms
memory: 24896kb

input:

100000 100000
64269 64268
66535 66536
9759 9758
42907 42908
80000 84213
80000 83489
27749 27748
86199 80000
80000 80659
11615 11614
93420 1
2529 2528
96161 1
79473 79474
83518 80000
43109 43110
37111 37112
46604 46603
1 93666
54540 54541
84237 80000
62717 62718
24720 24719
57226 57225
8333 8334
1572...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100000 tokens

Test #42:

score: 0
Accepted
time: 160ms
memory: 19272kb

input:

100000 37
29162 63623
96664 54044
11535 67257
10642 29054
10206 58115
95878 4300
94836 69937
78765 28295
22874 53200
43075 87524
13107 77611
7813 13031
51591 40743
7168 67498
25699 32495
7125 37661
28803 9718
18154 16537
86140 56605
89290 3771
36638 63730
57297 68534
25220 8566
98229 56905
48005 462...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 37 tokens

Test #43:

score: 0
Accepted
time: 153ms
memory: 19276kb

input:

100000 33
60074 18401
35678 11648
38252 92824
51971 94160
24926 70750
19026 46634
14302 30542
40772 16995
74011 54458
39554 11112
15458 2470
40516 48499
47136 92413
74957 81119
86949 69165
2914 22736
93669 29627
81851 64391
96131 18955
85414 48801
11987 81925
44883 43397
57347 15860
25315 42763
2252...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 33 tokens

Test #44:

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

input:

1 1
1 1

output:

Yes

result:

ok "Yes"

Extra Test:

score: 0
Extra Test Passed