QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#188235#7232. Odd Grammarucup-team004AC ✓101ms24696kbC++202.5kb2023-09-25 17:10:022023-09-25 17:10:02

Judging History

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

  • [2023-09-25 17:10:02]
  • 评测
  • 测评结果:AC
  • 用时:101ms
  • 内存:24696kb
  • [2023-09-25 17:10:02]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n, m;
    while (std::cin >> n >> m && n) {
        std::vector<int> len(n, -1);
        std::vector<bool> both(n);
        std::vector<int> A(m), l(m), deg(m);
        std::vector<std::vector<int>> e1(n), B(m), e0(n);
        for (int i = 0; i < m; i++) {
            std::cin >> A[i];
            A[i]--;
            int k;
            std::cin >> k;
            while (k--) {
                std::string s;
                std::cin >> s;
                if (s == "a" || s == "b") {
                    l[i] ^= 1;
                } else {
                    int x = std::stoi(s) - 1;
                    e1[x].push_back(i);
                    B[i].push_back(x);
                    deg[i]++;
                }
            }
            e0[A[i]].push_back(i);
        }
        
        std::queue<int> q;
        for (int i = 0; i < m; i++) {
            if (deg[i] == 0) {
                q.push(i);
            }
        }
        while (!q.empty()) {
            int i = q.front();
            q.pop();
            
            int x = A[i];
            if (len[x] == -1) {
                len[x] = l[i];
                for (auto j : e1[x]) {
                    deg[j]--;
                    l[j] ^= len[x];
                    if (deg[j] == 0) {
                        q.push(j);
                    }
                }
            } else if (len[x] != l[i]) {
                both[x] = true;
            }
        }
        
        bool ok = len[0] == 1;
        
        if (len[0] == 0) {
            std::queue<int> q;
            std::vector<bool> vis(n);
            q.push(0);
            vis[0] = true;
            while (!q.empty()) {
                int x = q.front();
                q.pop();
                
                if (both[x]) {
                    ok = true;
                    break;
                }
                for (auto i : e0[x]) {
                    if (deg[i] == 0) {
                        for (auto y : B[i]) {
                            if (!vis[y]) {
                                q.push(y);
                                vis[y] = true;
                            }
                        }
                    }
                }
            }
        }
        
        std::cout << (ok ? "YES" : "NO") << "\n";
    }
    
    return 0;
}

详细

Test #1:

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

input:

2 2
1 2 a 2
2 1 b
2 2
1 2 b 2
2 2 a a
2 2
1 2 b 2
2 3 a a 1
0 0

output:

NO
YES
NO

result:

ok 3 token(s): yes count is 1, no count is 2

Test #2:

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

input:

1 1
1 0
1 1
1 1 a
1 1
1 1 b
1 1
1 1 1
1 2
1 2 1 a
1 1 b
2 4
1 2 2 a
1 0
2 2 1 b
2 0
2 4
1 2 2 b
1 0
2 2 1 a
2 0
0 0

output:

NO
YES
YES
NO
YES
YES
YES

result:

ok 7 token(s): yes count is 5, no count is 2

Test #3:

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

input:

5 6
1 1 2
2 1 3
3 1 4
4 1 5
5 2 a 1
5 10 b b b b b b b b b b
3 3
1 1 b
2 1 a
2 2 2 a
0 0

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #4:

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

input:

1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
...

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 50000 token(s): yes count is 0, no count is 50000

Test #5:

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

input:

1 1
1 0
1 1
1 1 b
1 1
1 1 1
1 1
1 0
1 1
1 0
1 1
1 1 b
1 1
1 0
1 1
1 1 b
1 1
1 1 b
1 1
1 0
1 1
1 1 a
1 1
1 1 1
1 1
1 0
1 1
1 1 b
1 1
1 0
1 1
1 1 b
1 1
1 1 1
1 1
1 1 1
1 1
1 1 1
1 1
1 0
1 1
1 0
1 1
1 1 1
1 1
1 1 a
1 1
1 0
1 1
1 1 b
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 0
1 1
1 1 b
1 1
1 0
1 1
1 0
1 1
1 0
1 1
...

output:

NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
N...

result:

ok 50000 token(s): yes count is 16576, no count is 33424

Test #6:

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

input:

2 1
2 1 2
2 1
2 0
2 2
2 0
1 0
2 2
2 0
2 0
2 1
1 0
1 1
1 1 a
2 1
1 0
2 1
1 0
2 2
1 0
1 0
2 2
2 0
1 0
2 1
2 1 a
2 1
1 1 b
1 1
1 1 b
1 2
1 0
1 0
1 2
1 0
1 1 1
1 1
1 1 b
2 2
1 1 b
1 1 a
2 2
2 0
2 0
2 1
1 1 1
1 2
1 1 b
1 0
2 1
2 0
1 2
1 0
1 1 1
1 1
1 0
1 1
1 1 1
1 2
1 1 a
1 1 b
1 1
1 1 1
2 2
1 1 2
2 1 b
...

