QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#521593 | #8921. Интерактивные переходы | hcywoi | 100 ✓ | 76ms | 22080kb | C++23 | 2.2kb | 2024-08-16 12:54:46 | 2024-08-16 12:54:49 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
int n, m;
std::cin >> n >> m;
std::vector<int> a(m), b(m), c(m);
for (int i = 0; i < m; i ++ ) {
std::cin >> a[i] >> b[i] >> c[i];
a[i] --, b[i] -- ;
}
std::vector<int> d(n);
for (int i = 0; i < n; i ++ ) {
std::cin >> d[i];
}
for (int i = 0; i < m; i ++ ) {
if (d[a[i]] == d[b[i]] && c[i] != d[a[i]]) {
std::cout << "NO\n";
return;
}
}
std::vector<int> deg(n);
std::vector<std::vector<int>> adj(n);
std::vector<std::vector<std::pair<int, int>>> egs(n);
for (int i = 0; i < m; i ++ ) {
if (d[a[i]] == d[b[i]]) {
continue;
}
egs[a[i]].emplace_back(b[i], c[i]);
egs[b[i]].emplace_back(a[i], c[i]);
}
std::vector<int> change(n);
for (int i = 0; i < n; i ++ ) {
bool ok = 1;
for (auto j : egs[i]) {
if (j.second && !d[i]) {
ok = 0;
break;
}
}
if (!ok) {
change[i] = 1;
for (auto j : egs[i]) {
if (j.second != d[i] ^ 1) {
change[j.first] = 1;
}
}
}
}
for (int i = 0; i < n; i ++ ) {
if (!change[i]) {
continue;
}
for (auto j : egs[i]) {
if (j.second != d[i] ^ 1) {
adj[j.first].push_back(i);
deg[i] ++ ;
}
}
}
std::queue<int> q;
for (int i = 0; i < n; i ++ ) {
if (!deg[i]) {
q.push(i);
}
}
std::vector<int> top;
while (!q.empty()) {
int x = q.front();
q.pop();
top.push_back(x);
for (auto y : adj[x]) {
if ( -- deg[y] == 0) {
q.push(y);
}
}
}
if (top.size() != n) {
std::cout << "NO\n";
return;
}
std::cout << "YES\n";
std::reverse(top.begin(), top.end());
std::vector<std::pair<int, int>> seq;
for (int i = 0; i < n; i ++ ) {
if (d[i]) {
seq.emplace_back(i, 1);
}
}
for (int i = 0; i < n; i ++ ) {
if (change[top[i]]) {
seq.emplace_back(top[i], d[top[i]] ^ 1);
seq.emplace_back(top[i], d[top[i]]);
}
}
std::cout << seq.size() << "\n";
for (auto op : seq) {
std::cout << op.first + 1 << " " << op.second << "\n";
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
std::cin >> t;
while (t -- ) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 4
Accepted
Test #1:
score: 4
Accepted
time: 1ms
memory: 3888kb
input:
230 1 0 0 1 0 1 2 0 0 0 2 0 1 0 2 0 0 1 2 0 1 1 2 1 1 2 1 0 0 2 1 1 2 1 1 0 2 1 1 2 1 0 1 2 1 1 2 1 1 1 2 1 1 2 0 0 0 2 1 1 2 0 1 0 2 1 1 2 0 0 1 2 1 1 2 0 1 1 3 0 0 0 0 3 0 1 0 0 3 0 0 1 0 3 0 1 1 0 3 0 0 0 1 3 0 1 0 1 3 0 0 1 1 3 0 1 1 1 3 1 1 2 1 0 0 0 3 1 1 2 1 1 0 0 3 1 1 2 1 0 1 0 3 1 1 2 1 1 ...
output:
YES 0 YES 1 1 1 YES 0 YES 1 1 1 YES 1 2 1 YES 2 1 1 2 1 NO YES 3 1 1 2 1 2 0 YES 3 2 1 1 1 1 0 YES 2 1 1 2 1 YES 0 YES 1 1 1 YES 1 2 1 NO YES 0 YES 1 1 1 YES 1 2 1 YES 2 1 1 2 1 YES 1 3 1 YES 2 1 1 3 1 YES 2 2 1 3 1 YES 3 1 1 2 1 3 1 NO YES 3 1 1 2 1 2 0 YES 3 2 1 1 1 1 0 YES 2 1 1 2 1 NO YES 4 1 1 ...
result:
ok ok (230 test cases)
Subtask #2:
score: 10
Accepted
Test #2:
score: 10
Accepted
time: 1ms
memory: 3652kb
input:
222 5 9 1 2 1 2 4 1 3 5 0 4 5 1 2 3 0 3 4 0 1 3 0 2 5 1 1 4 1 1 0 0 1 1 5 9 2 5 0 1 2 0 2 3 0 1 4 0 3 5 1 3 4 0 2 4 0 1 5 0 1 3 0 0 0 1 0 0 5 9 3 4 0 1 2 0 3 5 1 2 4 0 1 3 0 2 5 0 2 3 0 1 4 0 4 5 1 0 0 0 0 1 5 9 3 5 0 2 3 0 1 2 0 3 4 0 1 3 0 2 4 1 4 5 1 1 5 0 2 5 0 0 0 0 1 0 5 9 1 3 0 2 4 1 1 2 0 4 ...
output:
YES 5 1 1 4 1 5 1 2 1 2 0 YES 3 3 1 5 1 5 0 YES 5 5 1 4 1 4 0 3 1 3 0 YES 5 4 1 5 1 5 0 2 1 2 0 YES 9 2 1 3 1 4 1 5 1 5 0 3 0 3 1 2 0 2 1 YES 3 1 1 2 1 4 1 YES 9 1 1 2 1 4 1 5 1 5 0 3 1 3 0 1 0 1 1 YES 9 2 1 3 1 4 1 5 1 5 0 1 1 1 0 4 0 4 1 YES 3 2 1 4 1 5 1 YES 9 1 1 3 1 5 1 2 1 2 0 5 0 5 1 1 0 1 1 ...
result:
ok ok (222 test cases)
Test #3:
score: 10
Accepted
time: 0ms
memory: 3648kb
input:
1 6 7 1 2 1 2 3 0 2 4 1 2 5 1 3 6 1 4 5 0 5 6 0 1 1 0 0 0 1
output:
NO
result:
ok ok (1 test case)
Test #4:
score: 10
Accepted
time: 1ms
memory: 3888kb
input:
250 6 8 1 6 1 3 4 1 2 5 0 2 6 1 5 6 1 3 6 1 4 6 1 4 5 0 0 1 1 1 0 1 6 8 2 4 1 5 6 1 1 3 0 2 5 1 3 5 0 1 5 0 2 3 0 3 4 0 0 1 0 1 1 1 6 8 1 4 0 3 5 0 2 3 1 1 3 0 3 6 0 3 4 1 2 5 1 5 6 0 0 1 0 1 0 0 6 8 2 4 0 1 6 1 1 2 0 3 5 1 4 5 1 1 5 1 2 6 0 2 5 0 0 0 1 1 1 1 6 8 2 3 1 1 3 1 1 4 1 4 6 1 4 5 1 2 5 0 ...
output:
YES 12 2 1 3 1 4 1 6 1 5 1 5 0 4 0 4 1 2 0 2 1 1 1 1 0 YES 4 2 1 4 1 5 1 6 1 YES 6 2 1 4 1 5 1 5 0 3 1 3 0 YES 6 3 1 4 1 5 1 6 1 1 1 1 0 YES 10 1 1 3 1 4 1 5 1 2 1 2 0 6 1 6 0 5 0 5 1 YES 8 1 1 3 1 4 1 5 1 2 1 2 0 4 0 4 1 YES 10 2 1 3 1 4 1 6 1 1 1 1 0 5 1 5 0 2 0 2 1 YES 10 1 1 2 1 3 1 4 1 6 1 6 0 ...
result:
ok ok (250 test cases)
Test #5:
score: 10
Accepted
time: 1ms
memory: 3592kb
input:
100 14 0 1 0 0 1 0 1 0 1 0 0 0 1 1 0 14 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 14 0 0 0 0 0 1 0 0 0 0 1 0 1 1 0 14 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 14 0 0 1 1 0 1 0 0 0 1 1 1 0 0 0 14 0 0 0 0 0 0 1 1 1 1 1 0 0 0 1 14 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 14 0 0 1 0 1 1 0 0 1 0 1 0 0 0 1 14 0 0 0 1 0 0 1 0 1 1 1 1 0 1 1...
output:
YES 6 1 1 4 1 6 1 8 1 12 1 13 1 YES 2 3 1 13 1 YES 4 5 1 10 1 12 1 13 1 YES 4 3 1 4 1 8 1 13 1 YES 6 2 1 3 1 5 1 9 1 10 1 11 1 YES 6 6 1 7 1 8 1 9 1 10 1 14 1 YES 4 7 1 10 1 12 1 14 1 YES 6 2 1 4 1 5 1 8 1 10 1 14 1 YES 8 3 1 6 1 8 1 9 1 10 1 11 1 13 1 14 1 YES 10 1 1 3 1 6 1 7 1 8 1 9 1 11 1 12 1 1...
result:
ok ok (100 test cases)
Subtask #3:
score: 8
Accepted
Test #6:
score: 8
Accepted
time: 29ms
memory: 3656kb
input:
4000 20 25 14 18 1 14 16 1 2 18 1 2 3 1 11 17 1 4 17 1 10 14 1 2 7 1 11 12 1 6 8 1 15 20 1 6 17 1 7 8 1 7 9 1 7 16 1 17 19 1 1 17 1 12 17 1 2 17 1 11 20 1 3 8 1 11 19 1 5 14 1 2 13 1 3 16 1 1 1 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 1 1 1 20 25 3 15 1 12 17 1 5 12 1 9 14 1 15 17 1 9 10 1 5 14 1 7 20 1 10 18 ...
output:
YES 25 1 1 2 1 4 1 5 1 6 1 7 1 8 1 10 1 11 1 15 1 16 1 17 1 18 1 19 1 20 1 14 1 14 0 13 1 13 0 12 1 12 0 9 1 9 0 3 1 3 0 YES 26 4 1 6 1 7 1 8 1 9 1 10 1 12 1 14 1 15 1 16 1 17 1 19 1 20 1 20 0 18 1 18 0 13 1 13 0 11 1 11 0 5 1 5 0 3 1 3 0 2 1 2 0 YES 27 1 1 2 1 3 1 5 1 6 1 7 1 13 1 14 1 15 1 16 1 17...
result:
ok ok (4000 test cases)
Test #7:
score: 8
Accepted
time: 15ms
memory: 4652kb
input:
1 100000 99999 1 87012 1 1 87571 1 2 73382 1 3 3711 1 3 15350 1 3 46773 1 3 56986 1 5 38515 1 5 70500 1 5 85371 1 6 7257 1 6 16656 1 6 47387 1 6 72385 1 6 90108 1 7 14999 1 7 61148 1 7 75467 1 7 87271 1 9 65212 1 9 67960 1 10 7122 1 10 21728 1 11 5206 1 11 24063 1 11 32274 1 12 69255 1 13 48758 1 13...
output:
NO
result:
ok ok (1 test case)
Test #8:
score: 8
Accepted
time: 26ms
memory: 15248kb
input:
1 100000 99999 1 35181 1 2 42232 1 3 13315 1 4 27383 1 4 67403 1 8 16000 1 8 57200 1 8 83634 1 9 38773 1 9 48963 1 9 75230 1 9 90121 1 10 35736 1 11 4072 1 11 13341 1 11 26005 1 12 79774 1 14 7232 1 14 8821 1 14 33012 1 14 41943 1 14 68173 1 14 78849 1 14 91086 1 14 95531 1 15 5822 1 15 49700 1 18 3...
output:
YES 127552 1 1 2 1 3 1 4 1 9 1 14 1 18 1 21 1 24 1 26 1 28 1 31 1 38 1 40 1 41 1 44 1 45 1 46 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 58 1 59 1 63 1 64 1 67 1 71 1 72 1 75 1 76 1 77 1 78 1 82 1 84 1 86 1 87 1 89 1 91 1 95 1 98 1 99 1 104 1 106 1 110 1 112 1 113 1 115 1 124 1 125 1 127 1 128 1 132 1 135...
result:
ok ok (1 test case)
Test #9:
score: 8
Accepted
time: 8ms
memory: 3988kb
input:
1 50000 49998 1 11048 1 1 12289 1 2 12244 1 2 31474 1 5 8297 1 5 28740 1 5 42907 1 6 3977 1 7 30422 1 8 24707 1 9 2499 1 9 13069 1 9 25545 1 10 26569 1 10 33390 1 11 1042 1 11 1769 1 12 15195 1 12 26515 1 12 44207 1 13 19568 1 13 21995 1 14 13136 1 15 17511 1 15 20144 1 15 34964 1 15 48216 1 16 1882...
output:
NO
result:
ok ok (1 test case)
Test #10:
score: 8
Accepted
time: 14ms
memory: 9380kb
input:
1 50000 49998 1 33649 1 1 38342 1 2 16465 1 2 45368 1 2 48541 1 3 14297 1 3 14338 1 3 43149 1 5 24062 1 5 40478 1 6 39136 1 7 8171 1 7 47461 1 8 41007 1 9 38951 1 9 47384 1 9 49343 1 10 20889 1 10 33345 1 11 11776 1 11 38722 1 12 44642 1 13 490 1 13 9412 1 13 26137 1 13 32356 1 13 39692 1 14 31978 1...
output:
YES 63923 5 1 7 1 8 1 10 1 11 1 13 1 20 1 21 1 24 1 26 1 30 1 31 1 33 1 35 1 36 1 39 1 41 1 42 1 43 1 45 1 47 1 48 1 51 1 53 1 55 1 57 1 62 1 64 1 66 1 71 1 72 1 73 1 78 1 79 1 81 1 83 1 84 1 85 1 88 1 89 1 90 1 93 1 99 1 101 1 104 1 106 1 107 1 109 1 110 1 112 1 113 1 115 1 117 1 121 1 122 1 123 1 ...
result:
ok ok (1 test case)
Subtask #4:
score: 6
Accepted
Test #11:
score: 6
Accepted
time: 31ms
memory: 3600kb
input:
10000 10 9 1 2 0 1 3 0 1 4 0 1 5 0 1 6 0 1 7 0 1 8 0 1 9 0 1 10 0 0 0 0 0 0 0 1 1 0 0 10 9 1 2 1 1 3 0 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 1 10 0 1 1 0 0 1 1 1 0 1 0 10 9 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 1 10 1 1 0 0 0 1 1 0 0 1 0 10 9 1 2 0 1 3 0 1 4 1 1 5 1 1 6 0 1 7 1 1 8 1 1 9 1 1...
output:
YES 2 7 1 8 1 YES 10 1 1 2 1 5 1 6 1 7 1 9 1 8 1 8 0 4 1 4 0 YES 16 1 1 5 1 6 1 9 1 10 1 10 0 8 1 8 0 7 1 7 0 4 1 4 0 3 1 3 0 2 1 2 0 YES 8 4 1 5 1 7 1 8 1 9 1 10 1 1 1 1 0 YES 10 1 1 2 1 3 1 4 1 5 1 6 1 7 1 9 1 8 1 8 0 YES 10 1 1 2 1 6 1 9 1 8 1 8 0 5 1 5 0 4 1 4 0 YES 14 1 1 4 1 5 1 6 1 8 1 10 1 9...
result:
ok ok (10000 test cases)
Test #12:
score: 6
Accepted
time: 23ms
memory: 4040kb
input:
100 1000 999 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 1 10 1 1 11 1 1 12 1 1 13 1 1 14 1 1 15 1 1 16 1 1 17 1 1 18 1 1 19 1 1 20 1 1 21 1 1 22 1 1 23 1 1 24 1 1 25 1 1 26 1 1 27 1 1 28 1 1 29 1 1 30 1 1 31 1 1 32 1 1 33 1 1 34 1 1 35 1 1 36 1 1 37 1 1 38 0 1 39 1 1 40 1 1 41 1 1 42 1 1 43 1 1...
output:
YES 1382 1 1 2 1 5 1 6 1 7 1 8 1 12 1 15 1 16 1 17 1 19 1 21 1 24 1 27 1 30 1 31 1 32 1 40 1 41 1 42 1 45 1 51 1 52 1 53 1 54 1 58 1 63 1 64 1 66 1 69 1 72 1 81 1 82 1 83 1 84 1 85 1 86 1 88 1 91 1 92 1 93 1 96 1 101 1 102 1 103 1 106 1 107 1 111 1 112 1 114 1 117 1 120 1 121 1 122 1 123 1 125 1 127...
result:
ok ok (100 test cases)
Test #13:
score: 6
Accepted
time: 29ms
memory: 14224kb
input:
1 100000 99999 1 2 1 1 3 1 1 4 1 1 5 1 1 6 1 1 7 1 1 8 1 1 9 1 1 10 1 1 11 1 1 12 1 1 13 0 1 14 0 1 15 0 1 16 0 1 17 0 1 18 1 1 19 1 1 20 1 1 21 0 1 22 0 1 23 1 1 24 1 1 25 0 1 26 0 1 27 1 1 28 0 1 29 0 1 30 0 1 31 1 1 32 0 1 33 0 1 34 0 1 35 0 1 36 1 1 37 1 1 38 1 1 39 0 1 40 1 1 41 0 1 42 1 1 43 0...
output:
YES 75854 1 1 2 1 3 1 4 1 6 1 8 1 9 1 10 1 12 1 19 1 23 1 24 1 27 1 31 1 36 1 37 1 38 1 40 1 42 1 48 1 52 1 53 1 56 1 58 1 59 1 61 1 62 1 63 1 64 1 67 1 68 1 69 1 70 1 72 1 73 1 74 1 75 1 77 1 78 1 81 1 82 1 83 1 84 1 86 1 88 1 91 1 95 1 96 1 99 1 100 1 102 1 105 1 107 1 108 1 109 1 114 1 116 1 118 ...
result:
ok ok (1 test case)
Subtask #5:
score: 6
Accepted
Test #14:
score: 6
Accepted
time: 56ms
memory: 18580kb
input:
1 100000 199997 1 19238 0 1 42340 0 1 50103 0 1 72140 0 1 94374 0 2 918 1 2 30562 1 2 48451 1 2 53070 1 2 77905 1 3 56418 0 3 61803 0 4 19423 0 4 33995 0 4 64168 0 4 83220 0 4 87239 0 5 24531 1 5 45512 1 6 23321 1 6 34013 1 6 36584 1 6 37278 1 7 16740 1 7 23485 1 7 63378 1 7 71568 1 7 80434 1 7 8103...
output:
YES 137846 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 15 1 17 1 18 1 19 1 20 1 22 1 30 1 31 1 33 1 34 1 35 1 39 1 42 1 43 1 45 1 51 1 53 1 56 1 57 1 58 1 61 1 63 1 64 1 65 1 68 1 70 1 74 1 81 1 83 1 85 1 86 1 89 1 90 1 92 1 93 1 94 1 97 1 98 1 99 1 101 1 104 1 106 1 107 1 110 1 111 1 112 1 114 1 11...
result:
ok ok (1 test case)
Test #15:
score: 6
Accepted
time: 32ms
memory: 14400kb
input:
1 100000 199990 1 12954 0 1 34837 0 1 56925 0 2 2727 0 2 23291 0 2 34498 0 2 83496 0 3 18494 0 3 38160 0 3 95686 0 4 4643 0 4 42952 0 4 60758 0 4 74112 0 5 5226 0 5 99964 0 6 25938 0 6 29934 0 6 95643 0 7 12538 0 7 15788 0 7 36142 0 7 83988 0 7 87408 0 8 51940 0 8 89269 0 8 95253 0 9 8664 0 9 46696 ...
output:
YES 46021 20 1 21 1 39 1 46 1 48 1 51 1 59 1 60 1 70 1 104 1 108 1 113 1 115 1 134 1 137 1 143 1 146 1 152 1 157 1 160 1 167 1 190 1 198 1 207 1 208 1 214 1 216 1 220 1 232 1 233 1 248 1 273 1 291 1 310 1 319 1 325 1 345 1 347 1 349 1 362 1 363 1 378 1 388 1 390 1 393 1 397 1 404 1 414 1 426 1 444 1...
result:
ok ok (1 test case)
Test #16:
score: 6
Accepted
time: 36ms
memory: 15408kb
input:
1 100000 199993 1 35659 1 1 40405 1 1 42576 1 1 59472 1 1 93456 1 2 5554 1 2 13807 1 2 16320 1 2 72601 1 2 89825 1 4 39136 1 4 56509 1 4 91423 1 5 8219 1 5 38830 1 5 42490 1 5 85394 1 5 99701 1 6 9204 0 6 25338 0 6 33566 0 6 56606 0 6 63549 0 7 3241 1 7 52579 1 7 75681 1 7 97174 1 8 18865 1 8 30353 ...
output:
YES 123379 1 1 2 1 4 1 5 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 45 1 46 1 47 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 64 1 65 1 66 1 67 1 68 1 6...
result:
ok ok (1 test case)
Test #17:
score: 6
Accepted
time: 39ms
memory: 13460kb
input:
1 50000 199980 1 5699 0 1 7972 0 1 12001 0 1 21408 0 1 22748 0 1 23379 0 1 28184 0 1 34803 0 1 36835 0 1 47782 0 2 4067 1 2 4247 1 2 5958 1 2 10022 1 2 13882 1 2 18781 1 2 22215 1 2 29259 1 2 40478 1 2 47186 1 3 10820 0 3 11187 0 3 13770 0 3 14191 0 3 31138 0 3 32240 0 3 41566 0 3 46910 0 3 46981 0 ...
output:
YES 92285 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 14 1 15 1 16 1 18 1 19 1 21 1 22 1 27 1 30 1 31 1 32 1 33 1 34 1 41 1 42 1 46 1 47 1 48 1 50 1 53 1 54 1 57 1 58 1 61 1 62 1 66 1 68 1 71 1 73 1 78 1 79 1 80 1 83 1 84 1 89 1 90 1 93 1 94 1 95 1 96 1 97 1 99 1 103 1 104 1 108 1 111 1 114 1 116 1 117 1...
result:
ok ok (1 test case)
Test #18:
score: 6
Accepted
time: 31ms
memory: 11156kb
input:
1 50000 199984 1 25616 0 1 28351 0 1 32669 0 1 39879 0 1 40034 0 1 46455 0 2 3271 0 2 6427 0 2 14884 0 2 16854 0 2 17651 0 2 32673 0 2 41393 0 2 43967 0 2 44086 0 2 44357 0 3 2536 1 3 7684 1 3 12630 1 3 15608 1 3 17831 1 3 18085 1 3 18694 1 3 18753 1 3 26697 1 3 31231 1 3 41382 1 3 41549 1 3 43442 1...
output:
YES 36616 3 1 7 1 9 1 12 1 15 1 36 1 65 1 68 1 69 1 71 1 77 1 82 1 85 1 98 1 125 1 129 1 132 1 154 1 158 1 165 1 170 1 207 1 208 1 237 1 250 1 290 1 292 1 296 1 297 1 313 1 317 1 334 1 359 1 362 1 365 1 372 1 375 1 393 1 396 1 409 1 415 1 457 1 464 1 469 1 481 1 487 1 492 1 494 1 498 1 505 1 550 1 5...
result:
ok ok (1 test case)
Test #19:
score: 6
Accepted
time: 39ms
memory: 11624kb
input:
1 50000 199987 1 7346 1 1 9333 1 1 10752 1 1 22449 1 1 26223 1 1 31067 1 1 36063 1 1 39164 1 2 26857 1 2 27426 1 2 45924 1 2 49776 1 3 3534 1 3 4872 1 3 11112 1 3 18587 1 3 19344 1 3 46857 1 4 5591 1 4 10896 1 4 28314 1 4 32866 1 4 36674 1 4 42045 1 5 2392 1 5 17180 1 5 31349 1 5 34495 1 5 40344 1 5...
output:
YES 75621 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 33 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 45 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 57 1 58 1 59 1 60 1 61 1 63 1 64 1 65 1 66 1 67 1 68 1 69 1 70 1...
result:
ok ok (1 test case)
Test #20:
score: 6
Accepted
time: 34ms
memory: 13412kb
input:
1 100000 199995 1 11260 1 1 36669 1 1 65689 1 2 40027 1 3 11510 1 3 22649 1 3 41557 1 3 55383 1 3 94145 1 4 29777 1 4 34184 1 4 82941 1 4 98660 1 5 70248 1 6 1352 1 6 41406 1 6 50445 1 6 61232 1 6 67229 1 7 24577 1 7 36777 1 7 54446 1 8 5817 1 8 48484 1 9 37743 1 9 41038 1 9 57888 1 9 91818 1 10 708...
output:
YES 100000 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 ...
result:
ok ok (1 test case)
Test #21:
score: 6
Accepted
time: 30ms
memory: 12484kb
input:
1 100000 199997 1 5769 0 1 6630 0 1 16266 0 1 87415 0 2 23456 0 2 34333 0 2 56018 0 2 58848 0 3 958 0 4 19451 0 4 40396 0 5 23284 0 5 37108 0 6 40220 0 6 53501 0 6 66616 0 6 78456 0 6 98427 0 7 15922 0 7 63343 0 7 73387 0 7 89652 0 8 20051 0 8 39219 0 8 75071 0 9 2884 0 9 53733 0 9 54398 0 9 68547 0...
output:
YES 0
result:
ok ok (1 test case)
Subtask #6:
score: 8
Accepted
Test #22:
score: 8
Accepted
time: 1ms
memory: 3620kb
input:
1 2000 1999 1 2 0 2 3 0 3 4 0 4 5 1 5 6 0 6 7 0 7 8 0 8 9 1 9 10 1 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 1 19 20 1 20 21 1 21 22 1 22 23 0 23 24 1 24 25 1 25 26 1 26 27 1 27 28 0 28 29 1 29 30 0 30 31 1 31 32 0 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 0 38 39 1 3...
output:
NO
result:
ok ok (1 test case)
Test #23:
score: 8
Accepted
time: 0ms
memory: 3856kb
input:
1 2000 1999 1 2 1 2 3 1 3 4 1 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 1 10 11 1 11 12 1 12 13 1 13 14 1 14 15 0 15 16 0 16 17 0 17 18 0 18 19 1 19 20 0 20 21 0 21 22 0 22 23 0 23 24 1 24 25 1 25 26 0 26 27 0 27 28 0 28 29 1 29 30 1 30 31 1 31 32 0 32 33 0 33 34 0 34 35 0 35 36 0 36 37 1 37 38 0 38 39 0 3...
output:
YES 2124 1 1 2 1 3 1 10 1 11 1 12 1 13 1 14 1 18 1 23 1 24 1 25 1 28 1 29 1 30 1 32 1 36 1 39 1 41 1 42 1 43 1 44 1 49 1 50 1 51 1 54 1 57 1 58 1 60 1 63 1 65 1 66 1 67 1 68 1 70 1 71 1 81 1 83 1 86 1 87 1 88 1 90 1 92 1 94 1 97 1 99 1 100 1 102 1 103 1 105 1 107 1 108 1 114 1 115 1 118 1 120 1 121 ...
result:
ok ok (1 test case)
Test #24:
score: 8
Accepted
time: 1ms
memory: 3688kb
input:
1 2000 1999 1 2 0 2 3 1 3 4 1 4 5 0 5 6 0 6 7 1 7 8 1 8 9 1 9 10 1 10 11 0 11 12 1 12 13 1 13 14 1 14 15 0 15 16 0 16 17 0 17 18 1 18 19 0 19 20 0 20 21 1 21 22 0 22 23 1 23 24 1 24 25 1 25 26 1 26 27 0 27 28 0 28 29 1 29 30 0 30 31 0 31 32 1 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 0 38 39 0 3...
output:
NO
result:
ok ok (1 test case)
Test #25:
score: 8
Accepted
time: 0ms
memory: 3844kb
input:
1 2000 1999 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 0 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 1 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 0 35 36 0 36 37 0 37 38 0 38 39 0 3...
output:
YES 582 23 1 31 1 44 1 49 1 55 1 57 1 58 1 66 1 67 1 68 1 70 1 78 1 91 1 93 1 101 1 106 1 113 1 116 1 130 1 133 1 140 1 141 1 150 1 159 1 173 1 183 1 215 1 229 1 242 1 243 1 247 1 252 1 260 1 263 1 266 1 289 1 320 1 336 1 362 1 363 1 399 1 401 1 408 1 420 1 471 1 476 1 477 1 480 1 482 1 498 1 500 1 ...
result:
ok ok (1 test case)
Test #26:
score: 8
Accepted
time: 1ms
memory: 3616kb
input:
1 2000 1999 1 2 0 2 3 0 3 4 1 4 5 1 5 6 0 6 7 0 7 8 0 8 9 1 9 10 0 10 11 0 11 12 1 12 13 1 13 14 1 14 15 1 15 16 1 16 17 1 17 18 0 18 19 0 19 20 1 20 21 1 21 22 1 22 23 0 23 24 0 24 25 1 25 26 0 26 27 1 27 28 1 28 29 1 29 30 0 30 31 0 31 32 0 32 33 0 33 34 1 34 35 0 35 36 0 36 37 1 37 38 1 38 39 0 3...
output:
NO
result:
ok ok (1 test case)
Test #27:
score: 8
Accepted
time: 1ms
memory: 4116kb
input:
1 2000 1999 1 2 1 2 3 1 3 4 1 4 5 0 5 6 1 6 7 1 7 8 1 8 9 1 9 10 1 10 11 1 11 12 1 12 13 1 13 14 1 14 15 1 15 16 1 16 17 1 17 18 1 18 19 1 19 20 1 20 21 1 21 22 1 22 23 1 23 24 0 24 25 1 25 26 1 26 27 1 27 28 1 28 29 1 29 30 1 30 31 1 31 32 1 32 33 1 33 34 1 34 35 1 35 36 1 36 37 1 37 38 1 38 39 1 3...
output:
YES 2211 1 1 2 1 3 1 4 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 63 1 64 1...
result:
ok ok (1 test case)
Test #28:
score: 8
Accepted
time: 1ms
memory: 3588kb
input:
128 4 3 1 2 0 2 3 0 3 4 0 0 0 0 0 4 3 1 2 1 2 3 0 3 4 0 0 0 0 0 4 3 1 2 0 2 3 1 3 4 0 0 0 0 0 4 3 1 2 1 2 3 1 3 4 0 0 0 0 0 4 3 1 2 0 2 3 0 3 4 1 0 0 0 0 4 3 1 2 1 2 3 0 3 4 1 0 0 0 0 4 3 1 2 0 2 3 1 3 4 1 0 0 0 0 4 3 1 2 1 2 3 1 3 4 1 0 0 0 0 4 3 1 2 0 2 3 0 3 4 0 1 0 0 0 4 3 1 2 1 2 3 0 3 4 0 1 0 ...
output:
YES 0 NO NO NO NO NO NO NO YES 1 1 1 YES 3 1 1 2 1 2 0 NO NO NO NO NO NO YES 1 2 1 YES 3 2 1 1 1 1 0 YES 3 2 1 3 1 3 0 YES 5 2 1 3 1 3 0 1 1 1 0 NO NO NO NO NO YES 2 1 1 2 1 NO YES 4 1 1 2 1 3 1 3 0 NO NO NO NO YES 1 3 1 NO YES 3 3 1 2 1 2 0 NO YES 3 3 1 4 1 4 0 NO YES 5 3 1 4 1 4 0 2 1 2 0 NO YES 2...
result:
ok ok (128 test cases)
Subtask #7:
score: 8
Accepted
Dependency #6:
100%
Accepted
Test #29:
score: 8
Accepted
time: 16ms
memory: 4680kb
input:
1 100000 99999 1 2 0 2 3 0 3 4 0 4 5 1 5 6 1 6 7 0 7 8 0 8 9 1 9 10 0 10 11 1 11 12 1 12 13 0 13 14 0 14 15 1 15 16 1 16 17 1 17 18 0 18 19 1 19 20 0 20 21 0 21 22 1 22 23 0 23 24 1 24 25 1 25 26 1 26 27 1 27 28 0 28 29 0 29 30 1 30 31 0 31 32 0 32 33 0 33 34 1 34 35 1 35 36 1 36 37 0 37 38 1 38 39 ...
output:
NO
result:
ok ok (1 test case)
Test #30:
score: 8
Accepted
time: 35ms
memory: 15024kb
input:
1 100000 99999 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 1 9 10 0 10 11 0 11 12 0 12 13 1 13 14 0 14 15 0 15 16 1 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 0 23 24 1 24 25 1 25 26 0 26 27 0 27 28 0 28 29 1 29 30 0 30 31 0 31 32 1 32 33 1 33 34 0 34 35 0 35 36 0 36 37 0 37 38 0 38 39 ...
output:
YES 105946 1 1 8 1 9 1 12 1 13 1 16 1 23 1 24 1 28 1 29 1 31 1 32 1 40 1 41 1 42 1 45 1 46 1 47 1 52 1 53 1 54 1 55 1 58 1 62 1 64 1 66 1 67 1 71 1 72 1 74 1 77 1 78 1 79 1 80 1 83 1 84 1 87 1 88 1 97 1 100 1 101 1 102 1 104 1 105 1 107 1 109 1 110 1 112 1 113 1 118 1 120 1 121 1 124 1 126 1 127 1 1...
result:
ok ok (1 test case)
Test #31:
score: 8
Accepted
time: 7ms
memory: 4652kb
input:
1 100000 99999 1 2 0 2 3 0 3 4 0 4 5 1 5 6 1 6 7 0 7 8 0 8 9 1 9 10 0 10 11 0 11 12 1 12 13 0 13 14 1 14 15 0 15 16 0 16 17 1 17 18 1 18 19 1 19 20 0 20 21 1 21 22 0 22 23 1 23 24 1 24 25 0 25 26 1 26 27 1 27 28 1 28 29 0 29 30 1 30 31 1 31 32 0 32 33 1 33 34 1 34 35 0 35 36 1 36 37 0 37 38 1 38 39 ...
output:
NO
result:
ok ok (1 test case)
Test #32:
score: 8
Accepted
time: 18ms
memory: 12076kb
input:
1 100000 99999 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 0 11 12 0 12 13 1 13 14 1 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 0 23 24 0 24 25 0 25 26 0 26 27 0 27 28 1 28 29 1 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 0 35 36 0 36 37 0 37 38 0 38 39 ...
output:
YES 28597 13 1 17 1 28 1 33 1 35 1 49 1 73 1 86 1 91 1 93 1 96 1 111 1 118 1 130 1 131 1 136 1 147 1 166 1 171 1 204 1 210 1 214 1 220 1 222 1 245 1 281 1 289 1 290 1 297 1 302 1 304 1 313 1 322 1 345 1 352 1 372 1 388 1 401 1 418 1 422 1 429 1 448 1 452 1 453 1 454 1 462 1 465 1 468 1 473 1 475 1 4...
result:
ok ok (1 test case)
Test #33:
score: 8
Accepted
time: 15ms
memory: 4676kb
input:
1 100000 99999 1 2 1 2 3 1 3 4 0 4 5 0 5 6 1 6 7 1 7 8 0 8 9 0 9 10 1 10 11 0 11 12 0 12 13 1 13 14 0 14 15 1 15 16 1 16 17 1 17 18 1 18 19 0 19 20 1 20 21 0 21 22 1 22 23 0 23 24 1 24 25 0 25 26 1 26 27 0 27 28 1 28 29 1 29 30 1 30 31 0 31 32 1 32 33 1 33 34 0 34 35 1 35 36 1 36 37 1 37 38 1 38 39 ...
output:
NO
result:
ok ok (1 test case)
Test #34:
score: 8
Accepted
time: 31ms
memory: 13228kb
input:
1 100000 99999 1 2 0 2 3 1 3 4 1 4 5 1 5 6 1 6 7 1 7 8 1 8 9 1 9 10 1 10 11 1 11 12 1 12 13 1 13 14 1 14 15 1 15 16 1 16 17 1 17 18 1 18 19 1 19 20 1 20 21 1 21 22 0 22 23 0 23 24 0 24 25 1 25 26 1 26 27 1 27 28 0 28 29 1 29 30 1 30 31 1 31 32 1 32 33 1 33 34 1 34 35 1 35 36 1 36 37 1 37 38 1 38 39 ...
output:
YES 112254 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 22 1 24 1 25 1 27 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 61 1 62 1 63 1 64 1 65 1 66 1 69 1 70...
result:
ok ok (1 test case)
Test #35:
score: 8
Accepted
time: 1ms
memory: 3628kb
input:
512 5 4 1 2 0 2 3 0 3 4 0 4 5 0 0 0 0 0 0 5 4 1 2 1 2 3 0 3 4 0 4 5 0 0 0 0 0 0 5 4 1 2 0 2 3 1 3 4 0 4 5 0 0 0 0 0 0 5 4 1 2 1 2 3 1 3 4 0 4 5 0 0 0 0 0 0 5 4 1 2 0 2 3 0 3 4 1 4 5 0 0 0 0 0 0 5 4 1 2 1 2 3 0 3 4 1 4 5 0 0 0 0 0 0 5 4 1 2 0 2 3 1 3 4 1 4 5 0 0 0 0 0 0 5 4 1 2 1 2 3 1 3 4 1 4 5 0 0 ...
output:
YES 0 NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 1 1 1 YES 3 1 1 2 1 2 0 NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 1 2 1 YES 3 2 1 1 1 1 0 YES 3 2 1 3 1 3 0 YES 5 2 1 3 1 3 0 1 1 1 0 NO NO NO NO NO NO NO NO NO NO NO NO NO YES 2 1 1 2 1 NO YES 4 1 1 2 1 3 1 3 0 NO NO NO NO NO NO NO NO NO NO...
result:
ok ok (512 test cases)
Test #36:
score: 8
Accepted
time: 3ms
memory: 3888kb
input:
2048 6 5 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 1 2 3 0 3 4 0 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 0 2 3 1 3 4 0 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 1 2 3 1 3 4 0 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 0 2 3 0 3 4 1 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 1 2 3 0 3 4 1 4 5 0 5 6 0 0 0 0 0 0 0 6 5 1 2 0 2 3 1 3 4...
output:
YES 0 NO NO NO NO NO NO NO 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 1 1 1 YES 3 1 1 2 1 2 0 NO NO NO NO NO NO 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 1 2 1 YES 3 2 1 1 1 1 0 YES 3 2 1 3 1 3 0 YES 5 2 1 3 1 3 0 1 1 1 0 NO NO NO NO...
result:
ok ok (2048 test cases)
Test #37:
score: 8
Accepted
time: 6ms
memory: 3596kb
input:
8192 7 6 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 0 0 0 0 0 0 0 7 6 1 2 1 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 0 0 0 0 0 0 0 7 6 1 2 0 2 3 1 3 4 0 4 5 0 5 6 0 6 7 0 0 0 0 0 0 0 0 7 6 1 2 1 2 3 1 3 4 0 4 5 0 5 6 0 6 7 0 0 0 0 0 0 0 0 7 6 1 2 0 2 3 0 3 4 1 4 5 0 5 6 0 6 7 0 0 0 0 0 0 0 0 7 6 1 2 1 2 3 0 3 4 1 4 5...
output:
YES 0 NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO 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 1 1 1 YES 3 1 1 2 1 2 0 NO NO 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 ok (8192 test cases)
Subtask #8:
score: 10
Accepted
Dependency #6:
100%
Accepted
Test #38:
score: 10
Accepted
time: 1ms
memory: 3628kb
input:
1 2000 1999 1 2 0 1 3 1 2 4 1 3 5 1 4 6 0 3 7 1 5 8 1 4 9 1 4 10 0 8 11 0 4 12 1 10 13 0 8 14 1 2 15 1 2 16 1 16 17 1 11 18 0 13 19 1 13 20 1 5 21 1 2 22 0 9 23 0 16 24 1 6 25 1 19 26 0 17 27 0 5 28 1 27 29 1 16 30 0 26 31 1 31 32 0 1 33 1 6 34 1 1 35 1 8 36 0 10 37 0 6 38 0 12 39 1 10 40 1 12 41 1 ...
output:
NO
result:
ok ok (1 test case)
Test #39:
score: 10
Accepted
time: 1ms
memory: 3916kb
input:
1 2000 1999 1 2 1 1 3 0 3 4 0 4 5 1 4 6 1 4 7 1 7 8 1 1 9 1 9 10 0 4 11 1 2 12 1 7 13 0 12 14 0 1 15 1 9 16 1 8 17 0 11 18 0 2 19 0 1 20 1 13 21 0 18 22 0 2 23 0 11 24 0 24 25 0 2 26 1 14 27 0 2 28 1 1 29 1 20 30 1 25 31 0 8 32 0 23 33 1 6 34 1 30 35 0 3 36 1 32 37 1 2 38 0 1 39 0 29 40 0 34 41 0 32...
output:
NO
result:
ok ok (1 test case)
Test #40:
score: 10
Accepted
time: 1ms
memory: 3884kb
input:
1 2000 1999 1 2 1 1 3 1 3 4 1 3 5 1 5 6 0 3 7 0 7 8 0 5 9 1 7 10 0 8 11 1 6 12 0 3 13 1 8 14 0 6 15 0 13 16 0 2 17 1 11 18 1 6 19 0 3 20 0 3 21 1 17 22 1 21 23 1 21 24 1 12 25 0 3 26 1 17 27 0 19 28 0 18 29 1 11 30 1 8 31 0 9 32 1 4 33 0 33 34 1 30 35 1 28 36 1 19 37 1 2 38 1 8 39 0 10 40 1 35 41 0 ...
output:
NO
result:
ok ok (1 test case)
Test #41:
score: 10
Accepted
time: 0ms
memory: 3860kb
input:
1 2000 1999 1 2 0 1 3 0 3 4 0 3 5 1 1 6 0 3 7 0 6 8 0 8 9 0 6 10 0 2 11 1 5 12 0 9 13 1 8 14 0 8 15 1 15 16 1 11 17 0 14 18 1 12 19 1 18 20 1 3 21 0 5 22 0 11 23 1 12 24 0 18 25 1 23 26 1 24 27 1 24 28 0 21 29 1 29 30 1 30 31 0 10 32 0 17 33 0 17 34 1 34 35 1 9 36 1 1 37 0 35 38 1 25 39 0 27 40 1 13...
output:
YES 2196 2 1 3 1 9 1 15 1 16 1 18 1 19 1 20 1 22 1 23 1 25 1 27 1 28 1 29 1 33 1 34 1 35 1 36 1 37 1 41 1 42 1 43 1 48 1 49 1 51 1 53 1 54 1 55 1 56 1 57 1 58 1 62 1 63 1 65 1 66 1 70 1 71 1 75 1 76 1 85 1 86 1 89 1 91 1 92 1 94 1 97 1 98 1 99 1 100 1 102 1 103 1 104 1 106 1 108 1 111 1 114 1 116 1 ...
result:
ok ok (1 test case)
Test #42:
score: 10
Accepted
time: 1ms
memory: 3860kb
input:
1 2000 1999 1 2 1 2 3 0 2 4 0 4 5 0 1 6 1 3 7 0 1 8 1 5 9 0 1 10 1 1 11 1 3 12 0 6 13 0 10 14 1 9 15 1 14 16 0 4 17 0 13 18 0 17 19 0 6 20 1 4 21 0 18 22 0 6 23 0 13 24 0 20 25 1 7 26 1 20 27 1 22 28 1 22 29 1 4 30 1 28 31 1 18 32 0 7 33 0 17 34 1 4 35 0 27 36 1 23 37 1 31 38 1 30 39 1 7 40 0 27 41 ...
output:
YES 2122 1 1 11 1 12 1 14 1 15 1 17 1 20 1 21 1 22 1 24 1 26 1 28 1 29 1 30 1 31 1 32 1 33 1 36 1 37 1 41 1 42 1 43 1 47 1 48 1 49 1 50 1 52 1 53 1 54 1 57 1 58 1 59 1 62 1 63 1 65 1 66 1 76 1 78 1 79 1 82 1 83 1 84 1 85 1 86 1 87 1 92 1 96 1 101 1 106 1 108 1 110 1 111 1 112 1 113 1 115 1 116 1 117...
result:
ok ok (1 test case)
Test #43:
score: 10
Accepted
time: 1ms
memory: 3852kb
input:
1 2000 1999 1 2 0 1 3 0 1 4 0 1 5 1 5 6 1 2 7 1 5 8 1 6 9 0 3 10 0 9 11 1 9 12 0 3 13 1 4 14 0 10 15 1 10 16 0 4 17 0 16 18 0 18 19 0 17 20 0 10 21 0 14 22 0 11 23 1 18 24 1 9 25 0 13 26 1 7 27 1 16 28 0 1 29 0 17 30 0 22 31 0 28 32 0 17 33 0 3 34 0 21 35 0 17 36 1 4 37 1 11 38 0 21 39 0 15 40 1 24 ...
output:
YES 2150 2 1 3 1 4 1 5 1 6 1 7 1 11 1 13 1 15 1 18 1 27 1 29 1 32 1 36 1 37 1 39 1 40 1 43 1 44 1 45 1 46 1 47 1 48 1 50 1 51 1 53 1 57 1 58 1 61 1 62 1 64 1 65 1 66 1 69 1 72 1 74 1 76 1 79 1 80 1 81 1 84 1 87 1 88 1 90 1 92 1 95 1 97 1 98 1 99 1 100 1 101 1 102 1 104 1 106 1 107 1 108 1 109 1 113 ...
result:
ok ok (1 test case)
Subtask #9:
score: 6
Accepted
Dependency #4:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
100%
Accepted
Dependency #8:
100%
Accepted
Test #44:
score: 6
Accepted
time: 13ms
memory: 4640kb
input:
1 100000 99999 1 2 1 1 3 1 3 4 0 2 5 1 2 6 1 2 7 0 5 8 0 8 9 0 6 10 0 5 11 0 2 12 0 8 13 0 13 14 1 3 15 1 2 16 0 8 17 0 3 18 1 18 19 0 10 20 0 17 21 0 8 22 0 11 23 1 9 24 1 10 25 1 11 26 1 25 27 0 7 28 1 3 29 1 8 30 1 17 31 0 29 32 1 28 33 1 10 34 1 13 35 0 9 36 0 15 37 0 14 38 1 31 39 1 30 40 1 40 ...
output:
NO
result:
ok ok (1 test case)
Test #45:
score: 6
Accepted
time: 12ms
memory: 4700kb
input:
1 100000 99999 1 2 0 1 3 0 2 4 0 4 5 1 2 6 0 4 7 0 6 8 1 5 9 1 3 10 0 3 11 0 11 12 1 5 13 1 2 14 1 5 15 1 1 16 1 16 17 1 2 18 1 5 19 0 1 20 1 18 21 1 3 22 0 6 23 0 4 24 0 11 25 1 19 26 1 23 27 1 16 28 0 4 29 1 12 30 0 16 31 1 7 32 1 18 33 1 10 34 1 16 35 1 5 36 1 1 37 1 32 38 0 20 39 0 21 40 1 14 41...
output:
NO
result:
ok ok (1 test case)
Test #46:
score: 6
Accepted
time: 16ms
memory: 4652kb
input:
1 100000 99999 1 2 0 1 3 0 2 4 1 3 5 1 5 6 0 1 7 1 6 8 0 2 9 0 4 10 1 2 11 0 5 12 1 1 13 1 10 14 1 5 15 1 13 16 0 13 17 1 16 18 1 18 19 0 1 20 1 14 21 1 2 22 0 5 23 1 22 24 0 11 25 0 9 26 0 17 27 1 19 28 0 26 29 1 11 30 0 20 31 1 20 32 1 6 33 1 21 34 1 32 35 0 35 36 1 9 37 0 37 38 1 34 39 1 3 40 1 1...
output:
NO
result:
ok ok (1 test case)
Test #47:
score: 6
Accepted
time: 37ms
memory: 15036kb
input:
1 100000 99999 1 2 0 2 3 0 2 4 0 3 5 0 4 6 0 4 7 0 3 8 0 4 9 1 7 10 1 2 11 0 3 12 0 7 13 0 13 14 0 9 15 1 14 16 1 3 17 0 5 18 0 15 19 1 15 20 1 8 21 1 11 22 1 16 23 0 5 24 1 6 25 0 15 26 1 7 27 0 26 28 0 24 29 1 21 30 1 20 31 1 10 32 1 12 33 1 23 34 1 12 35 1 11 36 0 6 37 0 29 38 0 6 39 0 9 40 0 33 ...
output:
YES 106820 8 1 9 1 10 1 11 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 24 1 25 1 28 1 30 1 31 1 33 1 34 1 35 1 38 1 43 1 46 1 48 1 54 1 55 1 56 1 58 1 59 1 60 1 61 1 62 1 64 1 68 1 69 1 70 1 71 1 73 1 77 1 80 1 82 1 85 1 90 1 94 1 95 1 98 1 99 1 102 1 105 1 106 1 109 1 111 1 113 1 115 1 116 1 117 1 12...
result:
ok ok (1 test case)
Test #48:
score: 6
Accepted
time: 28ms
memory: 15200kb
input:
1 100000 99999 1 2 1 2 3 1 3 4 1 4 5 0 3 6 1 4 7 0 5 8 1 1 9 0 3 10 1 8 11 0 1 12 0 3 13 1 2 14 1 11 15 0 14 16 0 11 17 0 13 18 0 4 19 1 6 20 0 17 21 0 3 22 1 9 23 1 23 24 1 7 25 1 25 26 1 2 27 1 8 28 0 26 29 1 25 30 0 19 31 1 17 32 1 2 33 1 23 34 1 16 35 0 29 36 1 28 37 0 25 38 1 11 39 0 38 40 0 7 ...
output:
YES 106878 2 1 3 1 5 1 6 1 16 1 18 1 19 1 22 1 23 1 24 1 25 1 26 1 27 1 32 1 36 1 41 1 46 1 48 1 50 1 51 1 52 1 53 1 55 1 56 1 57 1 60 1 61 1 65 1 66 1 69 1 70 1 72 1 75 1 77 1 80 1 81 1 83 1 84 1 85 1 88 1 89 1 90 1 91 1 92 1 95 1 100 1 103 1 104 1 105 1 106 1 108 1 110 1 112 1 116 1 119 1 122 1 12...
result:
ok ok (1 test case)
Test #49:
score: 6
Accepted
time: 36ms
memory: 15044kb
input:
1 100000 99999 1 2 1 1 3 1 2 4 1 4 5 0 5 6 1 1 7 1 4 8 0 3 9 0 7 10 1 3 11 0 10 12 0 1 13 1 7 14 1 9 15 0 10 16 0 15 17 1 12 18 0 11 19 1 18 20 1 1 21 0 20 22 1 19 23 1 20 24 1 1 25 1 20 26 1 8 27 0 27 28 0 9 29 0 16 30 1 4 31 1 9 32 0 19 33 1 27 34 0 15 35 1 24 36 1 30 37 1 24 38 1 32 39 1 8 40 0 4...
output:
YES 106445 1 1 2 1 5 1 7 1 17 1 18 1 19 1 20 1 22 1 23 1 24 1 25 1 26 1 29 1 30 1 31 1 32 1 34 1 35 1 37 1 38 1 44 1 45 1 46 1 47 1 48 1 50 1 51 1 54 1 55 1 56 1 58 1 62 1 65 1 67 1 71 1 72 1 74 1 77 1 80 1 82 1 83 1 84 1 88 1 90 1 94 1 97 1 99 1 103 1 104 1 105 1 110 1 113 1 115 1 116 1 117 1 120 1...
result:
ok ok (1 test case)
Subtask #10:
score: 6
Accepted
Test #50:
score: 6
Accepted
time: 25ms
memory: 16616kb
input:
1 100000 100000 1 2 0 2 3 1 3 4 0 4 5 1 5 6 0 6 7 1 7 8 0 8 9 1 9 10 0 10 11 1 11 12 0 12 13 1 13 14 0 14 15 1 15 16 0 16 17 1 17 18 0 18 19 1 19 20 0 20 21 1 21 22 0 22 23 1 23 24 0 24 25 1 25 26 0 26 27 1 27 28 0 28 29 1 29 30 0 30 31 1 31 32 0 32 33 1 33 34 0 34 35 1 35 36 0 36 37 1 37 38 0 38 39...
output:
NO
result:
ok ok (1 test case)
Test #51:
score: 6
Accepted
time: 21ms
memory: 16544kb
input:
1 100000 100000 1 2 0 2 3 1 3 4 0 4 5 1 5 6 0 6 7 1 7 8 0 8 9 1 9 10 0 10 11 1 11 12 0 12 13 1 13 14 0 14 15 1 15 16 0 16 17 1 17 18 0 18 19 1 19 20 0 20 21 1 21 22 0 22 23 1 23 24 0 24 25 1 25 26 0 26 27 1 27 28 0 28 29 1 29 30 0 30 31 1 31 32 0 32 33 1 33 34 0 34 35 1 35 36 0 36 37 1 37 38 0 38 39...
output:
NO
result:
ok ok (1 test case)
Test #52:
score: 6
Accepted
time: 25ms
memory: 16508kb
input:
1 100000 100000 1 2 1 2 3 0 3 4 1 4 5 0 5 6 1 6 7 0 7 8 1 8 9 0 9 10 1 10 11 0 11 12 1 12 13 0 13 14 1 14 15 0 15 16 1 16 17 0 17 18 1 18 19 0 19 20 1 20 21 0 21 22 1 22 23 0 23 24 1 24 25 0 25 26 1 26 27 0 27 28 1 28 29 0 29 30 1 30 31 0 31 32 1 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 1 38 39...
output:
NO
result:
ok ok (1 test case)
Test #53:
score: 6
Accepted
time: 25ms
memory: 16476kb
input:
1 100000 100000 1 2 1 2 3 0 3 4 1 4 5 0 5 6 1 6 7 0 7 8 1 8 9 0 9 10 1 10 11 0 11 12 1 12 13 0 13 14 1 14 15 0 15 16 1 16 17 0 17 18 1 18 19 0 19 20 1 20 21 0 21 22 1 22 23 0 23 24 1 24 25 0 25 26 1 26 27 0 27 28 1 28 29 0 29 30 1 30 31 0 31 32 1 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 1 38 39...
output:
NO
result:
ok ok (1 test case)
Test #54:
score: 6
Accepted
time: 19ms
memory: 4640kb
input:
1 100000 100000 1 2 1 2 3 0 3 4 0 4 5 0 5 6 1 6 7 1 7 8 0 8 9 1 9 10 1 10 11 0 11 12 1 12 13 0 13 14 0 14 15 0 15 16 1 16 17 1 17 18 0 18 19 1 19 20 1 20 21 0 21 22 1 22 23 0 23 24 1 24 25 1 25 26 1 26 27 0 27 28 0 28 29 1 29 30 1 30 31 0 31 32 1 32 33 1 33 34 1 34 35 0 35 36 1 36 37 1 37 38 0 38 39...
output:
NO
result:
ok ok (1 test case)
Test #55:
score: 6
Accepted
time: 15ms
memory: 4648kb
input:
1 95000 95000 1 2 1 2 3 1 3 4 0 4 5 1 5 6 1 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 0 12 13 0 13 14 1 14 15 1 15 16 0 16 17 0 17 18 1 18 19 0 19 20 0 20 21 1 21 22 0 22 23 1 23 24 1 24 25 0 25 26 1 26 27 0 27 28 0 28 29 0 29 30 1 30 31 1 31 32 0 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 0 38 39 0...
output:
NO
result:
ok ok (1 test case)
Test #56:
score: 6
Accepted
time: 31ms
memory: 15184kb
input:
1 100000 100000 1 2 1 2 3 1 3 4 1 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 1 12 13 1 13 14 1 14 15 1 15 16 0 16 17 0 17 18 1 18 19 1 19 20 1 20 21 1 21 22 1 22 23 0 23 24 0 24 25 0 25 26 0 26 27 1 27 28 1 28 29 0 29 30 0 30 31 1 31 32 0 32 33 0 33 34 0 34 35 1 35 36 1 36 37 1 37 38 1 38 39...
output:
YES 105918 2 1 3 1 4 1 7 1 10 1 11 1 12 1 13 1 14 1 15 1 18 1 20 1 21 1 22 1 27 1 28 1 30 1 31 1 35 1 36 1 37 1 39 1 40 1 41 1 42 1 44 1 47 1 52 1 57 1 58 1 59 1 60 1 61 1 62 1 63 1 65 1 67 1 69 1 70 1 71 1 73 1 75 1 77 1 78 1 80 1 82 1 84 1 85 1 86 1 87 1 90 1 92 1 97 1 98 1 102 1 103 1 106 1 108 1...
result:
ok ok (1 test case)
Test #57:
score: 6
Accepted
time: 33ms
memory: 14528kb
input:
1 95000 95000 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 1 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 1 18 19 1 19 20 1 20 21 0 21 22 0 22 23 0 23 24 0 24 25 1 25 26 1 26 27 0 27 28 0 28 29 1 29 30 1 30 31 0 31 32 0 32 33 0 33 34 0 34 35 1 35 36 1 36 37 1 37 38 1 38 39 1...
output:
YES 100516 10 1 18 1 19 1 20 1 25 1 26 1 29 1 35 1 36 1 37 1 38 1 41 1 43 1 49 1 52 1 57 1 59 1 60 1 61 1 63 1 65 1 67 1 69 1 73 1 74 1 75 1 78 1 79 1 80 1 82 1 87 1 89 1 91 1 94 1 95 1 96 1 99 1 101 1 103 1 104 1 106 1 107 1 112 1 115 1 116 1 117 1 118 1 120 1 121 1 122 1 124 1 134 1 136 1 138 1 14...
result:
ok ok (1 test case)
Subtask #11:
score: 10
Accepted
Dependency #2:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #8:
100%
Accepted
Test #58:
score: 10
Accepted
time: 0ms
memory: 3820kb
input:
1 1000 2000 505 722 0 722 486 1 486 553 0 553 546 1 546 24 0 24 26 1 26 286 0 286 165 1 165 300 0 300 13 1 13 979 0 979 930 1 930 181 0 181 957 1 957 852 0 852 255 1 255 829 0 829 607 1 607 157 0 157 681 1 681 408 0 408 996 1 996 755 0 755 237 1 237 896 0 896 327 1 327 451 0 451 138 1 138 883 0 883 ...
output:
NO
result:
ok ok (1 test case)
Test #59:
score: 10
Accepted
time: 1ms
memory: 3888kb
input:
1 2000 2000 1 2 0 2 3 1 3 4 0 4 5 1 5 6 0 6 7 1 7 8 0 8 9 1 9 10 0 10 11 1 11 12 0 12 13 1 13 14 0 14 15 1 15 16 0 16 17 1 17 18 0 18 19 1 19 20 0 20 21 1 21 22 0 22 23 1 23 24 0 24 25 1 25 26 0 26 27 1 27 28 0 28 29 1 29 30 0 30 31 1 31 32 0 32 33 1 33 34 0 34 35 1 35 36 0 36 37 1 37 38 0 38 39 1 3...
output:
NO
result:
ok ok (1 test case)
Test #60:
score: 10
Accepted
time: 1ms
memory: 3852kb
input:
1 2000 2000 1 2 1 2 3 0 3 4 1 4 5 0 5 6 1 6 7 0 7 8 1 8 9 0 9 10 1 10 11 0 11 12 1 12 13 0 13 14 1 14 15 0 15 16 1 16 17 0 17 18 1 18 19 0 19 20 1 20 21 0 21 22 1 22 23 0 23 24 1 24 25 0 25 26 1 26 27 0 27 28 1 28 29 0 29 30 1 30 31 0 31 32 1 32 33 0 33 34 1 34 35 0 35 36 1 36 37 0 37 38 1 38 39 0 3...
output:
NO
result:
ok ok (1 test case)
Test #61:
score: 10
Accepted
time: 1ms
memory: 3812kb
input:
1 1000 1994 1 622 1 1 722 1 4 57 0 4 218 0 4 506 0 4 559 0 4 851 0 4 898 0 5 22 0 5 368 0 5 482 0 5 575 0 5 589 0 6 69 1 6 156 1 6 447 1 6 876 1 8 66 1 8 106 1 8 154 1 8 159 1 8 506 1 8 580 1 8 677 1 8 717 1 8 935 1 11 102 0 11 192 0 11 521 0 12 167 1 13 33 1 13 115 1 13 369 1 13 695 1 13 796 1 13 8...
output:
YES 1412 1 1 2 1 3 1 6 1 7 1 8 1 12 1 13 1 14 1 15 1 17 1 18 1 23 1 29 1 37 1 41 1 42 1 44 1 46 1 48 1 49 1 52 1 53 1 54 1 56 1 58 1 64 1 65 1 67 1 68 1 70 1 77 1 78 1 80 1 83 1 84 1 90 1 93 1 94 1 98 1 99 1 101 1 102 1 106 1 108 1 109 1 110 1 112 1 116 1 122 1 125 1 128 1 134 1 136 1 137 1 138 1 14...
result:
ok ok (1 test case)
Test #62:
score: 10
Accepted
time: 0ms
memory: 4012kb
input:
1 1000 1992 1 341 0 1 591 0 1 754 0 1 788 0 2 368 0 4 138 0 4 252 0 4 784 0 5 480 0 7 225 0 7 296 0 7 456 0 7 532 0 7 616 0 8 369 0 8 960 0 10 150 0 10 288 0 10 487 0 10 553 0 10 775 0 11 136 0 11 153 0 11 162 0 11 552 0 11 685 0 11 999 0 12 904 0 13 32 0 13 761 0 14 232 0 14 548 0 14 610 0 15 122 0...
output:
YES 515 35 1 52 1 62 1 64 1 67 1 73 1 82 1 84 1 87 1 91 1 112 1 118 1 132 1 151 1 155 1 156 1 182 1 188 1 192 1 209 1 215 1 218 1 220 1 221 1 225 1 229 1 252 1 280 1 282 1 285 1 317 1 332 1 334 1 337 1 339 1 342 1 362 1 363 1 374 1 375 1 401 1 417 1 428 1 447 1 448 1 461 1 469 1 482 1 489 1 497 1 50...
result:
ok ok (1 test case)
Test #63:
score: 10
Accepted
time: 1ms
memory: 3728kb
input:
1 1000 1998 1 692 1 3 286 1 3 956 1 4 106 1 5 741 1 5 825 1 8 547 1 9 137 1 9 157 1 9 958 1 10 213 1 10 467 1 10 608 1 10 662 1 10 700 1 11 676 1 11 964 1 12 1 1 12 656 1 12 765 1 13 95 1 13 569 1 13 607 1 13 633 1 13 923 1 13 982 1 14 234 1 14 506 1 16 104 1 16 482 1 16 729 1 16 916 1 18 157 1 18 6...
output:
YES 1226 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 28 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 44 1 45 1 48 1 50 1 51 1 52 1 53 1 54 1 57 1 58 1 59 1 60 1 61 1 62 1 63 1 64 1 65 1 66 1 67 1 68 1 69 1 ...
result:
ok ok (1 test case)
Test #64:
score: 10
Accepted
time: 0ms
memory: 3680kb
input:
1 1000 1999 1 705 0 2 741 0 3 259 0 3 442 0 3 479 0 3 612 0 4 97 0 4 514 0 4 829 0 4 941 0 7 307 0 7 617 0 7 823 0 8 671 0 9 709 0 9 923 0 11 271 0 11 788 0 11 906 0 12 295 0 15 847 0 18 160 0 18 411 0 18 449 0 18 459 0 21 285 0 21 382 0 21 416 0 21 764 0 22 419 0 24 650 0 24 777 0 24 795 0 24 885 0...
output:
YES 0
result:
ok ok (1 test case)
Test #65:
score: 10
Accepted
time: 1ms
memory: 3700kb
input:
1 1000 1995 2 3 1 2 439 1 2 514 1 2 936 1 4 15 1 4 103 1 4 271 1 5 123 1 5 554 1 5 618 1 5 622 1 5 770 1 6 249 1 6 739 1 7 34 1 7 385 1 7 701 1 7 794 1 8 260 1 8 336 1 8 826 1 9 829 1 11 295 1 11 699 1 11 837 1 13 955 1 14 946 1 16 407 1 16 510 1 17 54 1 17 319 1 17 461 1 19 845 1 20 46 1 20 569 1 2...
output:
YES 1000 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 ...
result:
ok ok (1 test case)
Test #66:
score: 10
Accepted
time: 1ms
memory: 3844kb
input:
1 2000 1997 1 1360 0 4 718 0 4 965 0 5 78 1 5 936 1 5 1481 1 7 10 1 8 1413 1 12 63 1 13 1768 1 14 1645 0 16 45 1 16 1269 1 16 1548 1 17 535 0 17 1903 0 18 1214 0 20 1348 1 20 1599 1 21 53 0 21 1251 0 22 202 0 22 601 0 22 613 0 23 410 1 23 972 1 23 1036 1 26 180 1 27 1170 1 27 1869 1 28 615 1 28 1066...
output:
YES 2072 3 1 5 1 6 1 7 1 8 1 11 1 12 1 13 1 15 1 16 1 20 1 23 1 24 1 26 1 27 1 28 1 29 1 30 1 31 1 33 1 35 1 36 1 37 1 39 1 44 1 45 1 48 1 49 1 50 1 52 1 54 1 55 1 58 1 59 1 60 1 61 1 62 1 65 1 69 1 70 1 71 1 72 1 74 1 75 1 78 1 82 1 83 1 85 1 88 1 89 1 92 1 94 1 96 1 100 1 102 1 104 1 105 1 107 1 1...
result:
ok ok (1 test case)
Test #67:
score: 10
Accepted
time: 1ms
memory: 3832kb
input:
1 2000 2000 1 127 0 1 626 0 2 1622 0 4 648 1 4 1568 1 4 1743 1 5 422 0 5 638 0 5 1288 0 5 1927 0 5 1998 0 6 186 0 9 1605 0 13 1025 0 13 1310 0 14 897 0 14 1221 0 15 385 0 15 1089 0 17 982 0 19 48 1 19 608 1 19 732 1 20 853 0 20 1571 0 21 1405 0 22 670 0 24 136 0 24 1054 0 24 1811 0 29 60 0 29 181 0 ...
output:
YES 592 4 1 7 1 10 1 12 1 19 1 28 1 35 1 48 1 53 1 58 1 63 1 66 1 70 1 72 1 81 1 89 1 99 1 100 1 117 1 121 1 124 1 131 1 149 1 157 1 160 1 172 1 174 1 179 1 186 1 192 1 196 1 201 1 217 1 242 1 252 1 254 1 266 1 274 1 283 1 290 1 317 1 322 1 326 1 327 1 333 1 337 1 344 1 364 1 373 1 375 1 379 1 389 1...
result:
ok ok (1 test case)
Test #68:
score: 10
Accepted
time: 1ms
memory: 4124kb
input:
1 2000 2000 2 264 1 2 890 1 2 1621 1 3 588 1 4 1204 0 8 573 1 9 376 1 10 1908 1 11 1218 1 13 61 1 14 373 1 14 427 1 14 728 1 15 1354 1 15 1767 1 15 1806 1 17 205 0 18 452 1 19 139 0 19 459 0 21 379 0 21 397 0 21 653 0 21 908 0 21 1817 0 21 1912 0 22 1219 0 23 1705 1 24 1498 1 26 1395 1 28 433 1 28 7...
output:
YES 2171 1 1 2 1 3 1 5 1 7 1 8 1 9 1 10 1 11 1 13 1 14 1 15 1 16 1 18 1 20 1 23 1 24 1 25 1 26 1 27 1 28 1 30 1 31 1 32 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 54 1 55 1 56 1 58 1 59 1 60 1 61 1 62 1 63 1 64 1 65 1 66 1 67 1 68 1 69 1 70 1 71 ...
result:
ok ok (1 test case)
Test #69:
score: 10
Accepted
time: 1ms
memory: 3656kb
input:
1 500 1986 1 89 0 1 153 0 1 207 0 2 86 0 2 269 0 2 380 0 2 443 0 3 65 1 3 78 1 3 159 1 3 209 1 3 269 1 3 332 1 3 357 1 3 469 1 4 14 1 4 29 1 4 44 1 5 233 1 5 298 1 5 315 1 5 350 1 5 352 1 5 360 1 5 479 1 6 207 1 6 211 1 6 272 1 6 402 1 6 458 1 6 460 1 6 464 1 7 105 1 7 181 1 7 305 1 8 455 1 9 79 0 9...
output:
YES 941 3 1 4 1 5 1 6 1 7 1 8 1 18 1 20 1 21 1 22 1 23 1 24 1 26 1 27 1 29 1 30 1 31 1 32 1 34 1 35 1 37 1 38 1 40 1 42 1 43 1 45 1 46 1 49 1 50 1 52 1 56 1 57 1 59 1 60 1 61 1 65 1 68 1 70 1 71 1 72 1 73 1 74 1 75 1 76 1 78 1 80 1 81 1 82 1 87 1 91 1 94 1 96 1 97 1 98 1 100 1 101 1 104 1 106 1 107 ...
result:
ok ok (1 test case)
Test #70:
score: 10
Accepted
time: 0ms
memory: 3740kb
input:
1 500 1992 1 9 0 1 82 0 1 109 0 1 120 0 1 207 0 4 351 0 6 165 0 6 169 0 6 208 0 6 333 0 6 395 0 7 56 0 7 176 0 7 380 0 7 455 0 8 136 0 8 151 0 8 182 0 8 225 0 8 333 0 8 482 0 8 484 0 9 40 0 10 70 1 10 415 1 10 429 1 11 28 0 13 141 0 13 165 0 13 285 0 13 429 0 13 460 0 14 2 0 14 19 0 14 208 0 14 300 ...
output:
YES 365 10 1 27 1 74 1 78 1 82 1 85 1 88 1 91 1 110 1 130 1 144 1 146 1 150 1 151 1 156 1 162 1 178 1 180 1 186 1 214 1 215 1 233 1 237 1 255 1 266 1 269 1 277 1 278 1 285 1 296 1 309 1 316 1 330 1 331 1 376 1 387 1 396 1 401 1 406 1 419 1 454 1 464 1 472 1 495 1 499 1 241 1 241 0 444 1 444 0 472 0 ...
result:
ok ok (1 test case)
Test #71:
score: 10
Accepted
time: 1ms
memory: 3976kb
input:
1 500 1989 1 88 1 1 168 1 1 203 1 1 301 1 1 444 1 2 328 1 4 8 1 4 106 1 4 345 1 4 456 1 5 244 1 5 268 1 5 312 1 5 318 1 5 327 1 5 390 1 6 98 1 6 107 1 6 111 1 6 162 1 6 244 1 6 482 1 7 14 1 7 78 1 7 83 1 7 156 1 7 189 1 7 192 1 7 216 1 7 226 1 7 228 1 7 294 1 7 299 1 7 349 1 7 361 1 7 381 1 7 385 1 ...
output:
YES 739 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 50 1 51 1 52 1 53 1 54 1 56 1 57 1 58 1 59 1 61 1 63 1 64 1 65 1 66 1 6...
result:
ok ok (1 test case)
Subtask #12:
score: 18
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Dependency #7:
100%
Accepted
Dependency #8:
100%
Accepted
Dependency #9:
100%
Accepted
Dependency #10:
100%
Accepted
Dependency #11:
100%
Accepted
Test #72:
score: 18
Accepted
time: 63ms
memory: 20480kb
input:
1 100000 200000 7400 64761 0 64761 60287 1 60287 7113 0 7113 55727 1 55727 20838 0 20838 17799 1 17799 99870 0 99870 87603 1 87603 9059 0 9059 96506 1 96506 82355 0 82355 61387 1 61387 84097 0 84097 35019 1 35019 43828 0 43828 47890 1 47890 28453 0 28453 23828 1 23828 4756 0 4756 77657 1 77657 29379...
output:
NO
result:
ok ok (1 test case)
Test #73:
score: 18
Accepted
time: 13ms
memory: 9744kb
input:
1 50000 50000 1 2 0 2 3 1 3 4 0 4 5 1 5 6 0 6 7 1 7 8 0 8 9 1 9 10 0 10 11 1 11 12 0 12 13 1 13 14 0 14 15 1 15 16 0 16 17 1 17 18 0 18 19 1 19 20 0 20 21 1 21 22 0 22 23 1 23 24 0 24 25 1 25 26 0 26 27 1 27 28 0 28 29 1 29 30 0 30 31 1 31 32 0 32 33 1 33 34 0 34 35 1 35 36 0 36 37 1 37 38 0 38 39 1...
output:
NO
result:
ok ok (1 test case)
Test #74:
score: 18
Accepted
time: 60ms
memory: 16372kb
input:
1 50000 199968 2 19369 1 2 21364 1 2 25155 1 2 27339 1 2 27511 1 2 44556 1 2 45351 1 3 44569 0 3 45843 0 3 49912 0 4 9491 0 5 49735 1 6 16383 1 6 28552 1 7 30996 1 8 7229 1 8 10756 1 8 12621 1 8 19752 1 8 44330 1 9 26023 1 9 35659 1 10 7610 1 10 16819 1 10 22540 1 10 27829 1 10 32872 1 10 35055 1 10...
output:
YES 107951 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 14 1 15 1 16 1 18 1 19 1 21 1 22 1 27 1 30 1 31 1 32 1 33 1 34 1 41 1 42 1 46 1 47 1 48 1 50 1 53 1 54 1 57 1 58 1 61 1 62 1 66 1 68 1 71 1 73 1 78 1 79 1 80 1 83 1 84 1 89 1 90 1 93 1 94 1 95 1 96 1 97 1 99 1 103 1 104 1 108 1 111 1 114 1 116 1 117 ...
result:
ok ok (1 test case)
Test #75:
score: 18
Accepted
time: 58ms
memory: 16416kb
input:
1 50000 199913 1 17199 0 1 34976 0 1 40637 0 2 19412 0 3 2252 1 3 2925 1 3 3029 1 3 6295 1 3 7328 1 3 10938 1 3 12057 1 3 17265 1 3 17912 1 3 18223 1 3 19003 1 3 21266 1 3 22296 1 3 22320 1 3 22663 1 3 24507 1 3 26280 1 3 26734 1 3 27637 1 3 28019 1 3 29941 1 3 31611 1 3 31704 1 3 31802 1 3 32467 1 ...
output:
YES 84268 3 1 7 1 9 1 12 1 15 1 36 1 65 1 68 1 69 1 71 1 77 1 82 1 85 1 98 1 125 1 129 1 132 1 154 1 158 1 165 1 170 1 207 1 208 1 237 1 250 1 290 1 292 1 296 1 297 1 313 1 317 1 334 1 359 1 362 1 365 1 372 1 375 1 393 1 396 1 409 1 415 1 457 1 464 1 469 1 481 1 487 1 492 1 494 1 498 1 505 1 550 1 5...
result:
ok ok (1 test case)
Test #76:
score: 18
Accepted
time: 62ms
memory: 16560kb
input:
1 50000 199911 1 8404 1 1 17242 1 1 24057 1 1 31078 1 1 32448 1 1 33608 1 2 27010 1 2 47233 1 3 5128 1 3 6418 1 3 24676 1 3 48487 1 5 1034 1 5 10374 1 5 23871 1 5 31896 1 5 44262 1 6 22036 1 6 41207 1 7 2667 1 7 7316 1 7 30778 1 7 35899 1 7 47038 1 8 7828 1 9 9734 1 9 35195 1 9 49220 1 10 6037 1 11 ...
output:
YES 122173 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 33 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 45 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 57 1 58 1 59 1 60 1 61 1 63 1 64 1 65 1 66 1 67 1 68 1 69 1 70 ...
result:
ok ok (1 test case)
Test #77:
score: 18
Accepted
time: 76ms
memory: 21652kb
input:
1 100000 199993 2 5800 1 2 38429 1 2 87603 1 2 97076 1 3 17781 0 3 27608 0 3 57980 0 3 60559 0 3 88247 0 4 14335 0 5 63749 1 7 25192 1 7 60951 1 7 63367 1 9 62836 1 10 21312 1 10 22145 1 10 78654 1 11 21555 1 11 84212 1 11 86088 1 11 99696 1 12 37520 1 13 15200 1 13 18408 1 14 89343 0 15 1999 1 15 1...
output:
YES 184026 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 15 1 17 1 18 1 19 1 20 1 22 1 30 1 31 1 33 1 34 1 35 1 39 1 42 1 43 1 45 1 51 1 53 1 56 1 57 1 58 1 61 1 63 1 64 1 65 1 68 1 70 1 74 1 81 1 83 1 85 1 86 1 89 1 90 1 92 1 93 1 94 1 97 1 98 1 99 1 101 1 104 1 106 1 107 1 110 1 111 1 112 1 114 1 11...
result:
ok ok (1 test case)
Test #78:
score: 18
Accepted
time: 63ms
memory: 21780kb
input:
1 100000 199989 1 76702 0 2 12252 0 3 30590 0 3 95162 0 5 79468 0 7 51874 0 9 506 0 9 11079 0 9 52889 0 9 80135 0 11 9629 0 11 49499 0 11 55682 0 11 66404 0 12 27992 0 12 42958 0 12 48475 0 12 69809 0 15 13998 0 15 29664 0 17 14463 0 17 28903 0 17 48901 0 17 82954 0 17 92913 0 20 14614 1 20 20196 1 ...
output:
YES 133113 20 1 21 1 39 1 46 1 48 1 51 1 59 1 60 1 70 1 104 1 108 1 113 1 115 1 134 1 137 1 143 1 146 1 152 1 157 1 160 1 167 1 190 1 198 1 207 1 208 1 214 1 216 1 220 1 232 1 233 1 248 1 273 1 291 1 310 1 319 1 325 1 345 1 347 1 349 1 362 1 363 1 378 1 388 1 390 1 393 1 397 1 404 1 414 1 426 1 444 ...
result:
ok ok (1 test case)
Test #79:
score: 18
Accepted
time: 65ms
memory: 22080kb
input:
1 100000 199973 1 26091 1 3 4696 0 3 12011 0 3 14048 0 3 23953 0 3 48581 0 3 55894 0 3 58903 0 3 58965 0 3 64006 0 3 65907 0 3 81900 0 4 76090 1 5 44397 1 6 23916 0 6 24472 0 6 29712 0 6 29819 0 6 30269 0 6 34134 0 6 34773 0 6 37470 0 6 41593 0 6 43439 0 6 48579 0 6 52101 0 6 53803 0 6 60060 0 6 618...
output:
YES 209423 1 1 2 1 4 1 5 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 45 1 46 1 47 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 64 1 65 1 66 1 67 1 68 1 6...
result:
ok ok (1 test case)
Test #80:
score: 18
Accepted
time: 49ms
memory: 13528kb
input:
1 50000 199981 1 9617 0 1 13254 0 2 16509 1 2 27339 1 2 34328 1 2 38684 1 2 45351 1 3 1936 0 3 12116 0 3 21212 0 3 33378 0 3 41153 0 3 44569 0 3 49912 0 4 6411 0 4 17523 0 5 15195 1 5 19694 1 8 1301 1 8 12142 1 8 21098 1 8 29237 1 8 32347 1 8 36774 1 9 9064 1 9 26023 1 9 40620 1 10 4361 1 10 9251 1 ...
output:
YES 91861 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 14 1 15 1 16 1 18 1 19 1 21 1 22 1 27 1 30 1 31 1 32 1 33 1 34 1 41 1 42 1 46 1 47 1 48 1 50 1 53 1 54 1 57 1 58 1 61 1 62 1 66 1 68 1 71 1 73 1 78 1 79 1 80 1 83 1 84 1 89 1 90 1 93 1 94 1 95 1 96 1 97 1 99 1 103 1 104 1 108 1 111 1 114 1 116 1 117 1...
result:
ok ok (1 test case)
Test #81:
score: 18
Accepted
time: 32ms
memory: 11172kb
input:
1 50000 199990 1 779 0 1 1093 0 1 3698 0 1 8592 0 1 11226 0 1 21318 0 1 24643 0 1 29562 0 1 45487 0 2 6651 0 2 9349 0 2 19670 0 2 19954 0 2 27340 0 2 28329 0 2 39707 0 2 46852 0 2 47818 0 3 2296 1 3 3615 1 3 8279 1 3 9627 1 3 11443 1 3 17694 1 3 23201 1 3 29842 1 3 32123 1 3 34302 1 3 43999 1 4 1155...
output:
YES 36978 3 1 7 1 9 1 12 1 15 1 36 1 65 1 68 1 69 1 71 1 77 1 82 1 85 1 98 1 125 1 129 1 132 1 154 1 158 1 165 1 170 1 207 1 208 1 237 1 250 1 290 1 292 1 296 1 297 1 313 1 317 1 334 1 359 1 362 1 365 1 372 1 375 1 393 1 396 1 409 1 415 1 457 1 464 1 469 1 481 1 487 1 492 1 494 1 498 1 505 1 550 1 5...
result:
ok ok (1 test case)
Test #82:
score: 18
Accepted
time: 32ms
memory: 11728kb
input:
1 50000 199983 1 11037 1 1 20705 1 1 22722 1 1 25398 1 1 32222 1 1 38283 1 1 43464 1 2 12626 1 2 25300 1 2 35398 1 2 40490 1 2 42361 1 2 42627 1 2 45506 1 3 9960 1 4 20466 1 4 34415 1 5 3631 1 5 7021 1 5 24632 1 5 30188 1 5 30666 1 5 32331 1 5 39201 1 5 45553 1 5 49795 1 6 5802 1 6 18080 1 6 20702 1...
output:
YES 75463 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 33 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 45 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 57 1 58 1 59 1 60 1 61 1 63 1 64 1 65 1 66 1 67 1 68 1 69 1 70 1...
result:
ok ok (1 test case)
Test #83:
score: 18
Accepted
time: 56ms
memory: 18780kb
input:
1 100000 199995 2 5800 1 2 38429 1 2 48015 1 3 12089 0 3 27718 0 3 49401 0 3 84851 0 4 7198 0 4 55509 0 4 86361 0 7 25192 1 7 74682 1 8 97749 1 9 2068 1 10 69054 1 10 78654 1 10 81225 1 11 44076 1 11 50618 1 12 37520 1 12 79722 1 13 62651 1 14 68509 0 14 68889 0 15 9694 1 15 17146 1 15 33158 1 15 74...
output:
YES 137942 2 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 15 1 17 1 18 1 19 1 20 1 22 1 30 1 31 1 33 1 34 1 35 1 39 1 42 1 43 1 45 1 51 1 53 1 56 1 57 1 58 1 61 1 63 1 64 1 65 1 68 1 70 1 74 1 81 1 83 1 85 1 86 1 89 1 90 1 92 1 93 1 94 1 97 1 98 1 99 1 101 1 104 1 106 1 107 1 110 1 111 1 112 1 114 1 11...
result:
ok ok (1 test case)
Test #84:
score: 18
Accepted
time: 37ms
memory: 14428kb
input:
1 100000 199996 1 40390 0 1 49542 0 2 3647 0 2 40814 0 2 84407 0 2 87973 0 4 41330 0 4 45152 0 5 49392 0 7 376 0 7 51974 0 7 62702 0 9 13433 0 9 19038 0 9 28940 0 9 31353 0 9 78327 0 9 88453 0 10 80144 0 11 22291 0 11 55175 0 12 68366 0 12 77297 0 14 25334 0 14 92999 0 15 50979 0 15 56214 0 16 14896...
output:
YES 45483 20 1 21 1 39 1 46 1 48 1 51 1 59 1 60 1 70 1 104 1 108 1 113 1 115 1 134 1 137 1 143 1 146 1 152 1 157 1 160 1 167 1 190 1 198 1 207 1 208 1 214 1 216 1 220 1 232 1 233 1 248 1 273 1 291 1 310 1 319 1 325 1 345 1 347 1 349 1 362 1 363 1 378 1 388 1 390 1 393 1 397 1 404 1 414 1 426 1 444 1...
result:
ok ok (1 test case)
Test #85:
score: 18
Accepted
time: 49ms
memory: 15480kb
input:
1 100000 199993 2 36343 1 5 7051 1 5 19899 1 5 56841 1 5 78043 1 6 16961 0 6 82832 0 7 26247 1 7 39033 1 7 71905 1 7 73979 1 8 62552 1 8 92154 1 9 17984 1 9 26928 1 9 37416 1 9 83877 1 10 3821 1 10 10441 1 10 65072 1 10 77832 1 10 85366 1 12 35357 1 12 46221 1 12 72660 1 12 93814 1 12 96138 1 13 158...
output:
YES 124091 1 1 2 1 4 1 5 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 45 1 46 1 47 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 1 61 1 62 1 64 1 65 1 66 1 67 1 68 1 6...
result:
ok ok (1 test case)
Test #86:
score: 18
Accepted
time: 26ms
memory: 12412kb
input:
1 100000 199995 2 4156 0 2 87333 0 2 90158 0 3 13118 0 3 15228 0 3 17999 0 4 2186 0 4 29195 0 4 47410 0 4 69083 0 4 78449 0 4 84967 0 6 28610 0 6 85599 0 7 17954 0 9 11209 0 11 35587 0 12 10861 0 12 78758 0 13 31375 0 13 89470 0 15 17362 0 15 25825 0 16 1142 0 16 2706 0 16 84404 0 18 5533 0 18 21178...
output:
YES 0
result:
ok ok (1 test case)
Test #87:
score: 18
Accepted
time: 35ms
memory: 13464kb
input:
1 100000 199994 1 1585 1 1 73911 1 2 46807 1 3 939 1 4 18082 1 4 46856 1 7 10606 1 7 36179 1 7 53263 1 7 96897 1 10 50674 1 12 23467 1 14 3689 1 16 10071 1 16 63913 1 17 16662 1 17 23189 1 17 91225 1 17 95816 1 19 21529 1 20 47967 1 21 62050 1 22 21083 1 22 21376 1 22 84238 1 24 9167 1 24 49250 1 24...
output:
YES 100000 1 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 1 10 1 11 1 12 1 13 1 14 1 15 1 16 1 17 1 18 1 19 1 20 1 21 1 22 1 23 1 24 1 25 1 26 1 27 1 28 1 29 1 30 1 31 1 32 1 33 1 34 1 35 1 36 1 37 1 38 1 39 1 40 1 41 1 42 1 43 1 44 1 45 1 46 1 47 1 48 1 49 1 50 1 51 1 52 1 53 1 54 1 55 1 56 1 57 1 58 1 59 1 60 ...
result:
ok ok (1 test case)
Extra Test:
score: 0
Extra Test Passed