QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#108807#6392. Curtainscyan17#24 238ms106432kbC++172.7kb2023-05-26 17:56:432024-05-31 13:43:55

Judging History

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

  • [2024-05-31 13:43:55]
  • 评测
  • 测评结果:24
  • 用时:238ms
  • 内存:106432kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-26 17:56:43]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

#define int long long
#define fr first
#define sc second
#define eb emplace_back
const char nl = '\n';

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");} 
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define dbg(x...) cerr << "LINE(" << __LINE__ << ") -> " <<"[" << #x << "] = ["; _print(x)
#else
#define dbg(x...)
#endif

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m, q; cin >> n >> m >> q;
    pair<int, int> c[m], p[q];
    for(int i = 0; i < m; ++i) cin >> c[i].fr >> c[i].sc;
    for(int i = 0; i < q; ++i) cin >> p[i].fr >> p[i].sc;

    vector<int> rt[n + 1];
    for(int i = 0; i < m; ++i) rt[c[i].fr].eb(c[i].sc);
    for(int i = 1; i <= n; ++i) sort(rt[i].begin(), rt[i].end());
    int lo[n + 1];
    for(int i = 1; i <= n; ++i) lo[i] = i + 1;
    bool dp[n + 1][n + 1] = {};

    for(int i = n; i > 0; --i) {
        for(int j = i; j <= n; ++j) {
            int x = upper_bound(rt[i].begin(), rt[i].end(), j) - rt[i].begin() - 1;
            if(i == 1 && j == 2) {
                /* cout << "check ";cout << rt[i][x] << nl; */
            }
            if(x >= 0 && x < rt[i].size()) {
                if(rt[i][x] + 1 >= lo[j]) {
                    dp[i][j] = 1;
                    lo[j] = i;
                }    
            }
        }
    }

    for(int i = 0; i < q; ++i) {
        cout << (dp[p[i].fr][p[i].sc] ? "YES" : "NO") << nl;
    }

    /* cout << "    "; */
    /* for(int j = 1; j <= n; ++j) cout << j << ' '; */
    /* cout << nl; */
    /* for(int i = 1; i <= n; ++i) { */
    /*     cout << i << " : "; */
    /*     for(int j = 1; j <= n; ++j) { */
    /*         cout << dp[i][j] << ' '; */
    /*     } */
    /*     cout << nl; */
    /* } */
}

详细

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 1ms
memory: 3696kb

input:

200 200 200
113 134
77 77
110 143
126 157
122 131
161 172
59 134
19 68
117 142
15 103
61 182
12 67
73 97
72 128
68 110
19 137
14 118
60 150
42 64
25 30
118 158
149 164
79 149
21 94
33 82
3 130
36 142
57 170
64 140
40 98
115 132
2 45
27 85
43 181
120 125
82 160
121 176
16 154
59 74
34 52
71 74
57 185...

output:

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

result:

ok 200 lines

Test #2:

score: 3
Accepted
time: 1ms
memory: 3636kb

input:

200 200 200
177 200
1 17
123 127
19 53
172 177
4 16
44 132
97 124
94 143
15 71
96 140
61 181
109 162
28 95
108 162
24 146
84 107
20 154
92 118
133 141
55 58
73 154
35 86
83 124
9 90
92 114
46 81
35 62
45 83
11 52
11 178
35 188
128 156
20 87
102 150
22 157
21 34
7 174
27 48
2 75
159 191
30 95
140 153...

output:

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

result:

ok 200 lines

Test #3:

score: 3
Accepted
time: 1ms
memory: 3700kb

input:

200 200 200
74 143
108 109
6 95
85 155
130 172
73 186
14 51
73 147
61 108
7 158
28 28
66 149
84 192
79 196
94 126
7 86
102 199
27 49
32 163
90 198
137 179
57 123
41 75
33 190
20 175
84 154
163 184
70 83
76 154
77 105
49 164
67 191
22 157
38 83
60 99
50 129
10 32
25 154
10 122
155 174
111 124
63 135
...

output:

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

result:

ok 200 lines

Test #4:

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

input:

200 200 200
177 181
118 129
13 72
3 80
18 82
6 7
89 182
97 184
132 150
4 54
129 132
83 136
14 119
15 19
67 123
176 198
41 51
81 129
155 170
20 187
85 111
96 163
195 200
34 179
39 186
35 87
90 93
3 191
21 187
1 100
193 195
57 61
52 159
40 188
117 182
106 112
92 111
105 136
106 170
86 113
39 42
107 11...