output:

NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
YES
NO
Y...

result:

ok 33265 token(s): yes count is 10556, no count is 22709

Test #7:

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

input:

2 2
2 2 a 1
1 2 1 1
1 2
1 1 b
1 2 b a
2 2
2 1 a
1 0
2 2
2 2 b a
2 0
1 1
1 1 b
2 2
2 1 2
1 2 a 2
1 2
1 2 b b
1 0
1 1
1 2 a b
2 2
1 1 b
1 1 b
1 2
1 0
1 0
2 1
2 2 2 1
1 1
1 1 b
2 2
1 2 2 1
1 1 1
2 1
2 0
2 2
2 2 a b
1 1 b
1 1
1 0
1 2
1 2 a a
1 0
2 1
2 0
2 2
2 0
2 2 b 2
2 1
2 2 a 2
1 1
1 2 b a
2 1
1 1 a
...

output:

NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO...

result:

ok 33335 token(s): yes count is 8671, no count is 24664

Test #8:

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

input:

2 2
2 2 b 2
1 0
2 2
2 1 b
1 1 a
1 1
1 1 b
1 2
1 0
1 3 1 b a
1 1
1 0
1 1
1 3 b 1 a
2 1
1 2 1 2
1 2
1 0
1 2 b 1
1 1
1 2 b b
1 1
1 3 1 b 1
1 2
1 3 a b b
1 3 1 b a
1 1
1 0
2 2
1 2 1 2
2 3 1 b 1
1 2
1 0
1 3 1 1 a
2 2
1 0
2 2 2 2
1 1
1 1 1
2 2
1 3 a 1 b
1 1 1
2 1
2 0
2 1
2 1 2
2 2
1 2 a b
1 2 a b
2 1
1 2 ...

output:

NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
...

result:

ok 33369 token(s): yes count is 8967, no count is 24402

Test #9:

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

input:

1 1
1 5 b b a 1 a
1 1
1 24 a 1 a 1 1 b 1 1 1 1 1 b a b b b a b a a 1 b 1 b
1 1
1 74 1 b 1 b b b b b 1 b 1 a a a a a 1 a b a a a 1 1 1 a 1 a 1 1 a b 1 1 b 1 b a 1 a 1 b a b 1 1 a b b b a a b 1 b a b 1 1 b b 1 a 1 1 b 1 b b 1 1 1 b 1
1 1
1 44 b 1 1 b b b a 1 b b b b b a b a b a 1 a b a b b b b 1 a b 1...

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
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
N...

result:

ok 45232 token(s): yes count is 532, no count is 44700

Test #10:

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

input:

1 2
1 27 1 a 1 b a a 1 b a a 1 a b 1 1 b a 1 1 1 a b a b 1 b b
1 23 b b 1 b 1 b b a a b b 1 1 b b 1 b 1 1 1 b 1 b
2 2
2 53 b 2 b 2 1 2 b b 2 2 b 1 a 2 a 2 b 2 b 2 2 b a b b a a 2 1 b a 1 2 b 2 1 a a 1 b 1 b b a 1 2 b 2 b a 2 b a
1 94 1 2 1 2 1 1 2 2 1 a b a 1 a b a 2 1 a 1 a b 2 a 2 a b 1 2 2 b 1 a ...

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 30661 token(s): yes count is 500, no count is 30161

Test #11:

score: 0
Accepted
time: 26ms
memory: 3560kb

input:

2 5
1 0
1 2 b a
2 1 b
2 1 b
1 3 a a a
1 4
1 1 b
1 1 b
1 2 1 1
1 3 b b a
2 2
2 1 2
2 3 2 1 2
1 1
1 3 1 a b
3 5
1 0
3 0
3 2 a a
3 3 3 3 2
1 3 b 1 b
3 3
2 0
3 2 a 3
1 3 a 1 b
3 3
1 1 b
2 3 b a a
2 3 2 a 3
1 1
1 2 b b
2 7
2 1 1
2 3 b 1 b
1 3 b 2 b
2 3 a 2 1
1 2 b a
1 1 2
2 2 2 1
1 1
1 3 b b 1
2 6
2 0
2 ...

output:

YES
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
N...

result:

ok 25012 token(s): yes count is 12457, no count is 12555

Test #12:

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

input:

3 2
1 0
3 3 3 1 2
4 8
4 2 b 4
1 0
2 3 b 2 1
1 2 1 3
2 2 b 4
1 0
3 2 a 2
3 3 b 4 4
1 6
1 4 a b 1 a
1 4 a 1 a a
1 2 1 1
1 4 a b 1 a
1 3 b a a
1 3 1 a b
1 3
1 1 1
1 4 1 a b a
1 3 a b a
1 8
1 4 b b 1 a
1 2 a b
1 3 b b 1
1 0
1 3 1 b a
1 1 b
1 1 b
1 0
3 3
1 2 3 b
1 2 1 2
2 3 b b 3
2 2
1 4 a 2 a a
1 1 2
3 ...

