QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#349565#8315. Candy Adshos_lyricAC ✓1235ms31140kbC++148.3kb2024-03-10 02:55:412024-03-10 02:55:42

Judging History

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

  • [2024-03-10 02:55:42]
  • 评测
  • 测评结果:AC
  • 用时:1235ms
  • 内存:31140kb
  • [2024-03-10 02:55:41]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")


// get0(u): should return a neighbor of u and remove it (or -1).
// get1(u): the same for reversed edge
template <class Get0, class Get1> struct SccDyn {
  int n;
  const Get0 get0;
  const Get1 get1;

  int l;
  vector<int> ids;
  int operator[](int u) const { return ids[u]; }

  SccDyn(int n_, Get0 get0_, Get1 get1_) : n(n_), get0(get0_), get1(get1_) {
    ids.assign(n, 0);
    us.clear();
    for (int u = 0; u < n; ++u) dfs0(u);
    l = 0;
    for (int j = n; --j >= 0; ) if (!~ids[us[j]]) { dfs1(us[j]); ++l; }
  }

  vector<int> us;
  void dfs0(int u) {
    if (!ids[u]) {
      ids[u] = -1;
      for (; ; ) {
        const int v = get0(u);
        if (!~v) break;
        dfs0(v);
      }
      us.push_back(u);
    }
  }
  void dfs1(int u) {
    if (!~ids[u]) {
      ids[u] = l;
      for (; ; ) {
        const int v = get1(u);
        if (!~v) break;
        dfs1(v);
      }
    }
  }

  vector<vector<int>> group() const {
    assert(~l);
    vector<vector<int>> uss(l);
    for (int u = 0; u < n; ++u) uss[ids[u]].push_back(u);
    return uss;
  }
};  // SccDyn
template <class Get0, class Get1>
SccDyn<Get0, Get1> sccDyn(int n, Get0 get0, Get1 get1) {
  return SccDyn<Get0, Get1>(n, get0, get1);
}
template <class Get> auto sccDyn(int n, Get get) {
  return sccDyn(
    n,
    [&](int u) -> int { return get(0, u); },
    [&](int u) -> int { return get(1, u); }
  );
}

////////////////////////////////////////////////////////////////////////////////


constexpr int INF = 1001001001;

int N, W, H;
int P[50010][4];
int M;
vector<int> A, B;