output:

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

result:

ok 200 lines

Test #5:

score: 3
Accepted
time: 1ms
memory: 3696kb

input:

200 200 200
116 119
160 161
27 79
20 194
98 100
9 127
106 139
32 33
14 162
3 71
82 133
88 137
129 163
174 175
3 20
100 111
11 191
24 28
135 136
117 143
31 147
44 47
111 116
100 175
40 165
129 197
87 89
61 175
91 93
14 105
193 195
48 92
71 72
67 82
101 153
67 160
64 66
136 137
128 197
35 153
195 199
...

output:

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

result:

ok 200 lines

Test #6:

score: 3
Accepted
time: 1ms
memory: 3736kb

input:

200 200 200
18 98
42 142
96 162
170 184
6 35
113 155
16 136
22 177
36 95
50 114
44 76
17 44
87 173
124 189
20 48
47 101
66 188
68 138
100 171
23 49
67 184
119 189
47 81
24 27
58 122
38 95
12 96
90 131
16 165
46 86
33 59
25 122
126 145
132 190
32 114
45 183
22 36
27 199
190 193
22 126
60 80
58 179
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
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
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 200 lines

Test #7:

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

input:

200 200 200
102 106
7 10
88 91
135 136
129 136
90 99
6 6
135 145
80 85
2 5
53 53
146 146
23 27
178 186
19 22
139 148
34 37
59 66
170 178
135 136
131 138
180 182
90 98
171 177
28 28
179 181
177 182
171 181
107 117
3 3
59 63
100 104
124 129
195 200
150 156
162 165
140 145
71 74
94 100
52 60
24 34
69 7...

output:

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

result:

ok 200 lines

Test #8:

score: 3
Accepted
time: 1ms
memory: 3696kb

input:

200 200 200
123 125
128 131
157 165
37 47
31 34
200 200
13 14
184 194
145 153
39 41
8 18
117 122
26 33
173 179
150 152
31 37
52 53
169 175
45 51
198 199
53 60
98 104
74 74
4 5
184 188
105 110
14 21
116 119
142 150
168 172
121 130
56 65
145 152
89 90
126 129
130 130
50 53
154 163
21 22
170 172
71 79
...

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 200 lines

Test #9:

score: 3
Accepted
time: 1ms
memory: 3700kb

input:

200 200 200
150 150
127 127
102 102
62 62
47 47
192 192
63 63
50 50
37 37
173 173
169 169
66 66
183 183
171 171
104 104
75 75
184 184
128 128
57 57
197 197
163 163
193 193
199 199
153 153
25 25
175 175
98 98
80 80
120 120
106 106
181 181
113 113
143 143
130 130
121 121
185 185
172 172
78 78
125 125
...

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 200 lines

Test #10:

score: 3
Accepted
time: 1ms
memory: 3668kb

input:

200 100 200
150 159
165 174
79 88
29 38
64 73
157 166
59 68
102 111
159 168
60 69
116 125
134 143
190 199
65 74
114 123
176 185
2 11
97 106
166 175
31 40
152 161
47 56
68 77
126 135
10 19
81 90
178 187
70 79
101 110
75 84
169 178
90 99
73 82
103 112
172 181
16 25
141 150
143 152
167 176
23 32
37 46
...

output:

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

result:

ok 200 lines

Subtask #2:

score: 6
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 6
Accepted
time: 3ms
memory: 7692kb

input:

2000 2000 2000
135 211
509 982
410 1776
192 1071
20 1129
821 872
407 1514
1321 1333
1425 1437
28 1936
655 1360
1353 1426
327 550
1036 1431
806 1791
1242 1247
371 651
622 1589
1491 1538
820 1828
431 1346
660 1372
712 1768
1414 1847
1329 1672
570 592
76 1838
427 1549
955 1598
790 1165
828 1784
1818 19...

output:

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

result:

ok 2000 lines

Test #12:

score: 6
Accepted
time: 3ms
memory: 7664kb

input:

2000 2000 2000
177 1050
391 1762
1243 1903
591 1477
1428 1477
1844 1899
675 1056
1203 1512
156 1112
633 1264
537 1620
1430 1809
66 1499
213 1120
662 1725
957 1759
1223 1871
252 571
632 773
432 1139
292 1345
33 325
702 794
959 1989
3 474
1881 1936
536 1334
243 1922
690 826
36 1845
437 551
410 671
565...