output:

NO
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES...

result:

ok 19952 token(s): yes count is 8565, no count is 11387

Test #13:

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

input:

5 7
3 1 5
1 0
5 0
5 2 2 4
3 2 a 1
3 0
4 0
4 9
4 3 2 2 4
1 3 3 3 4
1 3 a 3 a
1 0
4 3 1 2 a
1 2 4 3
1 1 b
1 2 2 b
2 2 3 a
1 2
1 3 1 a 1
1 0
3 2
1 2 1 3
2 2 3 a
3 4
3 3 b 2 a
1 3 a a 2
1 1 b
1 0
4 10
4 1 2
2 0
3 3 b 4 a
1 2 a 4
4 0
4 1 4
2 1 2
2 3 3 1 4
3 1 1
4 1 1
3 5
1 0
1 0
2 2 3 3
3 0
1 3 1 b b
3 1...

output:

NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
YE...

result:

ok 16740 token(s): yes count is 7821, no count is 8919

Test #14:

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

input:

5 10
3 1 3
2 1 b
3 2 3 5
5 3 b 2 4
2 1 2
3 3 2 5 1
1 0
1 3 a b b
1 3 4 b 2
3 2 5 2
5 10
3 3 1 b 1
3 0
1 3 b 3 a
2 2 1 3
4 0
4 0
3 3 a 1 1
1 2 3 b
5 2 4 5
1 2 1 2
5 10
4 0
1 2 3 b
3 3 2 1 1
4 0
1 1 2
1 1 b
1 1 4
3 2 4 1
1 0
2 1 1
5 10
1 0
2 0
1 3 3 1 1
5 1 5
5 2 2 4
2 2 3 2
3 3 1 5 2
5 1 4
5 3 4 b 4
...

output:

YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
YES...

result:

ok 10000 token(s): yes count is 4635, no count is 5365

Test #15:

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

input:

6 15
6 2 3 1
5 3 3 3 1
3 3 2 4 4
3 3 3 1 b
2 0
1 2 5 3
3 1 1
1 2 5 6
5 1 2
6 3 a a a
1 0
5 0
3 3 4 1 5
4 3 4 5 5
3 2 2 6
6 15
4 2 4 a
5 1 1
1 0
6 2 6 a
2 3 6 4 3
6 1 b
6 0
4 0
4 2 a a
2 1 2
5 2 b 3
1 1 2
4 3 1 a 4
6 3 a 1 6
2 0
6 15
5 0
3 2 3 5
6 1 a
3 0
1 3 5 1 1
2 0
1 2 a 6
2 3 6 4 4
6 0
3 2 5 2
5...

output:

YES
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
...

result:

ok 8333 token(s): yes count is 5394, no count is 2939

Test #16:

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

input:

7 20
5 1 4
4 3 6 4 3
4 2 a 7
7 3 5 4 5
2 2 4 4
2 1 2
5 4 b 7 6 3
5 4 7 b 3 2
3 4 7 6 3 4
4 2 7 3
1 4 5 2 5 1
5 4 3 3 1 b
7 3 7 b a
4 1 4
5 0
6 1 a
1 2 4 1
1 4 a 5 b 6
1 0
2 1 6
7 20
1 3 6 1 4
5 1 5
4 4 b 4 4 3
7 4 2 b 4 4
4 3 6 3 5
2 0
7 2 b 5
7 3 b 1 a
3 1 b
4 1 a
3 1 2
2 2 7 6
7 1 2
7 2 b b
5 4 7 ...

output:

YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO...

result:

ok 7142 token(s): yes count is 4989, no count is 2153

Test #17:

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

input:

8 15
8 1 5
5 3 a a a
3 3 2 4 8
2 0
6 2 5 5
8 0
6 2 7 2
2 3 3 5 8
1 2 2 3
4 1 7
8 2 a 8
5 1 8
1 0
4 0
4 3 1 1 b
8 15
3 0
6 2 5 6
5 0
6 2 5 4
1 3 a 8 6
5 0
6 2 b 7
1 3 8 4 b
8 3 5 a a
8 3 8 8 8
8 3 6 6 6
1 3 3 b 3
5 2 3 3
7 1 a
5 2 b 7
8 15
4 1 4
6 0
5 3 b b 4
4 3 8 4 4
8 3 a 2 3
1 2 1 a
1 3 6 3 a
8 3...

output:

YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES...

result:

ok 6250 token(s): yes count is 2450, no count is 3800

Test #18:

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

input:

8 15
1 3 2 a 5
8 2 5 6
8 2 6 b
8 3 6 3 5
2 4 b a 5 a
1 2 4 a
5 4 1 7 5 b
2 3 4 2 2
1 2 1 2
5 1 6
8 0
5 4 1 2 4 2
7 4 1 1 2 1
7 4 5 3 8 6
8 0
8 15
1 2 a 2
2 1 7
5 2 4 1
1 0
2 2 1 6
5 4 a 6 5 a
2 0
6 2 4 7
3 2 3 7
6 4 6 1 a 8
2 1 4
8 4 4 2 7 a
8 1 1
3 0
1 0
8 15
4 2 a a
8 3 6 2 5
7 4 7 2 a 5
3 1 7
4 4...

output:

NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
YES
N...

result:

ok 6250 token(s): yes count is 2019, no count is 4231

Test #19:

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

input:

7 17
2 2 7 4
5 1 3
7 3 7 7 4
7 1 5
3 2 5 6
4 3 2 5 7
3 0
4 2 b b
1 0
6 1 1
4 3 1 4 6
7 1 7
3 3 1 2 5
3 1 7
3 2 6 a
2 3 b a 4
1 0
7 17
7 3 6 b 3
7 0
7 0
7 2 2 a
3 3 a 4 5
1 0
7 2 2 2
5 0
4 0
3 0
6 3 a 1 a
5 3 5 2 2
2 2 b 7
2 2 3 3
1 2 5 b
6 1 3
7 3 b 7 3
7 17
4 2 7 7
3 1 b
4 2 b 2
7 0
6 3 1 2 7
7 1 2...

output:

NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
...

result:

ok 7142 token(s): yes count is 4541, no count is 2601

Test #20:

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

input:

9 14
5 2 2 2
1 1 5
2 3 7 9 9
7 1 b
4 1 a
4 0
9 3 5 5 8
5 0
7 2 8 1
4 2 3 7
6 2 b 1
2 1 3
9 2 a 7
5 2 9 b
9 14
6 0
9 0
7 1 4
2 0
4 2 3 1
1 0
6 0
3 2 7 3
9 2 2 1
7 1 5
7 0
8 1 4
1 3 4 a 5
9 2 9 5
9 14
9 0
5 3 b b 7
2 1 6
7 3 5 3 3
3 3 2 7 5
1 0
4 0
1 3 a 4 1
6 0
5 2 a 6
6 3 6 4 2
4 2 5 2
7 0
9 3 8 4 4...

output:

YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
N...

result:

ok 5555 token(s): yes count is 1462, no count is 4093

Test #21:

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

input:

10 16
6 2 9 a
6 2 4 10
6 1 9
1 0
9 1 4
10 1 3
10 0
6 0
5 2 9 b
8 1 8
2 0
2 2 a 3
3 1 4
3 0
9 0
10 2 7 7
10 16
9 1 b
10 1 7
8 2 9 1
10 0
6 1 1
2 1 10
4 1 1
6 0
4 2 9 9
7 0
2 0
1 2 a a
6 2 7 b
3 1 10
5 0
6 2 a 6
10 16
9 2 a a
9 1 10
5 2 10 2
8 1 4
7 2 6 2
9 2 6 7
3 0
4 1 3
7 1 b
5 2 6 6
8 2 8 6
7 1 7
...

output:

NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO...

result:

ok 5000 token(s): yes count is 1499, no count is 3501

Test #22:

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

input:

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

output:

YES
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
NO
YES
N...

result:

ok 2500 token(s): yes count is 1046, no count is 1454

Test #23:

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

input:

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

output:

YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
...

result:

ok 2000 token(s): yes count is 1666, no count is 334

Test #24:

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

input:

5 4
2 2 3 a
4 4 a 3 b a
1 9 2 1 4 4 4 5 b b 4
4 3 5 3 4
4 10
2 6 2 4 a b 3 2
2 1 b
2 3 b a 1
2 5 3 1 a 4 4
4 7 1 b 1 4 2 2 3
4 6 3 2 b 4 3 3
4 1 1
2 3 b a 4
4 8 4 a 3 2 4 b 3 a
4 8 b 4 b 3 4 4 2 1
2 8
2 2 1 2
1 5 2 2 b b 1
2 5 a a 1 b b
1 10 a 1 b a 1 b 1 b 1 a
2 4 a a b 2
1 0
2 8 b a a 1 2 1 a a
1 ...

output:

NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
...

result:

ok 16690 token(s): yes count is 4650, no count is 12040

Test #25:

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

input:

5 3
5 73 a 5 4 2 a 3 1 4 4 1 b 3 4 b 3 4 4 5 5 2 b 1 5 a 2 a b 5 1 5 b 5 a a 4 b 3 a b a 1 b b a 5 2 3 1 a 4 a 3 5 3 b b 5 b 5 a 4 1 3 2 b b b 5 a a 5 1 3
5 79 1 a a 4 b 2 a 4 3 a 4 a 2 4 b a 4 1 1 2 2 3 a 4 5 5 b a b 2 1 b 5 5 b b a a 3 3 1 3 1 1 5 1 5 b 5 b 1 4 5 4 4 2 4 2 4 b a b a 4 2 b 2 3 1 2 ...

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
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
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
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 8453 token(s): yes count is 327, no count is 8126