struct Kdt {
  int nn;
  vector<int> us, os;
  struct Node {
    int t;
    int l, r;
    // int mn[4], mx[4];
    int mn0, mx1, mn2, mx2, mn3, mx3;
  };
  vector<Node> nodes;
  void pull(Node &node) {
    const Node &l = nodes[node.l];
    const Node &r = nodes[node.r];
    node.t = max(l.t, r.t);
    node.mn0 = min(l.mn0, r.mn0);
    node.mx1 = max(l.mx1, r.mx1);
    node.mn2 = min(l.mn2, r.mn2); node.mx2 = max(l.mx2, r.mx2);
    node.mn3 = min(l.mn3, r.mn3); node.mx3 = max(l.mx3, r.mx3);
  }
  void build() {
    us.resize(N);
    for (int u = 0; u < N; ++u) us[u] = u;
    nn = 0;
    nodes.resize(2 * N - 1);
    os.assign(N, -1);
    buildRec(0, N, 0);
  }
  int buildRec(int jL, int jR, int dir) {
    const int o = nn++;
    Node &node = nodes[o];
    // for (int d = 0; d < 4; ++d) node.mn[d] = node.mx[d] = P[us[jL]][d];
    if (jL + 1 == jR) {
      const int u = us[jL];
      os[u] = o;
      node.t = u;
      node.l = node.r = -1;
      node.mn0 = P[u][0];
      node.mx1 = P[u][1];
      node.mn2 = node.mx2 = P[u][2];
      node.mn3 = node.mx3 = P[u][3];
    } else {
      /*
      for (int j = jL + 1; j < jR; ++j) {
        // for (int d = 0; d < 4; ++d) {
          // chmin(node.mn[d], P[us[j]][d]);
          // chmax(node.mx[d], P[us[j]][d]);
        // }
        chmin(node.mn0, P[us[j]][0]);
        chmax(node.mx1, P[us[j]][1]);
        chmin(node.mn2, P[us[j]][2]); chmax(node.mx2, P[us[j]][2]);
        chmin(node.mn3, P[us[j]][3]); chmax(node.mx3, P[us[j]][3]);
      }
      */
      const int jMid = jL + (jR - jL) / 2;
      std::nth_element(us.begin() + jL, us.begin() + jMid, us.begin() + jR,
                       [&](int u0, int u1) -> bool {
                         return (P[u0][dir] < P[u1][dir]); 
                       });
      node.l = buildRec(jL, jMid, (dir + 1) & 3);
      node.r = buildRec(jMid, jR, (dir + 1) & 3);
      pull(node);
    }
    return o;
  }
  /*
         p[0] <= r
    l <= p[1]     
    a <= p[2] <= b
    c <= p[3] <= d
  */
  int take(int r, int l, int a, int b, int c, int d) {
    return takeRec(0, r, l, a, b, c, d);
  }
  int takeRec(int o, int r, int l, int a, int b, int c, int d) {
    Node &node = nodes[o];
    if (!~node.t) {
      return -1;
    }
    // if (!(                      node.mn[0] <= r
          // && l <= node.mx[1]
          // && a <= node.mx[2] && node.mn[2] <= b
          // && c <= node.mx[3] && node.mn[3] <= d)) {
    if (!(                    node.mn0 <= r
          && l <= node.mx1
          && a <= node.mx2 && node.mn2 <= b
          && c <= node.mx3 && node.mn3 <= d)) {
      return -1;
    }
    if (!~node.l) {
      const int u = node.t;
      node.t = -1;
      node.mn0 = +INF;
      node.mx1 = -INF;
      node.mn2 = +INF; node.mx2 = -INF;
      node.mn3 = +INF; node.mx3 = -INF;
      return u;
    }
    int u = takeRec(node.l, r, l, a, b, c, d);
    if (!~u) {
      u = takeRec(node.r, r, l, a, b, c, d);
    }
    // int u = node.t;
    // const bool goL = (os[u] < node.r);
    // u = takeRec(goL ? node.l : node.r, r, l, a, b, c, d);
    // if (!~u) {
      // u = takeRec(goL ? node.r : node.l, r, l, a, b, c, d);
    // }
    pull(node);
    return u;
  }
  void restore(int u) {
    restoreRec(0, u);
  }
  void restoreRec(int o, int u) {
    Node &node = nodes[o];
    if (!~node.l) {
      assert(o == os[u]);
      assert(!~node.t);
      node.t = u;
      node.mn0 = P[u][0];
      node.mx1 = P[u][1];
      node.mn2 = node.mx2 = P[u][2];
      node.mn3 = node.mx3 = P[u][3];
      return;
    }
    restoreRec((os[u] < node.r) ? node.l : node.r, u);
    pull(node);
  }
};