output:

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

result:

ok 2000 lines

Test #13:

score: 6
Accepted
time: 3ms
memory: 7720kb

input:

2000 2000 2000
1 111
1485 1529
1252 1791
235 896
796 821
746 1876
1058 1098
111 134
196 1346
330 1959
735 1716
966 1792
181 1447
983 1526
1241 1933
38 1389
616 785
196 805
964 1373
424 1040
4 59
783 1768
509 685
1252 1661
1432 1796
576 1613
314 1715
12 287
263 1483
1672 1840
183 1254
460 485
156 128...

output:

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

result:

ok 2000 lines

Test #14:

score: 6
Accepted
time: 3ms
memory: 7724kb

input:

2000 2000 2000
1015 1694
501 987
18 485
744 748
896 1456
453 1925
617 1844
1287 1296
407 649
79 80
405 1858
519 528
931 1535
674 1277
351 634
365 1844
242 1637
1543 1600
714 1054
800 1559
1269 1273
1621 1893
630 1242
698 1147
703 811
1686 1965
580 1202
1188 1206
1664 1922
144 1571
292 1369
433 1919
...

output:

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

result:

ok 2000 lines

Test #15:

score: 6
Accepted
time: 7ms
memory: 7668kb

input:

2000 2000 2000
659 758
1650 1678
341 818
235 1380
1865 1927
1233 1366
267 1673
775 1698
1022 1255
1110 1533
1854 1928
169 1579
449 729
943 1335
360 583
50 795
926 1584
911 1924
280 604
309 1429
420 1107
1466 1858
76 265
1077 1109
245 622
957 1941
1434 1560
122 1128
51 229
826 925
851 1006
323 1744
8...

output:

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

result:

ok 2000 lines

Test #16:

score: 6
Accepted
time: 6ms
memory: 7736kb

input:

2000 2000 2000
1687 1697
1764 1766
672 678
485 495
1500 1506
1167 1168
1708 1716
347 353
754 759
616 623
1623 1626
934 943
822 822
1852 1857
559 569
1266 1275
389 396
472 473
144 149
766 769
1868 1869
1194 1201
1913 1921
741 747
153 163
558 558
1908 1913
1861 1862
775 779
1809 1816
816 825
171 180
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 2000 lines

Test #17:

score: 6
Accepted
time: 6ms
memory: 7724kb

input:

2000 2000 2000
1992 2000
647 653
573 575
1484 1494
424 429
1598 1605
1013 1018
1737 1747
1675 1680
1589 1595
860 865
1716 1724
9 10
1451 1460
1385 1391
1347 1351
105 107
1832 1835
327 331
1165 1169
695 697
1047 1051
942 944
190 200
543 552
1895 1899
524 528
1531 1538
986 988
475 480
785 793
1652 166...

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 2000 lines

Test #18:

score: 6
Accepted
time: 3ms
memory: 7752kb

input:

2000 1990 2000
1546 1548
446 448
1806 1808
832 834
1426 1428
1684 1686
961 963
44 46
141 143
289 291
325 327
1874 1876
625 627
527 529
919 921
1927 1929
302 304
707 709
1073 1075
1021 1023
1610 1612
1539 1541
1029 1031
1330 1332
779 781
257 259
1416 1418
1746 1748
340 342
385 387
395 397
550 552
460...

output:

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

result:

ok 2000 lines

Test #19:

score: 6
Accepted
time: 3ms
memory: 7672kb

input:

2000 1900 2000
772 800
216 244
358 386
1022 1050
166 194
1638 1666
51 79
898 926
712 740
779 807
1157 1185
1718 1746
232 260
1430 1458
1660 1688
675 703
972 1000
1012 1040
1057 1085
1623 1651
1779 1807
1002 1030
1224 1252
1429 1457
658 686
539 567
1587 1615
1088 1116
259 287
1663 1691
1829 1857
726 ...

output:

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

result:

ok 2000 lines

Subtask #3:

score: 15
Accepted

Dependency #2:

100%
Accepted

Test #20:

score: 15
Accepted
time: 59ms
memory: 15420kb

input:

2000 1000 500000
1604 1997
1183 1279
730 783
558 762
478 1141
763 1772
35 1907
371 1334
494 1017
127 1108
187 1492
703 837
409 1222
1776 1796
1195 1466
1390 1777
106 821
99 873
1127 1891
1451 1982
1847 1968
173 1408
331 1093
301 616
170 1888
1158 1395
27 1632
50 467
25 1519
249 840
654 670
260 1111
...

output:

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

result:

ok 500000 lines

Test #21:

score: 15
Accepted
time: 67ms
memory: 15684kb

input:

2000 10000 500000
1341 1821
329 1867
895 1868
138 887
1360 1756
412 1367
777 1001
71 1630
1587 1816
659 1363
798 1886
816 1793
450 511
1328 1527
1131 1686
560 1903
926 1626
42 804
218 1250
650 801
1820 1854
102 177
387 547
178 554
695 1065
439 692
1585 1915
1544 1893
866 931
247 685
1001 1562
827 14...

output:

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

result:

ok 500000 lines

Test #22:

score: 15
Accepted
time: 90ms
memory: 18384kb

input:

2000 100000 500000
968 1817
404 545
310 1458
1367 1418
189 999
850 1561
246 1848
1098 1540
862 1753
11 805
516 999
903 952
575 824
1616 1744
1385 1694
167 1337
367 1117
1329 1651
320 975
983 1138
294 907
48 533
376 1186
866 1507
130 955
525 1761
541 1047
64 783
535 776
1243 1504
699 1371
602 1077
13...

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

result:

ok 500000 lines

Test #23:

score: 15
Accepted
time: 153ms
memory: 29152kb

input:

2000 500000 500000
920 1943
1138 1274
1537 1876
1308 1779
1563 1673
881 1532
27 430
721 1430
1179 1599
662 1551
344 1179
784 1306
1714 1864
882 1180
716 1711
1762 1856
21 1255
116 1213
841 1315
368 954
153 1861
784 1624
1343 1585
1160 1764
115 1301
949 1481
851 974
108 213
628 1646
263 1941
303 490
...

output:

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

result:

ok 500000 lines

Test #24:

score: 15
Accepted
time: 71ms
memory: 15592kb

input:

2000 5000 500000
127 1171
764 1227
1099 1762
1824 1926
1114 1295
895 1987
196 1751
813 1652
761 1926
278 715
41 368
204 1710
417 828
1034 1217
1745 1990
969 1130
568 1993
1317 1410
122 948
345 654
712 1279
1600 1754
33 199
1581 1666
1243 1361
719 1650
269 1539
276 1445
58 374
313 358
944 1360
521 69...

output:

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

result:

ok 500000 lines

Test #25:

score: 15
Accepted
time: 165ms
memory: 29324kb

input:

2000 500000 500000
74 178
105 1245
1847 1885
1053 1217
290 1275
1285 1296
418 619
241 308
616 958
169 410
1213 1755
640 1632
728 846
1293 1482
45 1944
1103 1288
589 1341
419 1044
577 662
1498 1672
112 1187
1035 1314
548 1936
960 1763
1072 1692
855 946
407 1165
759 1109
795 995
1645 1656
577 1210
119...

output:

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

result:

ok 500000 lines

Test #26:

score: 15
Accepted
time: 147ms
memory: 29116kb

input:

2000 500000 500000
631 1336
1461 1597
711 1755
975 1625
442 1083
1730 1766
1046 1238
1565 1986
390 1926
864 1484
954 1326
182 346
1056 1199
1129 1525
25 585
1661 1847
204 719
1062 1506
251 529
594 1054
55 570
644 1462
1013 1696
120 620
388 841
209 1455
1289 1368
741 1099
1117 1470
361 1828
1251 1254...

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 500000 lines

Test #27:

score: 15
Accepted
time: 56ms
memory: 15636kb

input:

2000 5000 500000
1061 1362
1718 1775
1102 1464
1021 1076
325 538
1009 1126
1041 1380
176 650
95 311
914 923
1132 1752
76 269
145 304
152 251
101 745
1372 1442
1547 1710
1740 1788
130 735
105 312
1305 1422
643 793
314 367
663 745
359 619
549 731
1010 1815
1217 1614
240 743
80 317
75 619
414 725
565 8...

output:

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

result:

ok 500000 lines

Test #28:

score: 15
Accepted
time: 51ms
memory: 15604kb

input:

2000 5000 500000
1060 1747
307 1148
795 1271
156 1623
723 1303
846 1026
96 650
1630 1787
862 1851
657 886
382 1001
917 1576
261 1619
311 479
820 1367
858 953
1470 1866
1280 1870
556 1967
292 1606
207 1964
1896 1913
1419 1452
1691 1882
1161 1546
848 1283
665 790
642 710
133 1085
818 1857
44 1645
1448...

output:

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

result:

ok 500000 lines

Test #29:

score: 15
Accepted
time: 65ms
memory: 16864kb

input:

2000 50000 500000
954 993
604 1398
1773 1909
393 1744
924 1264
868 1164
1219 1372
1079 1547
506 1390
339 1709
941 1504
1758 1940
75 782
715 864
1514 1738
323 431
745 1920
69 1926
971 1524
267 1138
712 1259
67 584
870 915
1651 1690
1547 1987
703 1093
1073 1241
67 664
277 691
941 1684
199 694
86 1786
...

output:

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

result:

ok 500000 lines

Test #30:

score: 15
Accepted
time: 136ms
memory: 29160kb

input:

2000 500000 500000
8 1913
589 1791
474 1943
455 1103
213 266
1087 1878
1054 1247
139 948
1218 1807
1030 1672
1319 1718
232 785
836 1732
1351 1746
1255 1549
940 1001
800 1767
489 975
207 276
523 1051
1764 1899
1498 1730
203 1921
859 1892
1113 1769
761 1184
197 1676
447 848
1424 1603
161 606
417 852
6...

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 500000 lines

Test #31:

score: 15
Accepted
time: 55ms
memory: 15700kb

input:

2000 10000 500000
1599 1606
556 559
833 835
1403 1411
1880 1881
846 853
1768 1773
1169 1178
1093 1101
1124 1134
169 177
1674 1684
913 916
412 415
1408 1415
1956 1960
363 367
1042 1050
1996 1999
1530 1534
1072 1075
644 652
1337 1338
603 613
1996 1998
799 803
1027 1028
1971 1976
508 517
191 194
88 95
...

output:

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

result:

ok 500000 lines

Subtask #4:

score: 0
Memory Limit Exceeded

Test #32:

score: 0
Memory Limit Exceeded

input:

100000 100000 100000
44237 85021
45776 80409
39632 94735
28119 63770
47399 73347
28902 87358
27924 65499
23898 54817
50114 96633
11325 37690
46642 94643
9271 47594
47324 47948
27957 58134
20443 88720
20834 89483
77577 94705
7835 30030
37387 59648
8364 76478
66145 76025
12683 79475
1745 33181
43966 5...

output:


result:


Subtask #5:

score: 0
Memory Limit Exceeded

Dependency #3:

100%
Accepted

Test #43:

score: 36
Accepted
time: 238ms
memory: 106148kb

input:

10000 100000 100000
3562 3915
1697 3165
2781 9598
517 7956
67 1645
7917 8056
4531 6982
4378 4914
1640 4541
579 1707
8251 8447
1047 7601
1863 6879
5956 7928
263 1288
2481 9442
300 873
2272 4832
1368 4916
4527 5086
1845 3487
3729 5020
2678 5996
4428 6862
2903 4350
3196 8329
5183 8308
933 2580
7477 882...

output:

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

result:

ok 100000 lines

Test #44:

score: 36
Accepted
time: 229ms
memory: 106432kb

input:

10000 100000 100000
7339 8214
7911 8071
8852 8854
1944 5204
4249 5801
7661 8495
4621 6520
2831 4701
6455 9198
1756 4005
2195 6028
2726 5111
2071 6144
2789 4370
133 5601
1707 7009
6436 8972
1277 9432
2349 4147
1934 2324
2292 9959
3505 5080
6675 7080
969 5968
817 2817
6310 7380
1401 4003
2772 8167
326...

output:

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

result:

ok 100000 lines

Test #45:

score: 0
Memory Limit Exceeded

input:

100000 100000 100000
44237 85021
45776 80409
39632 94735
28119 63770
47399 73347
28902 87358
27924 65499
23898 54817
50114 96633
11325 37690
46642 94643
9271 47594
47324 47948
27957 58134
20443 88720
20834 89483
77577 94705
7835 30030
37387 59648
8364 76478
66145 76025
12683 79475
1745 33181
43966 5...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%