Test #26:

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

input:

5 12
1 7 2 2 1 b 5 b 3
3 4 1 a 1 3
3 9 b a a 2 b 4 2 4 3
3 1 a
2 2 1 a
2 7 2 b 4 5 5 1 b
5 9 3 b 3 4 b 3 1 1 b
3 1 2
4 7 2 3 a a 2 2 b
4 0
1 0
2 7 b 3 1 5 4 a 2
2 9
2 1 2
1 10 1 a a b 2 b a 1 a b
1 5 b b b 1 2
2 6 b b a 1 b 2
2 10 b 2 1 b a 2 2 b b 2
2 5 2 b b 1 a
1 5 a a a a 1
2 5 b a a 1 b
2 6 b a...

output:

YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
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
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
N...

result:

ok 9098 token(s): yes count is 1946, no count is 7152

Test #27:

score: 0
Accepted
time: 80ms
memory: 4032kb

input:

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

output:

YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
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
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
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
...

result:

ok 135 token(s): yes count is 33, no count is 102

Test #28:

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

input:

47 6640
45 11 28 5 27 26 14 39 43 19 18 32 21
12 65 9 35 23 38 29 47 31 30 39 17 a 40 35 24 8 39 34 24 33 a 12 43 21 23 10 b 45 28 46 6 44 24 19 1 31 18 20 28 14 43 45 11 25 44 46 37 16 7 32 14 12 34 22 26 30 14 36 9 b 38 21 46 25 44 b
17 74 5 14 36 7 31 36 24 40 31 47 2 20 40 34 4 b 23 39 33 6 29 1...

output:

YES
YES
YES
YES

result:

ok 4 token(s): yes count is 4, no count is 0

Test #29:

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

input:

37 7545
5 92 18 19 14 a 20 21 15 11 34 8 22 16 22 27 32 4 20 26 35 1 9 1 25 21 31 b 2 33 11 33 2 9 3 4 a 4 18 22 a 10 5 26 21 8 27 2 29 9 17 a 1 9 28 4 30 21 10 24 30 25 21 27 14 19 37 32 6 12 37 12 24 28 26 21 37 8 33 5 23 35 2 6 27 7 35 29 13 19 29 12 30 17
34 57 b 18 21 11 10 14 24 8 3 20 34 19 3...

output:

YES
YES
YES
NO
YES

result:

ok 5 token(s): yes count is 4, no count is 1

Test #30:

score: 0
Accepted
time: 64ms
memory: 8984kb

input:

13 7275
12 32 6 9 3 6 4 2 8 b 13 8 6 13 11 9 6 a a 8 10 11 1 3 11 12 11 10 9 4 11 6 10 10
2 88 6 10 1 1 7 9 9 7 11 11 2 4 11 2 8 3 3 9 11 b 5 13 a 10 1 8 8 9 12 1 3 4 10 13 10 3 9 11 10 2 7 13 3 8 2 a 12 13 11 11 11 4 1 13 2 12 8 b 8 9 2 3 4 a 5 13 2 4 12 6 12 2 a 8 b 10 5 b b 13 13 9 10 b 9 11 2 b
...

output:

YES
YES
NO
YES
YES
NO

result:

ok 6 token(s): yes count is 4, no count is 2

Test #31:

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

input:

84 1626
44 45 33 11 50 45 18 57 58 42 7 82 27 2 81 74 55 32 22 79 59 13 12 75 26 61 78 18 64 36 22 4 34 6 57 50 63 5 22 41 33 29 9 23 16 66 49
40 1 53
64 23 49 72 18 83 78 73 71 15 36 6 71 25 74 3 28 73 50 45 81 17 23 6 23
10 92 75 8 51 33 46 16 34 16 6 34 18 54 56 47 54 41 71 39 20 40 32 1 75 1 23 ...

output:

NO
YES
YES
YES
YES
YES
YES

result:

ok 7 token(s): yes count is 6, no count is 1

Test #32:

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

input:

6 2511
1 8 b 1 1 4 a 1 1 b
5 49 1 6 6 b 3 3 5 6 a 6 1 2 4 6 b 4 3 4 3 4 4 1 6 1 3 b 4 b 2 1 1 b a 5 a 5 2 5 6 b 6 5 a 2 3 b a 6 a
1 56 3 1 5 6 2 5 4 b 1 6 4 a 5 6 6 2 5 b 4 1 1 4 3 4 1 1 6 5 6 a a 3 2 1 1 1 a 5 5 a a b 4 6 3 4 4 4 2 3 1 5 b 2 6 2
1 84 a 6 5 5 3 b 1 4 3 4 2 2 3 3 3 4 b 4 6 2 a b 5 5 ...

output:

YES
NO
YES
NO
NO
NO
NO
NO
YES

result:

ok 9 token(s): yes count is 3, no count is 6

Test #33:

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

input:

