QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#424805#7277. Bring Down the Sky Grading ServerLynkcat20 3688ms339872kbC++201.7kb2024-05-29 17:31:422024-05-29 17:31:44

Judging History

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

  • [2024-05-29 17:31:44]
  • 评测
  • 测评结果:20
  • 用时:3688ms
  • 内存:339872kb
  • [2024-05-29 17:31:42]
  • 提交

answer

#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N 
using namespace std;
int S,Q;
map<tuple<int,int,int,int>,bool>Mp;
inline int dfs(int x,int y,int a,int b)
{
    if (x<=0) return 0;
    if (a<=0) return 1;
    if (x<=1ll*b*S&&a<=1ll*y*S)
    {
        ll t=min(-x+1ll*b*S,-a+1ll*y*S)/S+1;
        b-=t,y-=t;
    }
    if (b==0) return dfs(a-x+1ll*b*S,b,x,y)^1;
    if (x<=1ll*b*S && a-1ll*y*S>=S) return 0;
    if (x<=1ll*b*S&&y==0)
    {
        ll t=(-x+1ll*b*S)/(S-1ll*(a-1ll*y*S))+1;
        if (1ll*(a-1ll*y*S)*t>=x) return 0;
        x+=t*(-1ll*(a-1ll*y*S));
        b-=t;
    }
    if (x<=1ll*b*S) return dfs(a,b-1,x,y)^1;
    if (x-1ll*b*S>=S&&a<=1ll*y*S) return 1;
    if (Mp.count({x,y,a,b})) return Mp[{x,y,a,b}];
    bool &res=Mp[{x,y,a,b}];
    res=0;
    if (x>1ll*b*S)
    {
        res=dfs(a-x+1ll*b*S,b,x,y)^1;
        if (res)return res;
    }
    if (b>0)
    {
        res=dfs(a,b-1,x,y)^1;
        if (res)return res;
    }
    return 0;
}
mt19937_64 rnd(time(0));
const int B=300;
void BellaKira()
{
    cin>>S>>Q;
    while (Q--)
    {
        int x,y,a,b;
        x=rnd()%B+1,y=rnd()%B+1,a=rnd()%B+1,b=rnd()%B+1;
        cin>>x>>y>>a>>b;
        if (dfs(x,y,a,b)) cout<<"YES\n";
        else cout<<"NO\n";
    }
}
signed main()
{
    IOS;
    cin.tie(0);
    int T=1;
    while (T--)
    {
        BellaKira();
    }
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/

详细

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

17 2
42 1 33 1
42 1 33 7

output:

YES
NO

result:

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

Test #2:

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

input:

2 250000
75 16 56 55
50 9 49 60
18 67 62 5
30 54 61 39
22 39 42 31
26 30 55 1
23 30 53 16
55 13 6 44
69 8 58 72
53 7 60 12
29 14 26 34
37 64 24 71
19 3 40 1
64 13 33 65
67 24 68 3
64 17 50 66
71 6 62 13
15 29 26 24
51 30 34 45
46 5 40 72
54 52 60 49
35 21 18 30
39 31 35 34
30 74 72 5
74 12 6 15
11 4...

output:

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

result:

ok 250000 token(s): yes count is 122161, no count is 127839

Test #3:

score: 0
Accepted
time: 215ms
memory: 23296kb

input:

7 250000
14 72 33 41
43 64 63 62
34 14 69 9
19 75 21 57
47 6 43 53
19 53 58 46
50 49 49 74
30 75 53 68
36 42 53 14
70 40 52 73
70 44 75 44
38 75 72 46
11 45 20 10
25 67 35 60
54 27 14 28
53 35 26 44
10 20 60 13
61 2 41 6
54 3 66 8
43 34 69 31
52 16 3 41
53 62 33 66
15 75 27 32
73 22 22 44
66 15 56 1...

output:

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

result:

ok 250000 token(s): yes count is 123236, no count is 126764

Test #4:

score: 0
Accepted
time: 142ms
memory: 13020kb

input:

42 250000
9 44 75 43
56 10 46 11
25 22 40 22
54 4 49 5
4 22 34 16
69 59 72 59
66 75 74 31
5 10 57 10
11 48 36 46
7 40 56 14
32 68 5 74
66 25 59 40
10 6 20 7
48 25 73 24
54 41 51 56
71 32 47 55
17 3 26 10
20 49 8 51
44 17 43 35
75 18 69 33
72 8 74 43
45 75 66 19
56 73 68 15
47 56 57 57
39 69 20 70
7 ...

output:

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

result:

ok 250000 token(s): yes count is 118956, no count is 131044

Test #5:

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

input:

74 250000
29 38 74 53
17 75 67 32
10 17 14 74
7 35 60 74
18 61 33 14
11 75 47 46
5 66 54 57
11 19 38 35
45 1 66 51
3 57 71 35
48 75 59 48
75 75 75 65
51 54 15 57
6 11 25 65
10 6 36 4
43 29 34 36
32 75 19 59
11 11 41 39
19 55 36 74
44 1 69 2
11 49 39 30
62 75 49 14
47 5 53 71
7 60 38 34
48 75 11 43
7...

output:

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

result:

ok 250000 token(s): yes count is 107243, no count is 142757

Test #6:

score: 0
Accepted
time: 94ms
memory: 6824kb

input:

33 250000
42 63 17 64
48 31 9 35
46 64 75 15
42 14 16 17
3 37 49 15
70 39 16 43
52 2 8 8
12 12 57 9
36 42 75 1
9 60 30 58
47 71 75 69
75 7 3 30
45 51 24 52
14 15 2 25
55 35 2 53
68 32 31 34
69 43 56 45
44 68 75 57
29 36 2 55
56 61 5 71
36 55 75 21
38 73 75 69
61 72 75 24
67 10 74 10
48 28 28 30
47 6...

output:

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

result:

ok 250000 token(s): yes count is 115599, no count is 134401

Test #7:

score: 0
Accepted
time: 112ms
memory: 8416kb

input:

20 250000
24 13 65 12
8 13 74 5
13 68 67 65
70 58 55 60
54 39 30 41
75 45 20 72
1 27 55 0
4 35 75 18
2 48 75 21
49 70 54 71
9 25 75 37
75 8 72 72
74 0 17 3
1 51 34 18
8 7 28 5
66 13 34 16
65 2 58 3
3 45 49 33
33 15 70 13
53 36 75 6
15 75 55 72
7 0 64 74
75 30 21 55
75 4 39 65
67 21 75 9
47 22 20 23
...

output:

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

result:

ok 250000 token(s): yes count is 118095, no count is 131905

Test #8:

score: 0
Accepted
time: 147ms
memory: 12580kb

input:

10 250000
50 31 58 32
17 66 46 63
8 39 35 36
75 42 49 64
28 68 75 9
3 73 10 71
64 54 23 58
33 32 16 35
8 31 63 24
51 7 75 65
60 11 38 15
12 75 75 3
4 52 28 45
24 54 2 71
44 39 24 42
46 41 75 4
1 39 74 3
75 9 41 48
75 9 61 72
58 44 74 42
66 34 28 38
64 30 72 29
34 46 62 44
75 6 17 68
29 16 1 45
63 38...

output:

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

result:

ok 250000 token(s): yes count is 123426, no count is 126574

Test #9:

score: 0
Accepted
time: 178ms
memory: 20220kb

input:

3 250000
44 27 71 1
61 15 13 29
48 7 36 37
23 71 28 11
39 10 14 6
24 64 39 29
48 28 23 58
22 14 34 64
36 55 29 45
5 55 69 38
56 48 56 63
67 61 24 44
38 6 47 38
3 22 6 59
7 71 4 41
34 8 55 63
53 56 43 7
5 51 5 75
53 72 8 14
40 37 42 14
58 19 70 50
71 13 56 52
42 12 37 62
73 19 58 24
64 63 46 64
46 31...

output:

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

result:

ok 250000 token(s): yes count is 130142, no count is 119858

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #10:

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

input:

17 2
42 1 33 1
42 1 33 7

output:

YES
NO

result:

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

Test #11:

score: 0
Accepted
time: 1027ms
memory: 172164kb

input:

3 250000
266 36 105 90
207 149 109 198
246 93 275 84
12 300 16 299
292 6 137 73
20 300 242 227
1 300 107 245
269 148 177 179
90 300 114 292
254 152 191 173
271 25 223 82
92 133 72 140
227 72 30 138
50 94 285 16
211 60 2 165
11 4 9 5
15 106 290 15
96 26 29 49
299 139 2 288
258 233 58 300
2 92 180 4
2...

output:

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

result:

ok 250000 token(s): yes count is 122039, no count is 127961

Test #12:

score: 0
Accepted
time: 1036ms
memory: 179940kb

input:

7 250000
253 123 35 260
296 180 68 288
181 141 2 231
22 300 105 71
134 271 52 300
22 184 191 172
195 279 62 299
36 125 181 93
125 300 215 240
101 36 296 10
2 196 275 60
215 144 190 300
150 104 127 191
132 102 56 113
109 206 85 234
27 41 24 42
84 286 122 201
261 282 139 300
90 31 19 42
62 42 98 37
15...

output:

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

result:

ok 250000 token(s): yes count is 116187, no count is 133813

Test #13:

score: 0
Accepted
time: 403ms
memory: 55752kb

input:

70 250000
113 275 266 273
134 300 177 202
290 217 109 230
230 62 235 62
173 272 267 271
130 99 233 72
73 91 299 88
159 300 172 286
198 134 113 136
280 48 96 300
299 91 271 92
133 143 51 145
128 120 130 120
123 180 2 300
139 265 161 213
231 94 6 132
270 233 4 300
134 228 179 228
2 246 165 165
244 14 ...

output:

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

result:

ok 250000 token(s): yes count is 123982, no count is 126018

Test #14:

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

input:

299 250000
277 284 19 298
177 147 109 148
101 300 152 190
183 235 168 300
93 116 257 46
242 300 245 136
88 300 184 298
94 191 26 194
273 41 10 273
53 172 139 171
134 262 83 263
99 211 194 300
167 130 90 212
2 260 105 209
171 167 145 300
151 247 94 248
227 127 59 213
35 10 197 6
52 66 226 225
297 300...

output:

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

result:

ok 250000 token(s): yes count is 109302, no count is 140698

Test #15:

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

input:

300 250000
137 295 278 80
5 281 84 152
153 300 104 145
244 36 196 132
95 300 243 109
118 26 105 29
176 3 178 135
123 166 78 286
199 232 16 300
97 174 162 150
72 274 122 36
81 271 31 273
239 107 60 300
9 282 16 40
250 13 239 144
116 199 20 245
181 183 88 300
28 204 259 196
156 195 253 195
177 259 39 ...

output:

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

result:

ok 250000 token(s): yes count is 105672, no count is 144328

Test #16:

score: 0
Accepted
time: 404ms
memory: 58988kb

input:

99 250000
257 74 300 26
114 83 300 1
157 243 300 1
242 119 85 121
83 148 300 59
201 1 147 2
35 72 117 71
194 209 3 272
157 139 201 139
295 0 126 2
130 7 1 137
29 68 183 64
165 1 193 1
290 0 201 1
98 259 46 261
134 1 178 1
110 2 237 1
96 17 300 130
144 34 2 87
272 1 297 2
174 0 71 1
263 0 25 1
125 98...

output:

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

result:

ok 250000 token(s): yes count is 152693, no count is 97307

Test #17:

score: 0
Accepted
time: 320ms
memory: 45324kb

input:

142 250000
8 192 121 180
93 243 9 253
256 220 300 1
129 130 2 194
246 204 226 205
174 2 272 1
223 130 24 138
57 264 280 260
146 231 300 9
64 238 45 239
248 199 111 200
2 250 191 179
191 2 299 1
163 70 186 70
143 35 300 1
55 287 300 150
2 276 224 188
61 217 300 28
2 159 142 95
277 254 300 1
180 0 272...

output:

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

result:

ok 250000 token(s): yes count is 135315, no count is 114685

Test #18:

score: 0
Accepted
time: 1827ms
memory: 294016kb

input:

10 250000
140 238 213 15
209 29 275 205
7 3 39 0
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
275 3 33 27
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
123 42 13 97
242 26 266 24
30 20 204 3
268 97 286 2...

output:

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

result:

ok 250000 token(s): yes count is 165023, no count is 84977

Test #19:

score: 0
Accepted
time: 1563ms
memory: 247004kb

input:

15 250000
140 238 213 15
209 29 275 205
20 2 38 1
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
202 2 33 13
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
208 157 112 97
26 18 275 1
166 13 206 11
268 97 28...

output:

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

result:

ok 250000 token(s): yes count is 162083, no count is 87917

Test #20:

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

input:

2 250000
75 16 56 55
50 9 49 60
18 67 62 5
30 54 61 39
22 39 42 31
26 30 55 1
23 30 53 16
55 13 6 44
69 8 58 72
53 7 60 12
29 14 26 34
37 64 24 71
19 3 40 1
64 13 33 65
67 24 68 3
64 17 50 66
71 6 62 13
15 29 26 24
51 30 34 45
46 5 40 72
54 52 60 49
35 21 18 30
39 31 35 34
30 74 72 5
74 12 6 15
11 4...

output:

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

result:

ok 250000 token(s): yes count is 122161, no count is 127839

Test #21:

score: 0
Accepted
time: 203ms
memory: 23404kb

input:

7 250000
14 72 33 41
43 64 63 62
34 14 69 9
19 75 21 57
47 6 43 53
19 53 58 46
50 49 49 74
30 75 53 68
36 42 53 14
70 40 52 73
70 44 75 44
38 75 72 46
11 45 20 10
25 67 35 60
54 27 14 28
53 35 26 44
10 20 60 13
61 2 41 6
54 3 66 8
43 34 69 31
52 16 3 41
53 62 33 66
15 75 27 32
73 22 22 44
66 15 56 1...

output:

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

result:

ok 250000 token(s): yes count is 123236, no count is 126764

Test #22:

score: 0
Accepted
time: 141ms
memory: 13164kb

input:

42 250000
9 44 75 43
56 10 46 11
25 22 40 22
54 4 49 5
4 22 34 16
69 59 72 59
66 75 74 31
5 10 57 10
11 48 36 46
7 40 56 14
32 68 5 74
66 25 59 40
10 6 20 7
48 25 73 24
54 41 51 56
71 32 47 55
17 3 26 10
20 49 8 51
44 17 43 35
75 18 69 33
72 8 74 43
45 75 66 19
56 73 68 15
47 56 57 57
39 69 20 70
7 ...

output:

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

result:

ok 250000 token(s): yes count is 118956, no count is 131044

Test #23:

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

input:

74 250000
29 38 74 53
17 75 67 32
10 17 14 74
7 35 60 74
18 61 33 14
11 75 47 46
5 66 54 57
11 19 38 35
45 1 66 51
3 57 71 35
48 75 59 48
75 75 75 65
51 54 15 57
6 11 25 65
10 6 36 4
43 29 34 36
32 75 19 59
11 11 41 39
19 55 36 74
44 1 69 2
11 49 39 30
62 75 49 14
47 5 53 71
7 60 38 34
48 75 11 43
7...

output:

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

result:

ok 250000 token(s): yes count is 107243, no count is 142757

Test #24:

score: 0
Accepted
time: 84ms
memory: 6704kb

input:

33 250000
42 63 17 64
48 31 9 35
46 64 75 15
42 14 16 17
3 37 49 15
70 39 16 43
52 2 8 8
12 12 57 9
36 42 75 1
9 60 30 58
47 71 75 69
75 7 3 30
45 51 24 52
14 15 2 25
55 35 2 53
68 32 31 34
69 43 56 45
44 68 75 57
29 36 2 55
56 61 5 71
36 55 75 21
38 73 75 69
61 72 75 24
67 10 74 10
48 28 28 30
47 6...

output:

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

result:

ok 250000 token(s): yes count is 115599, no count is 134401

Test #25:

score: 0
Accepted
time: 108ms
memory: 8400kb

input:

20 250000
24 13 65 12
8 13 74 5
13 68 67 65
70 58 55 60
54 39 30 41
75 45 20 72
1 27 55 0
4 35 75 18
2 48 75 21
49 70 54 71
9 25 75 37
75 8 72 72
74 0 17 3
1 51 34 18
8 7 28 5
66 13 34 16
65 2 58 3
3 45 49 33
33 15 70 13
53 36 75 6
15 75 55 72
7 0 64 74
75 30 21 55
75 4 39 65
67 21 75 9
47 22 20 23
...

output:

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

result:

ok 250000 token(s): yes count is 118095, no count is 131905

Test #26:

score: 0
Accepted
time: 134ms
memory: 12768kb

input:

10 250000
50 31 58 32
17 66 46 63
8 39 35 36
75 42 49 64
28 68 75 9
3 73 10 71
64 54 23 58
33 32 16 35
8 31 63 24
51 7 75 65
60 11 38 15
12 75 75 3
4 52 28 45
24 54 2 71
44 39 24 42
46 41 75 4
1 39 74 3
75 9 41 48
75 9 61 72
58 44 74 42
66 34 28 38
64 30 72 29
34 46 62 44
75 6 17 68
29 16 1 45
63 38...

output:

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

result:

ok 250000 token(s): yes count is 123426, no count is 126574

Test #27:

score: 0
Accepted
time: 172ms
memory: 20284kb

input:

3 250000
44 27 71 1
61 15 13 29
48 7 36 37
23 71 28 11
39 10 14 6
24 64 39 29
48 28 23 58
22 14 34 64
36 55 29 45
5 55 69 38
56 48 56 63
67 61 24 44
38 6 47 38
3 22 6 59
7 71 4 41
34 8 55 63
53 56 43 7
5 51 5 75
53 72 8 14
40 37 42 14
58 19 70 50
71 13 56 52
42 12 37 62
73 19 58 24
64 63 46 64
46 31...

output:

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

result:

ok 250000 token(s): yes count is 130142, no count is 119858

Subtask #3:

score: 10
Accepted

Test #28:

score: 10
Accepted
time: 585ms
memory: 81052kb

input:

1 250000
554333015044 833858497873 833858497874 554333015044
655160857180 306396306924 306396306917 655160857187
374728598365 176680698490 176680698490 374728598365
764650258714 835600427315 835600427309 764650258720
521594231110 318048536486 318048536482 521594231115
273627794040 449769302710 10899...

output:

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

result:

ok 250000 token(s): yes count is 126293, no count is 123707

Test #29:

score: 0
Accepted
time: 267ms
memory: 34844kb

input:

1 250000
129596328651 633211431893 1 762807760544
1 983509496641 151077576062 229908055916
36498040145 186033440917 1 995620003790
247250323075 720548396611 720548396605 247250323082
464252981836 491098062545 12027035640 943324008741
719683599156 92798217394 1 812481816550
317330065824 621406415744 ...

output:

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

result:

ok 250000 token(s): yes count is 143356, no count is 106644

Test #30:

score: 0
Accepted
time: 485ms
memory: 68032kb

input:

1 250000
807680045522 377273608557 256372130241 928581523838
536035116725 716237980103 379308294473 872964802356
1 882064014033 529720193901 352343820133
80961796479 258174541326 183165451143 155970886662
739448494904 100650373373 75082626963 765016241315
166426307909 865864146065 703399919607 32889...

output:

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

result:

ok 250000 token(s): yes count is 132783, no count is 117217

Test #31:

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

input:

1 1
999999999999 999999999999 999999999999 999999999999

output:

YES

result:

ok YES

Subtask #4:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #32:

score: 25
Accepted
time: 0ms
memory: 3712kb

input:

17 2
42 1 33 1
42 1 33 7

output:

YES
NO

result:

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

Test #33:

score: 0
Accepted
time: 1046ms
memory: 172180kb

input:

3 250000
266 36 105 90
207 149 109 198
246 93 275 84
12 300 16 299
292 6 137 73
20 300 242 227
1 300 107 245
269 148 177 179
90 300 114 292
254 152 191 173
271 25 223 82
92 133 72 140
227 72 30 138
50 94 285 16
211 60 2 165
11 4 9 5
15 106 290 15
96 26 29 49
299 139 2 288
258 233 58 300
2 92 180 4
2...

output:

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

result:

ok 250000 token(s): yes count is 122039, no count is 127961

Test #34:

score: 0
Accepted
time: 1061ms
memory: 179876kb

input:

7 250000
253 123 35 260
296 180 68 288
181 141 2 231
22 300 105 71
134 271 52 300
22 184 191 172
195 279 62 299
36 125 181 93
125 300 215 240
101 36 296 10
2 196 275 60
215 144 190 300
150 104 127 191
132 102 56 113
109 206 85 234
27 41 24 42
84 286 122 201
261 282 139 300
90 31 19 42
62 42 98 37
15...

output:

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

result:

ok 250000 token(s): yes count is 116187, no count is 133813

Test #35:

score: 0
Accepted
time: 397ms
memory: 55832kb

input:

70 250000
113 275 266 273
134 300 177 202
290 217 109 230
230 62 235 62
173 272 267 271
130 99 233 72
73 91 299 88
159 300 172 286
198 134 113 136
280 48 96 300
299 91 271 92
133 143 51 145
128 120 130 120
123 180 2 300
139 265 161 213
231 94 6 132
270 233 4 300
134 228 179 228
2 246 165 165
244 14 ...

output:

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

result:

ok 250000 token(s): yes count is 123982, no count is 126018

Test #36:

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

input:

299 250000
277 284 19 298
177 147 109 148
101 300 152 190
183 235 168 300
93 116 257 46
242 300 245 136
88 300 184 298
94 191 26 194
273 41 10 273
53 172 139 171
134 262 83 263
99 211 194 300
167 130 90 212
2 260 105 209
171 167 145 300
151 247 94 248
227 127 59 213
35 10 197 6
52 66 226 225
297 300...

output:

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

result:

ok 250000 token(s): yes count is 109302, no count is 140698

Test #37:

score: 0
Accepted
time: 58ms
memory: 4288kb

input:

300 250000
137 295 278 80
5 281 84 152
153 300 104 145
244 36 196 132
95 300 243 109
118 26 105 29
176 3 178 135
123 166 78 286
199 232 16 300
97 174 162 150
72 274 122 36
81 271 31 273
239 107 60 300
9 282 16 40
250 13 239 144
116 199 20 245
181 183 88 300
28 204 259 196
156 195 253 195
177 259 39 ...

output:

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

result:

ok 250000 token(s): yes count is 105672, no count is 144328

Test #38:

score: 0
Accepted
time: 428ms
memory: 58840kb

input:

99 250000
257 74 300 26
114 83 300 1
157 243 300 1
242 119 85 121
83 148 300 59
201 1 147 2
35 72 117 71
194 209 3 272
157 139 201 139
295 0 126 2
130 7 1 137
29 68 183 64
165 1 193 1
290 0 201 1
98 259 46 261
134 1 178 1
110 2 237 1
96 17 300 130
144 34 2 87
272 1 297 2
174 0 71 1
263 0 25 1
125 98...

output:

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

result:

ok 250000 token(s): yes count is 152693, no count is 97307

Test #39:

score: 0
Accepted
time: 307ms
memory: 45304kb

input:

142 250000
8 192 121 180
93 243 9 253
256 220 300 1
129 130 2 194
246 204 226 205
174 2 272 1
223 130 24 138
57 264 280 260
146 231 300 9
64 238 45 239
248 199 111 200
2 250 191 179
191 2 299 1
163 70 186 70
143 35 300 1
55 287 300 150
2 276 224 188
61 217 300 28
2 159 142 95
277 254 300 1
180 0 272...

output:

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

result:

ok 250000 token(s): yes count is 135315, no count is 114685

Test #40:

score: 0
Accepted
time: 1856ms
memory: 294136kb

input:

10 250000
140 238 213 15
209 29 275 205
7 3 39 0
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
275 3 33 27
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
123 42 13 97
242 26 266 24
30 20 204 3
268 97 286 2...

output:

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

result:

ok 250000 token(s): yes count is 165023, no count is 84977

Test #41:

score: 0
Accepted
time: 1614ms
memory: 247076kb

input:

15 250000
140 238 213 15
209 29 275 205
20 2 38 1
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
202 2 33 13
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
208 157 112 97
26 18 275 1
166 13 206 11
268 97 28...

output:

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

result:

ok 250000 token(s): yes count is 162083, no count is 87917

Test #42:

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

input:

342 250000
408 1209 111 2000
1902 1357 688 2000
1691 1272 471 1464
1385 1170 2 1862
508 1011 1329 672
1374 527 788 2000
31 2000 893 1002
983 267 616 269
112 2000 521 1997
1729 865 976 868
1190 2000 1373 1987
647 2000 1639 1941
1266 1978 56 2000
3 1771 1669 1216
857 1141 410 1143
803 1101 897 108
401...

output:

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

result:

ok 250000 token(s): yes count is 124862, no count is 125138

Test #43:

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

input:

2 250000
75 16 56 55
50 9 49 60
18 67 62 5
30 54 61 39
22 39 42 31
26 30 55 1
23 30 53 16
55 13 6 44
69 8 58 72
53 7 60 12
29 14 26 34
37 64 24 71
19 3 40 1
64 13 33 65
67 24 68 3
64 17 50 66
71 6 62 13
15 29 26 24
51 30 34 45
46 5 40 72
54 52 60 49
35 21 18 30
39 31 35 34
30 74 72 5
74 12 6 15
11 4...

output:

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

result:

ok 250000 token(s): yes count is 122161, no count is 127839

Test #44:

score: -25
Time Limit Exceeded

input:

4 250000
36 373 1491 10
1163 2000 1936 1807
643 2000 1195 1862
1175 1938 935 1999
415 131 112 207
1603 1603 18 2000
259 2000 424 1959
1754 1892 1324 2000
1392 2000 1493 1975
976 1987 927 2000
91 1965 2 2000
1820 1934 1560 2000
204 2000 1036 1793
1419 1695 200 2000
1613 1834 952 2000
1 2000 175 1827
...

output:

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

result:


Subtask #5:

score: 0
Time Limit Exceeded

Dependency #3:

100%
Accepted

Test #60:

score: 20
Accepted
time: 572ms
memory: 81148kb

input:

1 250000
554333015044 833858497873 833858497874 554333015044
655160857180 306396306924 306396306917 655160857187
374728598365 176680698490 176680698490 374728598365
764650258714 835600427315 835600427309 764650258720
521594231110 318048536486 318048536482 521594231115
273627794040 449769302710 10899...

output:

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

result:

ok 250000 token(s): yes count is 126293, no count is 123707

Test #61:

score: 0
Accepted
time: 89ms
memory: 6812kb

input:

33 250000
42 63 17 64
48 31 9 35
46 64 75 15
42 14 16 17
3 37 49 15
70 39 16 43
52 2 8 8
12 12 57 9
36 42 75 1
9 60 30 58
47 71 75 69
75 7 3 30
45 51 24 52
14 15 2 25
55 35 2 53
68 32 31 34
69 43 56 45
44 68 75 57
29 36 2 55
56 61 5 71
36 55 75 21
38 73 75 69
61 72 75 24
67 10 74 10
48 28 28 30
47 6...

output:

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

result:

ok 250000 token(s): yes count is 115599, no count is 134401

Test #62:

score: 0
Accepted
time: 108ms
memory: 8548kb

input:

20 250000
24 13 65 12
8 13 74 5
13 68 67 65
70 58 55 60
54 39 30 41
75 45 20 72
1 27 55 0
4 35 75 18
2 48 75 21
49 70 54 71
9 25 75 37
75 8 72 72
74 0 17 3
1 51 34 18
8 7 28 5
66 13 34 16
65 2 58 3
3 45 49 33
33 15 70 13
53 36 75 6
15 75 55 72
7 0 64 74
75 30 21 55
75 4 39 65
67 21 75 9
47 22 20 23
...

output:

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

result:

ok 250000 token(s): yes count is 118095, no count is 131905

Test #63:

score: 0
Accepted
time: 140ms
memory: 12768kb

input:

10 250000
50 31 58 32
17 66 46 63
8 39 35 36
75 42 49 64
28 68 75 9
3 73 10 71
64 54 23 58
33 32 16 35
8 31 63 24
51 7 75 65
60 11 38 15
12 75 75 3
4 52 28 45
24 54 2 71
44 39 24 42
46 41 75 4
1 39 74 3
75 9 41 48
75 9 61 72
58 44 74 42
66 34 28 38
64 30 72 29
34 46 62 44
75 6 17 68
29 16 1 45
63 38...

output:

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

result:

ok 250000 token(s): yes count is 123426, no count is 126574

Test #64:

score: 0
Accepted
time: 184ms
memory: 20152kb

input:

3 250000
44 27 71 1
61 15 13 29
48 7 36 37
23 71 28 11
39 10 14 6
24 64 39 29
48 28 23 58
22 14 34 64
36 55 29 45
5 55 69 38
56 48 56 63
67 61 24 44
38 6 47 38
3 22 6 59
7 71 4 41
34 8 55 63
53 56 43 7
5 51 5 75
53 72 8 14
40 37 42 14
58 19 70 50
71 13 56 52
42 12 37 62
73 19 58 24
64 63 46 64
46 31...

output:

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

result:

ok 250000 token(s): yes count is 130142, no count is 119858

Test #65:

score: 0
Accepted
time: 1028ms
memory: 172168kb

input:

3 250000
266 36 105 90
207 149 109 198
246 93 275 84
12 300 16 299
292 6 137 73
20 300 242 227
1 300 107 245
269 148 177 179
90 300 114 292
254 152 191 173
271 25 223 82
92 133 72 140
227 72 30 138
50 94 285 16
211 60 2 165
11 4 9 5
15 106 290 15
96 26 29 49
299 139 2 288
258 233 58 300
2 92 180 4
2...

output:

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

result:

ok 250000 token(s): yes count is 122039, no count is 127961

Test #66:

score: 0
Accepted
time: 1065ms
memory: 180072kb

input:

7 250000
253 123 35 260
296 180 68 288
181 141 2 231
22 300 105 71
134 271 52 300
22 184 191 172
195 279 62 299
36 125 181 93
125 300 215 240
101 36 296 10
2 196 275 60
215 144 190 300
150 104 127 191
132 102 56 113
109 206 85 234
27 41 24 42
84 286 122 201
261 282 139 300
90 31 19 42
62 42 98 37
15...

output:

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

result:

ok 250000 token(s): yes count is 116187, no count is 133813

Test #67:

score: 0
Accepted
time: 402ms
memory: 55752kb

input:

70 250000
113 275 266 273
134 300 177 202
290 217 109 230
230 62 235 62
173 272 267 271
130 99 233 72
73 91 299 88
159 300 172 286
198 134 113 136
280 48 96 300
299 91 271 92
133 143 51 145
128 120 130 120
123 180 2 300
139 265 161 213
231 94 6 132
270 233 4 300
134 228 179 228
2 246 165 165
244 14 ...

output:

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

result:

ok 250000 token(s): yes count is 123982, no count is 126018

Test #68:

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

input:

299 250000
277 284 19 298
177 147 109 148
101 300 152 190
183 235 168 300
93 116 257 46
242 300 245 136
88 300 184 298
94 191 26 194
273 41 10 273
53 172 139 171
134 262 83 263
99 211 194 300
167 130 90 212
2 260 105 209
171 167 145 300
151 247 94 248
227 127 59 213
35 10 197 6
52 66 226 225
297 300...

output:

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

result:

ok 250000 token(s): yes count is 109302, no count is 140698

Test #69:

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

input:

300 250000
137 295 278 80
5 281 84 152
153 300 104 145
244 36 196 132
95 300 243 109
118 26 105 29
176 3 178 135
123 166 78 286
199 232 16 300
97 174 162 150
72 274 122 36
81 271 31 273
239 107 60 300
9 282 16 40
250 13 239 144
116 199 20 245
181 183 88 300
28 204 259 196
156 195 253 195
177 259 39 ...

output:

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

result:

ok 250000 token(s): yes count is 105672, no count is 144328

Test #70:

score: 0
Accepted
time: 446ms
memory: 58972kb

input:

99 250000
257 74 300 26
114 83 300 1
157 243 300 1
242 119 85 121
83 148 300 59
201 1 147 2
35 72 117 71
194 209 3 272
157 139 201 139
295 0 126 2
130 7 1 137
29 68 183 64
165 1 193 1
290 0 201 1
98 259 46 261
134 1 178 1
110 2 237 1
96 17 300 130
144 34 2 87
272 1 297 2
174 0 71 1
263 0 25 1
125 98...

output:

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

result:

ok 250000 token(s): yes count is 152693, no count is 97307

Test #71:

score: 0
Accepted
time: 284ms
memory: 34824kb

input:

1 250000
129596328651 633211431893 1 762807760544
1 983509496641 151077576062 229908055916
36498040145 186033440917 1 995620003790
247250323075 720548396611 720548396605 247250323082
464252981836 491098062545 12027035640 943324008741
719683599156 92798217394 1 812481816550
317330065824 621406415744 ...

output:

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

result:

ok 250000 token(s): yes count is 143356, no count is 106644

Test #72:

score: 0
Accepted
time: 334ms
memory: 45244kb

input:

142 250000
8 192 121 180
93 243 9 253
256 220 300 1
129 130 2 194
246 204 226 205
174 2 272 1
223 130 24 138
57 264 280 260
146 231 300 9
64 238 45 239
248 199 111 200
2 250 191 179
191 2 299 1
163 70 186 70
143 35 300 1
55 287 300 150
2 276 224 188
61 217 300 28
2 159 142 95
277 254 300 1
180 0 272...

output:

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

result:

ok 250000 token(s): yes count is 135315, no count is 114685

Test #73:

score: 0
Accepted
time: 1835ms
memory: 294136kb

input:

10 250000
140 238 213 15
209 29 275 205
7 3 39 0
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
275 3 33 27
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
123 42 13 97
242 26 266 24
30 20 204 3
268 97 286 2...

output:

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

result:

ok 250000 token(s): yes count is 165023, no count is 84977

Test #74:

score: 0
Accepted
time: 1566ms
memory: 246948kb

input:

15 250000
140 238 213 15
209 29 275 205
20 2 38 1
267 152 14 81
295 282 40 1
236 73 164 97
198 10 165 172
155 223 30 9
202 2 33 13
72 203 162 6
269 131 161 179
286 115 2 236
183 186 151 107
113 222 2 211
289 64 188 256
149 236 53 110
218 212 103 158
208 157 112 97
26 18 275 1
166 13 206 11
268 97 28...

output:

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

result:

ok 250000 token(s): yes count is 162083, no count is 87917

Test #75:

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

input:

2 1
1000000000000 0 1 1000000000000

output:

NO

result:

ok NO

Test #76:

score: -20
Time Limit Exceeded

input:

42 250000
800 31 1306 19
763 6 291 18
1402 19 822 33
1183 25 1082 28
1636 34 1439 38
1997 1 76 47
1546 41 1735 36
1911 9 396 45
65 23 983 1
1842 20 841 43
757 7 321 18
558 32 1381 13
383 18 790 9
149 40 1682 3
1827 35 1486 43
87 44 1886 2
842 17 745 20
918 31 1329 21
1807 22 958 43
1125 22 944 26
14...

output:


result:


Subtask #6:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #102:

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

input:

17 2
42 1 33 1
42 1 33 7

output:

YES
NO

result:

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

Test #103:

score: -20
Time Limit Exceeded

input:

42 250000
4872 44 1889 116
2940 47 1989 70
3401 74 3146 81
629 27 988 19
2765 125 4409 86
2056 125 4578 65
4953 9 118 125
486576003099 110 843475701009 97
5078 105 4242 125
121 70 71 72
313361668603 101 507029830192 68
3570 94 2302 125
808028848732 24 964525600627 54
3276 39 1670 78
1436 115 1049 12...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%