int main() {
  for (; ~scanf("%d%d%d", &N, &W, &H); ) {
    for (int u = 0; u < N; ++u) for (int d = 0; d < 4; ++d) {
      scanf("%d", &P[u][d]);
    }
    scanf("%d", &M);
    A.resize(M);
    B.resize(M);
    for (int i = 0; i < M; ++i) {
      scanf("%d%d", &A[i], &B[i]);
      --A[i];
      --B[i];
    }
    
    Kdt kdt[2];
    vector<vector<int>> graph[2];
    for (int s = 0; s < 2; ++s) {
      kdt[s].build();
      graph[s].assign(N, {});
      for (int i = 0; i < M; ++i) {
        graph[s][A[i]].push_back(B[i]);
        graph[s][B[i]].push_back(A[i]);
      }
    }
    
    const auto scc = sccDyn(N << 1, [&](int s, int uu) -> int {
      const int u = uu >> 1;
      if ((uu & 1) != s) {
        // s = 0: u ==> not(v)
        int v = kdt[s].take(P[u][1], P[u][0], P[u][2] - W + 1, P[u][2] + W - 1, P[u][3] - H + 1, P[u][3] + H - 1);
        if (!~v) return -1;
        if (u == v) {
          v = kdt[s].take(P[u][1], P[u][0], P[u][2] - W + 1, P[u][2] + W - 1, P[u][3] - H + 1, P[u][3] + H - 1);
          kdt[s].restore(u);
          if (!~v) return -1;
        }
// cerr<<__LINE__<<": [get] "<<s<<" "<<u<<" "<<v<<"; "<<uu<<" "<<(v<<1|s)<<endl;
        return v << 1 | s;
      } else {
        // s = 0: not(u) ==> v
        if (!graph[s][u].size()) return -1;
        const int v = graph[s][u].back();
        graph[s][u].pop_back();
// cerr<<__LINE__<<": [get] "<<s<<" "<<u<<" "<<v<<"; "<<uu<<" "<<(v<<1|(s^1))<<endl;
        return v << 1 | (s ^ 1);
      }
    });
// cerr<<"scc = "<<scc.ids<<endl;
    
    bool ok = true;
    string ans(N, '?');
    for (int u = 0; u < N; ++u) {
      ok = ok && (scc[u << 1] != scc[u << 1 | 1]);
      ans[u] = (scc[u << 1] < scc[u << 1 | 1]) ? '1' : '0';
    }
    if (ok) {
      puts("Yes");
      puts(ans.c_str());
    } else {
      puts("No");
    }
  }
  return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2 2
1 2 1 1
2 3 2 2
1
1 2

output:

Yes
01

result:

ok accepted

Test #2:

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

input:

3 2 2
1 2 1 1
1 3 1 2
2 3 2 2
3
1 2
2 3
1 3

output:

No

result:

ok accepted

Test #3:

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

input:

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

output:

Yes
0010110111

result:

ok accepted

Test #4:

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

input:

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

output:

Yes
0001110100

result:

ok accepted

Test #5:

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

input:

10 4 3
8 9 8 8
4 5 6 8
8 9 3 2
5 7 10 6
6 7 7 9
3 5 7 3
9 10 9 4
4 7 9 2
9 10 8 2
3 5 1 8
14
8 10
10 1
1 10
6 4
2 3
9 6
8 6
5 2
9 8
1 9
10 7
1 6
10 8
3 6

output:

Yes
0010110011

result:

ok accepted

Test #6:

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

input:

100 94 194
1461 1945 694 1593
217 353 761 1920
695 982 452 599
1301 1757 662 1862
1355 1574 917 258
1253 1718 10 893
822 1112 623 748
597 925 1196 65
1277 1785 17 1368
1564 1914 1637 545
1363 1810 922 1988
1001 1251 28 156
1678 1978 185 980
1730 1823 145 1803
655 1040 981 1261
593 637 212 555
1358 1...

output:

Yes
1011100101111101010111111110110001011110111111111111011010100111101111111011111111101100111111111001

result:

ok accepted

Test #7:

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

input:

100 108 62
410 579 1353 353
82 560 288 988
32 392 1431 1904
1364 1785 1489 1395
1118 1448 301 1275
995 1149 127 1756
1607 1906 1 1907
1217 1782 291 764
616 840 1552 1006
787 1202 34 200
283 316 3 460
903 1356 822 1469
1110 1370 1144 1880
439 746 509 1376
47 344 73 1807
551 1032 280 851
612 631 262 1...

output:

Yes
0000000100001110010001110100101101011101011001101111100111101110110011111111110111101111111111011111

result:

ok accepted

Test #8:

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

input:

100 61 130
1234 1525 1544 1497
1696 1819 895 1801
1079 1222 1201 1725
1581 1827 420 1191
270 782 261 417
1620 1685 415 79
103 387 832 562
1461 1488 388 1124
1246 1726 1900 874
139 632 984 1770
708 882 1235 1378
98 432 867 560
316 863 1773 1122
782 1080 428 1748
1599 1695 590 1969
1384 1941 449 1137
...

output:

Yes
0010001000101110011110011111011101110101111101111111111110101011110101111111011111111111011111111011

result:

ok accepted

Test #9:

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

input:

1000 46 46
650 693 297 1278
322 411 1293 527
1613 1798 1513 1514
380 440 1463 1779
220 263 1459 1937
718 777 649 81
497 672 1224 818
576 597 977 1728
199 283 827 1766
248 259 1666 1199
956 1092 142 1966
1010 1159 414 186
592 728 1781 673
403 596 1021 1607
1118 1234 1511 417
810 830 1667 1125
1304 14...

output:

Yes
00011000000000000010100001111001100010101100111101110110101100110001010010010110010001000111001101111100111111010111101111001010011101011111100011111001010100110010111001101111110100111101111110110111100010101101111111111111111111101100111110001011101110110011110111100111000111110000110111111111...

result:

ok accepted

Test #10:

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

input:

1000 36 48
1100 1171 1599 1568
1906 1917 219 455
696 718 914 1154
407 562 1599 1749
1389 1535 744 1456
1791 1979 535 1206
597 670 389 111
131 171 1760 1858
770 928 1938 1633
1481 1537 1325 440
1667 1759 1038 837
869 1001 1114 1721
1523 1590 1412 1475
205 372 620 1395
1247 1396 113 1943
163 316 1852 ...

output:

Yes
00000000000000000000001000000000000001000010010000001010000000010000000000010100011000000000100100001001010110010101010011101101111001110001110110110001000110111110100111100011011110100100010111110010111100101111101001001001111111000111000111101000010111110111111101111111011110101111010110011111...

result:

ok accepted

Test #11:

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

input:

1000 37 46
174 204 1667 729
1866 1875 1884 556
792 945 1920 927
1303 1473 1163 1341
1519 1539 503 362
62 140 1262 1450
1235 1263 1031 1966
895 1057 215 1626
1135 1208 666 998
1459 1477 1941 1671
1050 1192 60 1375
137 244 1672 1445
217 414 724 1347
1043 1200 1401 68
1331 1495 919 933
1086 1137 1341 3...

output:

Yes
00000000000001011011100100000000000001100000100001000000110010011101111001000000011001000110010000000101001011011111001011100010101101101010100110000010111010101100111111111001111111001110000011101001011011101010111110110111011000011000011100111111001110111001010011110000110110111101111111011010...

result:

ok accepted

Test #12:

score: 0
Accepted
time: 218ms
memory: 19828kb

input:

50000 9 9
630 678 1889 1026
1568 1607 1637 114
732 830 1245 590
1023 1032 403 698
211 243 1531 1382
593 650 248 955
708 717 1688 1772
509 536 884 582
1798 1865 522 1714
333 390 75 1044
1494 1540 1320 1543
160 211 866 1215
1847 1906 1189 1636
154 198 1074 1193
1636 1705 227 1685
940 954 508 394
1266 ...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000001000000000100000000100000000000000000000000000000000000110000000000000001000010000000000000001000000000000000000000000000000000000000010000000000000000010000000000000000000000000000001010000...

result:

ok accepted

Test #13:

score: 0
Accepted
time: 219ms
memory: 19972kb

input:

50000 10 6
282 331 1148 1597
676 739 296 677
294 305 1501 1969
1440 1499 862 104
1008 1072 131 1387
1036 1053 915 1390
1569 1662 1463 996
287 334 1662 173
358 381 383 367
481 550 156 361
1340 1389 671 76
986 1006 1634 353
445 465 596 1864
1422 1452 1740 1762
1381 1407 745 4
1172 1188 144 1320
751 79...

output:

Yes
00000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000001000000000000010000000000000000000000000000000000000000000000000000000001000000000000000...

result:

ok accepted

Test #14:

score: 0
Accepted
time: 318ms
memory: 20688kb

input:

50000 7 15
107 197 820 713
1833 1863 671 1773
1573 1727 1976 1743
1656 1718 1714 926
1615 1734 113 378
182 285 1167 811
1924 1973 1809 178
972 1020 1877 100
25 46 1192 488
251 347 504 751
320 334 308 1545
554 619 166 1528
108 145 1283 1383
153 200 1714 494
390 537 1052 565
1331 1357 1638 327
87 161 ...

output:

No

result:

ok accepted

Test #15:

score: 0
Accepted
time: 103ms
memory: 31140kb

input:

50000 130 164
26 1216 1021 1261
423 1110 383 616
772 1551 1399 245
42 811 1691 1783
28 1691 697 692
646 1607 1421 1684
312 1974 1671 86
212 905 73 226
149 517 215 924
1 1999 328 1453
1112 1934 831 1938
452 1041 1092 1108
752 1876 1394 1967
54 1919 1574 1188
1085 1608 502 1826
35 714 1023 312
191 655...

output:

No

result:

ok accepted

Test #16:

score: 0
Accepted
time: 1235ms
memory: 20000kb

input:

50000 3 3
1234 1643 1739 1512
10 1933 22 20
1310 1636 411 1094
438 1464 670 124
25 1973 310 1595
645 1051 951 492
399 1201 1372 1480
348 1596 576 63
48 1485 427 1291
47 1809 173 1483
362 1020 1617 767
113 1855 269 1437
732 1154 125 700
1538 1731 721 1313
235 764 820 1204
197 1616 1981 1686
1546 1962...

output:

Yes
00000000000000000000000000000000000000000000100000000000000000000000001100000000100010000000001001010010010000000000000000000010000000100110001010100110100000000000000011000000000000001110000000001000001100011001010000000110000000000000001010000000000000000001000011000000000110001000000001010000...

result:

ok accepted

Test #17:

score: 0
Accepted
time: 1159ms
memory: 22892kb

input:

50000 5 5
236 753 1756 1913
184 1557 1777 1450
1014 1832 286 44
532 1754 1644 1433
156 960 963 640
126 1056 1691 1258
22 1974 1989 1748
357 1569 219 1698
48 1001 719 1494
121 1645 1877 546
1180 1742 1332 214
383 1898 1419 304
564 600 314 1091
368 1475 1106 1828
186 1448 1362 1189
101 1909 17 868
52 ...

output:

No

result:

ok accepted

Test #18:

score: 0
Accepted
time: 98ms
memory: 30496kb

input:

50000 666 699
1110 1202 13 682
1312 1528 1338 1796
1000 1135 139 330
239 397 1915 95
1085 1097 1159 1023
1804 1864 1192 1138
1463 1729 32 475
753 1045 396 1237
1007 1240 557 1427
1661 1669 1926 1652
761 1003 652 138
38 76 372 1604
48 216 1426 1190
475 561 249 1496
74 175 30 414
780 812 1877 640
1613...

output:

No

result:

ok accepted

Test #19:

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

input:

2000 16 11
1633 1643 527 35
472 486 815 1543
443 455 810 818
950 960 978 1156
473 486 724 837
1959 1974 1507 1666
487 499 1013 936
224 235 1791 787
498 508 1515 1157
1897 1911 619 188
1931 1946 1116 160
870 883 1056 1118
804 816 1736 1569
1634 1649 674 310
348 358 100 1512
1652 1661 1751 1787
440 45...

output:

Yes
00000000000000000000100000000100000000000000000000000000000100000000000000000000010000000000000000000000000000100110000000000000000000000000000000000010000001000000000000000000000001010000000000000000001100000001000000000000000000000110000000000000010000000000100001100001101000001000001000000000...

result:

ok accepted

Test #20:

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

input:

2000 20 30
1236 1251 1570 1767
1041 1079 1374 1150
1609 1627 1256 214
1872 1898 1597 1826
375 402 1983 1515
532 552 974 415
1417 1426 342 269
1393 1422 1613 1130
781 818 521 1080
982 1002 417 620
1601 1618 522 1261
90 124 1999 628
639 677 733 1295
808 839 763 979
1316 1346 1685 1882
391 421 201 1133...

output:

Yes
00000000000000000000000000000000000000000000000000001000000000000000000000000010000100000000000000000001000000000010000000000000000000000100000000000000000000000000001000000100000100000001010001000000010000010110000000000000000000000100000100000000000000000000000000100100000010010000000000000100...

result:

ok accepted

Test #21:

score: 0
Accepted
time: 443ms
memory: 19932kb

input:

50000 18 11
1 225 703 628
180 350 564 570
420 484 253 17
133 178 809 543
1 225 145 1761
1 225 1801 144
1 225 1441 914
226 450 253 1563
112 402 809 359
1 225 631 1508
226 450 145 1068
1 225 505 1101
1 225 1801 1717
77 240 89 1696
93 291 777 1168
221 282 66 1666
26 293 1587 1677
1 225 1369 1750
127 33...

output:

Yes
10001111011110000101001100001011011100101101111000101100011100101001001001011100001101011001111000101101010000101000000100000010100001011100111111000001001111000010000101100110111110100000100110011010001110100000010111011011111010011011111110000001101110010110101011000111000011011011101111110010...

result:

ok accepted

Test #22:

score: 0
Accepted
time: 356ms
memory: 21524kb

input:

50000 16 20
531 889 372 1589
1 291 1057 1401
1 291 65 1881
68 232 505 1634
239 642 937 799
292 582 593 481
211 281 1679 1025
1 291 1681 1781
1 291 1857 1561
292 582 1585 1221
410 863 806 71
1 291 193 1161
292 582 1681 441
131 508 1454 1362
420 775 1272 1586
437 881 961 1584
129 550 1775 606
1 291 18...

output:

Yes
01100101110110000111101111110110111010001011000110110111010011010110110101101100101101000110111010100100101110111111100101110011001010011100111100111000111101010110101101011110101111111010110111100111011010011010001001110011111111101110000101101100111001110101010000010000101000000001000001011101...

result:

ok accepted

Test #23:

score: 0
Accepted
time: 150ms
memory: 23852kb

input:

50000 65 64
1424 1489 230 1633
398 462 780 1133
1221 1281 1691 1729
1099 1159 1691 1025
367 427 781 1345
1099 1159 1496 193
550 610 1366 641
184 244 196 1729
320 382 1471 1569
1223 1282 1351 865
428 488 1951 1985
489 549 521 1345
245 305 66 1921
993 1052 1613 356
1038 1098 1626 65
514 578 977 1158
4...

output:

Yes
00111111001110100110100110001101110010110010111001001100010101110100001100111011110010111100011001111011111000101001000111010111011110110001011001000011011101011101001101011011111110100001110110100100100001010101101111010001011100010010110010101000111000111010111011111111011110011010010110011010...

result:

ok accepted

Test #24:

score: 0
Accepted
time: 332ms
memory: 17152kb

input:

50000 11 11
1 130 628 320
1 130 419 1717
1 130 1332 1695
1293 1413 654 1183
183 434 591 1584
1 130 1013 386
1 130 991 1574
587 637 510 1239
1906 1942 817 69
1 130 364 793
1256 1547 102 317
297 429 1556 253
1 130 1420 485
1 130 1200 1090
1 130 78 1475
203 282 1674 577
1 130 67 78
304 534 1296 1158
1 ...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #25:

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

input:

50000 16 20
1302 1443 1425 26
1005 1299 1721 667
1 376 1185 121
377 752 1889 1481
377 752 897 1781
377 752 337 181
679 776 870 1151
460 522 1636 228
377 752 1361 681
377 752 1281 1781
377 752 1729 1281
474 553 1740 764
994 1403 1246 717
851 988 319 39
1 376 1121 181
377 752 721 1821
1 376 1665 661
9...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #26:

score: 0
Accepted
time: 121ms
memory: 17100kb

input:

50000 66 66
196 260 1717 1519
1 65 397 397
621 686 795 815
1301 1365 1783 859
850 910 1746 1150
1431 1495 859 1189
586 650 1849 793
462 521 111 1079
1704 1763 590 699
1755 1814 1656 408
1780 1844 1879 1630
1445 1507 1488 433
695 758 284 1075
1271 1332 289 1671
1301 1365 199 331
1 65 1189 1849
1041 1...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #27:

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

input:

50000 1370 1383
263 1101 608 145
749 1622 775 1977
169 1767 1329 1459
406 588 1627 1777
156 1287 1163 961
634 718 1333 429
38 1950 1442 1135
982 1072 129 1409
1336 1395 484 961
710 1012 690 1838
276 293 1989 954
41 1793 1015 1514
730 1991 757 901
895 1185 972 1861
609 948 236 1501
285 1421 1748 630
...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #28:

score: 0
Accepted
time: 352ms
memory: 19236kb

input:

50000 1240 1057
1117 1531 1249 1565
277 1996 1629 1434
835 1779 1726 352
358 1980 202 145
137 1304 15 604
808 1550 1646 407
60 1771 649 37
1719 1851 1411 997
695 1250 1937 1402
66 1988 305 504
44 1907 1870 1860
330 569 851 995
843 1232 1129 891
740 1293 1559 1676
180 1786 1219 1295
122 1810 1605 192...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #29:

score: 0
Accepted
time: 202ms
memory: 19032kb

input:

50000 1302 1053
19 339 1562 1013
744 1316 729 409
657 1367 1485 1217
246 1786 864 400
29 1980 1376 221
211 1604 1894 1936
139 483 435 601
1773 1861 872 1652
1361 1919 1597 1438
280 285 869 990
305 1985 1890 321
36 807 494 438
63 845 822 162
692 1964 1836 334
1292 1390 635 1720
167 1909 277 887
219 1...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #30:

score: 0
Accepted
time: 374ms
memory: 20028kb

input:

50000 1087 1308
822 1565 743 30
93 1754 1568 383
119 1315 1855 1554
135 414 1286 1285
261 1023 1024 781
150 1533 1162 1595
87 1810 648 1384
378 1554 1418 1267
308 1425 1960 656
118 1970 883 35
159 1338 126 1691
128 1489 15 1134
702 1843 623 1084
142 1946 1781 1289
324 1177 88 803
60 1750 1469 962
73...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #31:

score: 0
Accepted
time: 164ms
memory: 20000kb

input:

50000 1159 1443
1545 1879 1736 1788
739 1547 603 1832
100 1744 369 781
1036 1856 359 548
810 1786 236 1673
793 1173 324 908
91 1947 809 1725
221 1755 619 669
478 1014 608 1675
101 1989 547 1177
1144 1350 1772 1182
559 1933 690 485
802 1195 1540 1727
91 1653 152 159
67 1919 19 391
321 1907 172 198
36...

output:

No

result:

ok accepted

Test #32:

score: 0
Accepted
time: 239ms
memory: 20036kb

input:

50000 1447 1104
210 1173 1657 1999
76 1477 1177 1494
134 552 1009 1201
14 1839 1770 1151
134 1970 1727 51
1030 1408 1546 550
1145 1198 1179 540
395 1939 1668 1284
35 1957 590 1212
174 1877 1821 770
88 1761 251 1206
516 1550 680 1013
226 1599 1535 1701
245 1931 1503 1076
1124 1235 1530 1700
37 1995 1...

output:

No

result:

ok accepted

Test #33:

score: 0
Accepted
time: 618ms
memory: 19104kb

input:

50000 853 873
1390 1765 1629 862
352 1521 760 626
895 1138 377 197
23 1987 791 860
412 1018 513 289
80 1725 599 433
8 1988 47 266
529 1880 253 886
1512 1716 1352 459
226 1984 1764 527
1312 1619 487 571
1820 1881 1400 285
313 1093 243 948
585 1800 1353 83
979 1568 1942 812
960 1532 1602 807
285 1819 ...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #34:

score: 0
Accepted
time: 326ms
memory: 19140kb

input:

50000 863 811
7 623 649 551
999 1864 514 14
839 1022 1253 776
105 1055 1788 995
760 833 1467 689
786 1239 1010 96
553 1476 1141 131
375 1505 415 881
447 849 1920 824
247 1780 915 28
867 1966 1397 900
51 1735 249 377
600 710 1869 197
138 1454 1777 973
37 1973 1450 312
7 1993 1721 125
177 1974 989 904...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Test #35:

score: 0
Accepted
time: 322ms
memory: 19112kb

input:

50000 855 892
1068 1151 582 352
109 1896 665 602
84 1917 660 488
179 762 1740 269
1199 1626 685 224
860 1321 870 378
19 1627 602 460
1008 1701 1266 192
68 176 830 647
1252 1683 1789 518
396 1283 17 181
441 1604 136 164
68 1761 1551 185
69 1017 1294 783
225 1815 1796 130
1634 1889 108 545
819 1659 98...

output:

Yes
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok accepted

Extra Test:

score: 0
Extra Test Passed