88 4377
2 33 39 50 59 62 5 87 68 21 44 7 45 73 59 60 55 15 79 64 82 47 69 17 41 2 23 11 52 87 1 57 9 58 21
40 70 82 21 72 16 60 2 56 84 60 50 17 83 43 79 27 81 43 33 10 55 48 78 2 54 2 85 64 55 24 66 67 37 38 6 49 43 75 88 55 62 7 86 24 87 81 7 62 67 46 75 21 35 30 b 71 71 20 29 11 3 55 29 24 56 a 4...

output:

YES
NO
YES
YES
YES
YES

result:

ok 6 token(s): yes count is 5, no count is 1

Test #34:

score: 0
Accepted
time: 76ms
memory: 8200kb

input:

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

output:

YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO

result:

ok 11 token(s): yes count is 6, no count is 5

Test #35:

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

input:

63 8424
58 15 4 15 59 27 9 b 34 47 60 51 23 9 17 13 b
36 97 61 37 24 15 42 51 12 33 8 27 34 36 19 54 20 9 52 4 34 41 60 29 37 62 60 19 21 37 56 35 49 12 60 48 28 a 19 40 38 38 52 48 32 47 1 28 34 48 26 37 33 30 7 41 2 13 b 11 44 14 8 43 38 27 21 19 16 45 55 21 57 b 35 17 59 41 52 34 46 55 8 a 9 60 5...

output:

YES
YES
YES
YES
NO
NO
YES

result:

ok 7 token(s): yes count is 5, no count is 2

Test #36:

score: 0
Accepted
time: 60ms
memory: 8044kb

input:

99 5030
28 57 68 36 82 89 36 35 79 63 34 71 b 48 12 94 92 8 11 30 91 73 31 8 28 42 60 97 35 83 22 95 63 66 92 65 62 68 6 75 80 92 54 9 26 35 69 22 61 74 19 7 47 42 3 74 43 94 57
19 73 47 55 75 99 45 29 56 63 27 25 34 a 84 76 17 87 53 90 5 42 97 44 77 65 12 64 53 94 77 52 72 17 48 43 45 21 9 1 29 44 ...

output:

YES
YES
NO
YES
YES
NO

result:

ok 6 token(s): yes count is 4, no count is 2

Test #37:

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

input:

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

output:

YES
YES
YES
YES
YES

result:

ok 5 token(s): yes count is 5, no count is 0

Test #38:

score: 0
Accepted
time: 77ms
memory: 11584kb

input:

35 47302
15 20 25 29 22 20 35 28 4 3 19 5 3 10 b 28 8 21 7 28 5 5
26 10 20 16 29 34 35 11 b 35 1 7
19 19 9 20 4 28 10 6 1 2 15 17 34 25 31 22 6 1 6 7 9
3 23 7 6 19 34 1 b 13 34 2 25 12 17 1 32 14 34 8 3 14 11 9 7 1
12 14 35 13 25 15 1 31 9 33 22 1 7 7 17 35
32 24 13 34 11 34 3 15 27 35 24 31 4 20 30...

output:

YES
YES
YES
YES
YES

result:

ok 5 token(s): yes count is 5, no count is 0

Test #39:

score: 0
Accepted
time: 55ms
memory: 18480kb

input:

100 50000
25 41 75 47 21 13 82 85 40 85 50 60 1 60 72 96 10 85 62 68 22 97 15 26 67 57 67 84 100 1 a 65 7 50 8 71 100 52 38 59 78 37 73
34 12 78 51 34 95 34 2 25 6 42 93 7 43
34 1 100
21 31 85 29 69 5 67 58 97 40 41 94 78 96 54 48 42 90 69 52 34 100 27 19 89 83 23 41 18 8 40 46 30
25 20 63 9 85 99 8...

output:

YES

result:

ok YES

Test #40:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #41:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #42:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #43:

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

input:

99 99
1 2 2 51
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #44:

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

input:

99 99
1 3 2 51 a
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #45:

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

input:

99 99
1 3 2 51 b
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #46:

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

input:

99 99
78 100 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
97 1 a
70 100 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 44 4...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #47:

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

input:

99 99
21 100 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73 73...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #48:

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

input:

99 99
97 100 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84 84...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #49:

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

input:

99 99
1 5 2 51 a a b
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #50:

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

input:

99 99
1 5 2 51 a b b
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #51:

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

input:

100 100
1 36 2 100 a a a a a a a a a a a a a a a a a b b b b b b b b b b b b b b b b b
2 100 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
3 100 4...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #52:

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

input:

100 100
1 36 2 3 a a a a a a a a a a a a a a a a a b b b b b b b b b b b b b b b b b
2 1 a
3 100 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
4 1...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #53:

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

input:

100 101
100 100 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1...

output:

YES

result:

ok YES

Test #54:

score: 0
Accepted
time: 53ms
memory: 13480kb

input:

100 17001
100 100 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...

output:

YES

result:

ok YES

Test #55:

score: 0
Accepted
time: 53ms
memory: 13380kb

input:

100 16831
100 100 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...

output:

NO

result:

ok NO

Test #56:

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

input:

100 101
100 100 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1...

output:

YES

result:

ok YES

Test #57:

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

input:

100 101
100 100 a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a
99 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 1...

output:

YES

result:

ok YES

Test #58:

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

input:

100 16831
66 100 a a a 94 94 a a 94 94 a a a a a a 94 94 a a 94 94 94 94 94 a 94 94 94 94 94 94 94 94 94 a a a 94 a a 94 94 a a a 94 a 94 a a a a a a a a a a a 94 a 94 a 94 94 a a 94 a 94 a a 94 94 a a 94 94 a 94 94 94 94 94 a 94 94 a a 94 a 94 94 a 94 94 a a 94 94
39 100 a a 80 a 80 a a 80 80 80 80...

output:

NO

result:

ok NO

Test #59:

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

input:

100 101
13 100 99 a a a a 99 99 a a 99 99 a 99 a a a a 99 99 99 a a 99 a a 99 a a 99 a a 99 99 a a a 99 99 a 99 a a a 99 99 99 a a 99 99 a a 99 a 99 99 99 a a a a a a a 99 99 99 99 99 99 99 a 99 a 99 a 99 99 99 99 99 a 99 a 99 a a 99 99 a 99 99 99 a a a a 99 a 99
15 100 a a 3 a a a a 3 3 a a 3 3 a 3...

output:

YES

result:

ok YES

Test #60:

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

input:

100 101
64 100 b b b b 75 75 b 75 75 75 b b b b 75 75 b b 75 b 75 b b 75 75 b b 75 75 75 b b 75 b b b b b 75 b b 75 75 b b 75 75 75 b 75 75 b b 75 75 75 75 75 b b b b 75 b b b b 75 75 b 75 b 75 75 75 75 b 75 75 b 75 b 75 b 75 75 b b 75 75 b b 75 b 75 75 b 75 75 b
22 100 64 b 64 64 64 b b b b 64 b b ...

output:

YES

result:

ok YES

Test #61:

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

input:

1128 177394
703 0
270 2 628 664
155 2 253 924
115 0
54 1 779
645 2 533 383
430 0
724 2 444 304
58 0
16 2 915 982
774 0
589 1 1061
504 0
587 1 462
990 0
1097 1 589
65 0
384 2 265 29
390 0
891 0
157 0
254 2 372 738
351 1 470
901 2 785 1109
99 1 951
166 0
697 1 633
873 2 344 1088
822 1 232
548 0
367 2 ...

output:

YES
NO

result:

ok 2 token(s): yes count is 1, no count is 1

Test #62:

score: 0
Accepted
time: 39ms
memory: 11276kb

input:

1572 102920
921 2 863 1365
423 0
680 2 1549 292
741 3 1535 1253 1410
991 3 903 169 451
56 2 1202 1113
1535 3 1378 1354 449
785 2 170 1273
1073 3 44 1275 1091
1101 3 807 250 234
1048 0
1103 0
1325 3 1342 497 527
1560 0
1525 3 1307 131 1293
1558 3 1461 899 395
547 3 1135 183 596
819 0
577 3 485 1372 4...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #63:

score: 0
Accepted
time: 33ms
memory: 15632kb

input:

4617 146431
1693 1 3466
545 2 1712 4219
4287 3 3541 2583 3872
427 4 2350 3506 159 997
3078 0
3314 0
3719 1 587
2991 1 481
1327 3 107 529 2811
2754 2 238 1170
1164 2 2637 211
3230 1 3170
4073 2 43 903
2256 4 1546 2287 3481 3364
4212 2 3477 3085
112 2 4323 689
4569 0
745 3 2364 4412 3485
2834 0
2132 3...

output:

YES

result:

ok YES

Test #64:

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

input:

726 43700
67 1 128
651 2 108 590
128 0
270 2 2 575
623 2 578 37
488 0
138 0
546 5 603 726 259 70 119
177 4 135 344 193 262
11 4 186 204 354 689
344 1 633
472 4 173 624 655 109
120 1 338
454 4 34 115 95 389
297 5 295 517 306 394 13
333 0
555 3 643 14 556
665 3 453 425 124
407 3 218 373 393
694 3 304 ...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #65:

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

input:

3650 110900
2660 1 3202
2314 4 2165 1410 3408 3473
3313 3 952 1272 1682
65 3 145 3116 2726
2360 4 2174 2645 2693 1090
3400 2 3222 2587
3424 5 995 1663 2842 630 2795
2647 2 1502 2503
2233 3 1927 906 2118
1449 2 1082 297
358 0
1834 2 2737 525
3491 6 1633 2614 2855 557 1175 2270
2753 3 171 1023 420
187...

output:

YES

result:

ok YES

Test #66:

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

input:

898 30707
856 7 854 636 561 643 795 458 618
130 6 882 721 75 651 355 795
102 6 857 491 234 223 734 392
462 1 623
860 4 119 262 836 488
266 6 129 828 535 571 569 445
219 4 837 561 623 519
147 7 116 715 591 867 380 4 686
345 6 157 538 152 10 801 374
622 4 346 754 580 465
367 2 179 128
66 5 576 88 608 ...

output:

YES
YES

result:

ok 2 token(s): yes count is 2, no count is 0

Test #67:

score: 0
Accepted
time: 76ms
memory: 4776kb

input:

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

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

result:

ok 30 token(s): yes count is 0, no count is 30

Test #68:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #69:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #70:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #71:

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

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #72:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #73:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #74:

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

input:

4999 4999
3256 4 21 21 21 21
2861 4 4776 4776 4776 4776
2484 4 1602 1602 1602 1602
2783 4 2074 2074 2074 2074
1704 4 3384 3384 3384 3384
4850 4 1084 1084 1084 1084
4073 4 4380 4380 4380 4380
2796 4 2206 2206 2206 2206
4386 4 278 278 278 278
3408 4 1140 1140 1140 1140
2806 4 108 108 108 108
4274 4 20...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 token(s): yes count is 0, no count is 10

Test #75:

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

input:

4999 4999
1005 4 889 889 889 889
3342 4 4373 4373 4373 4373
1686 4 1340 1340 1340 1340
543 4 2837 2837 2837 2837
3915 4 675 675 675 675
2480 4 2324 2324 2324 2324
4056 4 3359 3359 3359 3359
3431 4 3316 3316 3316 3316
1534 4 4934 4934 4934 4934
4291 4 3008 3008 3008 3008
1587 4 1256 1256 1256 1256
42...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #76:

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

input:

4999 4999
1337 4 4488 4488 4488 4488
3617 4 1976 1976 1976 1976
2077 4 9 9 9 9
4932 4 765 765 765 765
4285 4 606 606 606 606
2268 4 3856 3856 3856 3856
2702 4 3875 3875 3875 3875
3741 4 793 793 793 793
4328 4 4815 4815 4815 4815
4262 4 1593 1593 1593 1593
1330 4 1956 1956 1956 1956
3537 4 3895 3895 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 10 token(s): yes count is 10, no count is 0

Test #77:

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

input:

50000 50000
44493 2 2811 2811
20346 2 13194 13194
6376 2 30939 30939
33702 2 10487 10487
47684 2 49061 49061
38058 2 14965 14965
29897 2 15423 15423
47328 2 21674 21674
3254 2 27543 27543
39371 2 19650 19650
4777 2 34718 34718
20049 2 44592 44592
40129 2 39101 39101
47524 2 4742 4742
19427 2 8265 82...

output:

NO

result:

ok NO

Test #78:

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

input:

50000 50000
44493 3 2811 2811 2811
20346 3 13194 13194 13194
6376 3 30939 30939 30939
33702 3 10487 10487 10487
47684 3 49061 49061 49061
38058 3 14965 14965 14965
29897 3 15423 15423 15423
47328 3 21674 21674 21674
3254 3 27543 27543 27543
39371 3 19650 19650 19650
4777 3 34718 34718 34718
20049 3 ...

output:

NO

result:

ok NO

Test #79:

score: 0
Accepted
time: 33ms
memory: 12096kb

input:

50000 50001
44493 3 2811 2811 2811
20346 3 13194 13194 13194
6376 3 30939 30939 30939
33702 3 10487 10487 10487
47684 3 49061 49061 49061
38058 3 14965 14965 14965
29897 3 15423 15423 15423
47328 3 21674 21674 21674
3254 3 27543 27543 27543
39371 3 19650 19650 19650
4777 3 34718 34718 34718
20049 3 ...

output:

YES

result:

ok YES

Test #80:

score: 0
Accepted
time: 93ms
memory: 23572kb

input:

50000 199998
47438 1 20726
40936 1 5882
13279 2 31302 31302
5217 1 27865
39216 3 49713 1 1
40833 2 16486 16486
39719 2 18483 18483
14757 3 39440 1 1
16802 3 21770 21770 21770
28817 3 19196 19196 19196
33536 1 15221
2321 3 42049 1 1
38453 2 32649 32649
39210 2 30094 30094
47487 3 1 29122 1
39048 3 22...

output:

YES

result:

ok YES

Test #81:

score: 0
Accepted
time: 80ms
memory: 24696kb

input:

50000 198966
9135 2 32133 32133
20346 3 13194 13194 13194
22980 2 34017 22980
5544 2 5544 5544
17251 2 35058 35058
26206 2 31622 31622
29897 3 15423 15423 15423
5759 2 5759 5759
3254 3 27543 27543 27543
5759 2 36671 5759
3596 2 3596 12223
34017 2 34017 34017
30382 2 2393 2393
37706 2 36018 36018
344...

output:

YES

result:

ok YES