QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#915525#1814. Kingdoms and QuarantinecaijianhongAC ✓41ms5120kbC++177.6kb2025-02-26 11:49:192025-02-26 11:49:19

Judging History

This is the latest submission verdict.

  • [2025-02-26 11:49:19]
  • Judged
  • Verdict: AC
  • Time: 41ms
  • Memory: 5120kb
  • [2025-02-26 11:49:19]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define debug(...) fprintf(stderr, ##__VA_ARGS__)
#else
#define endl "\n"
#define debug(...) void(0)
#endif
using LL = long long;
template <class T>
using pqueue_less = priority_queue<T, vector<T>, greater<T>>;
template <class Cap, class Cst>
struct mcf_graph { /*{{{*/
  const Cst maxc = numeric_limits<Cst>::max();
  struct edge {
    int v, rid;
    Cap cap;
    Cst cst;
  };
  int n;
  vector<vector<edge>> g;
  vector<Cst> h, dis;
  vector<int> pre;
  mcf_graph() = default;
  mcf_graph(int _n) : n(_n), g(_n) {}
  int addedge(int u, int v, Cap cap, Cst cst) {
    int tid = (int)g[u].size(), rid = (int)g[v].size() + (u == v);
    g[u].push_back({v, rid, cap, cst});
    g[v].push_back({u, tid, 0, -cst});
    return rid;
  }
  bool dijkstra(int s, int t) {
    vis.assign(n, false);
    pre.assign(n, -1);
    dis.assign(n, maxc);
    pqueue_less<pair<Cst, int>> q;
    q.emplace(dis[s] = 0, s);
    while (!q.empty()) {
      int u = q.top().second;
      q.pop();
      if (exchange(vis[u], true)) continue;
      for (auto e : g[u]) {
        auto w = h[u] - h[e.v] + e.cst;
        if (e.cap && dis[e.v] > dis[u] + w) {
          assert(w >= 0);
          pre[e.v] = e.rid;
          q.emplace(dis[e.v] = dis[u] + w, e.v);
        }
      }
    }
    return vis[t];
  }
  vector<int> vis, cur;
  Cap dfs(int u, Cap flw, int t) {
    if (u == t) return flw;
    vis[u] = true;
    Cap run = 0;
    for (int &i = cur[u]; i < (int)g[u].size(); i++) {
      auto &e = g[u][i];
      if (e.cap && !vis[e.v] && h[e.v] == h[u] + e.cst) {
        auto f = dfs(e.v, min(flw - run, e.cap), t);
        run += f, e.cap -= f, g[e.v][e.rid].cap += f;
        if (run == flw) break;
      }
    }
    if (run == flw) vis[u] = false;
    return run;
  }
  struct result_type {
    Cap cap;
    Cst cst;
  };
  template <bool op = false>
  result_type flow(int s, int t, Cap lim = numeric_limits<Cap>::max()) {
    Cap flw = 0;
    Cst cst = 0;
    if (h.empty()) h.assign(n, 0);
    dijkstra(s, t);
    for (int i = 0; i < n; i++)
      if (dis[i] < maxc) h[i] += dis[i];
    auto hs = h[s];
    for (int i = 0; i < n; i++) h[i] -= hs;
    while (flw < lim && dijkstra(s, t)) {
      if (op && h[t] >= 0) break;
      for (int i = 0; i < n; i++)
        if (dis[i] < maxc) h[i] += dis[i];
      //    Cap run = lim - flw;
      //    for (int v = t, u; v != s; v = u) {
      //      u = g[v][pre[v]].v;
      //      run = min(run, g[u][g[v][pre[v]].rid].cap);
      //    }
      //    for (int v = t, u; v != s; v = u) {
      //      u = g[v][pre[v]].v;
      //      g[u][g[v][pre[v]].rid].cap -= run;
      //      g[v][pre[v]].cap += run;
      //    }
      vis.assign(n, false);
      cur.assign(n, 0);
      auto run = dfs(s, lim - flw, t);
      flw += run, cst += run * h[t];
    }
    return {flw, cst};
  }
}; /*}}}*/
template <class Cap, class Cst>
struct mcf_interface { 
  int n;
  vector<Cap> d;
  mcf_graph<Cap, Cst> mf;
  Cap cap{};
  Cst val{};
  vector<pair<int, int>> ids;
  mcf_interface() = default;
  mcf_interface(int _n) : n(_n), d(_n), mf(_n + 2) {}
  void addedge(int u, int v, Cap f, Cst c) {
    int id;
    if (c >= 0)
      id = mf.addedge(u, v, f, c), ids.emplace_back(v, id);
    else
      id = mf.addedge(v, u, f, -c), val += f * c, d[u] -= f, d[v] += f,
         ids.emplace_back(v, mf.g[u][id].rid);
  }
  auto flow(int s, int t, Cap lim = numeric_limits<Cap>::max()) {
    int s1 = n, t1 = n + 1;
    for (int i = 0; i < n; i++) {
      if (d[i] > 0)
        mf.addedge(s1, i, d[i], 0);
      else if (d[i] < 0)
        mf.addedge(i, t1, -d[i], 0);
    }
    mf.addedge(t, s, lim, 0);
    auto ret = mf.flow(s1, t1);
    cap = mf.g[s].back().cap, val += ret.cst;
    mf.g[s].pop_back(), mf.g[t].pop_back();
    ret = mf.template flow<true>(s, t, lim - cap);
    ret.cap += cap, ret.cst += val;
    return ret;
  }
  auto sch() {
    vector<tuple<int, int, Cap, int>> vec;
    //  for (auto [v, id] : ids) 
    for (int i = 0; i < (int)ids.size(); i++) {
      auto [v, id] = ids[i];
      auto e = mf.g[v][id];
      vec.emplace_back(e.v, mf.g[e.v][e.rid].v, e.cap, i);
    }
    return vec;
  }
}; 
int n1, n2, m, col[6010], n;
int main() {
#ifndef LOCAL
#ifdef NF
  freopen("b.in", "r", stdin);
  freopen("b.out", "w", stdout);
#endif
  cin.tie(nullptr)->sync_with_stdio(false);
#endif
  cin >> n1 >> n2 >> m, n = n1 + n2;
  mcf_interface<int, int> mf(n1 + n2 + 2);
  vector<pair<int, int>> fuck;
  for (int i = 1, u, v; i <= m; i++) {
    cin >> u >> v;
    if (u > v) swap(u, v);
    fuck.emplace_back(u, v);
      col[u] ^= 1, col[v] ^= 1;
  }
  for (auto [u, v] : fuck) {
    if (col[u] != col[v]) swap(u, v);
    debug("u = %d, v = %d\n", u, v);
    mf.addedge(u, v, 1, -1);
  }
  for (int i = 1; i <= n1; i++) mf.addedge(0, i, 1, 0);
  for (int i = n1 + 1; i <= n1 + n2; i++) mf.addedge(i, n1 + n2 + 1, 1, 0);
  int rcnt = -mf.flow(0, n1 + n2 + 1).cst;
  cout << rcnt << endl;
  auto sch = mf.sch();
  for (int i = 0; i < (int)sch.size();) {
    if (!get<2>(sch[i]) || get<0>(sch[i]) == 0 || get<1>(sch[i]) == n1 + n2 + 1)
      swap(sch[i], sch.back()), sch.pop_back();
    else
      i++;
  }
  for (auto [u, v, cap, id] : sch) debug("(%d, %d, %d, %d)\n", u, v, cap, id);
  assert((int)sch.size() == rcnt);
  vector<int> answer;
  struct edge {
    int u, v, id;
  };
  static vector<edge> g[6010];
  while (!sch.empty()) {
    static int dfn[6010], low[6010], cnt, stk[6010], top, col[6010];
    static edge* fa[6010];
    memset(dfn, 0, sizeof dfn);
    memset(col, 0, sizeof col);
    for (int i = 1; i <= n; i++) g[i].clear();
    for (auto [u, v, cap, id] : sch) g[u].push_back({u, v, id});
    top = cnt = 0;
    vector<int> cyc;
    auto tarjan = [&](auto self, int u) -> void {
      dfn[u] = low[u] = ++cnt, stk[++top] = u;
      for (auto e : g[u]) {
        if (!cyc.empty()) break;
        int v = e.v;
        if (!dfn[v]) fa[v] = &e, self(self, v), low[u] = min(low[u], low[v]);
        else if (!col[v]) {
          low[u] = min(low[u], dfn[v]);
          vector<edge> tmp;
          tmp.push_back(e);
          for (int x = u; x != v; x = fa[x]->u) tmp.push_back(*fa[x]);
          for (auto e : tmp) cyc.push_back(e.id), debug("%d ", e.id);
          debug("\n");
          for (auto e : tmp) if (::col[e.u] == ::col[e.v]) answer.push_back(e.id);
          for (auto e : tmp) if (::col[e.u] != ::col[e.v]) answer.push_back(e.id);
          break;
        }
      }
      if (low[u] == dfn[u]) {
        col[u] = 1341234;
        do col[stk[top]] = 123124; while (stk[top--] != u);
      }
    };
    for (int i = 1; i <= n; i++) if (!dfn[i]) tarjan(tarjan, i);
    if (cyc.empty()) break;
    sort(cyc.begin(), cyc.end());
    auto tmp = exchange(sch, {});
    for (auto e : tmp) {
      if (!binary_search(cyc.begin(), cyc.end(), get<3>(e))) sch.push_back(e);
    }
  }
  int deg[6010];
  memset(deg, 0, sizeof deg);
  for (auto [u, v, cap, id] : sch) deg[v] += 1;
  int res = (int)sch.size();
  while (res > 0) {
    int u = min_element(deg + 1, deg + n + 1) - deg;
    for (int i = 1; i <= n; i++) if (!deg[i] && !g[i].empty()) u = i;
    assert(deg[u] == 0);
    vector<edge> tmp;
    while (!g[u].empty()) tmp.push_back(g[u].back()), g[u].pop_back(), u = tmp.back().v, deg[u] -= 1;
    res -= (int)tmp.size();
    for (auto e : tmp) if (col[e.u] == col[e.v]) answer.push_back(e.id);
    for (auto e : tmp) if (col[e.u] != col[e.v]) answer.push_back(e.id);
  }
  for (int x : answer) cout << x + 1 << " ";
  cout << endl;
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3 5
1 3
1 4
1 5
2 4
2 5

output:

3
5 1 3 

result:

ok accepted

Test #2:

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

input:

1 2 2
1 2
1 3

output:

0


result:

ok accepted

Test #3:

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

input:

4 3 7
1 5
2 5
2 6
2 7
3 6
4 5
4 7

output:

5
2 7 4 6 1 

result:

ok accepted

Test #4:

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

input:

10 10 20
2 11
2 17
1 12
8 14
9 15
10 12
9 13
1 18
3 15
2 14
2 16
7 13
8 15
8 20
9 12
6 13
8 16
6 11
4 20
6 16

output:

11
20 1 11 18 6 5 14 13 16 9 10 

result:

ok accepted

Test #5:

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

input:

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

output:

21
26 21 13 29 1 11 18 3 17 27 8 22 28 24 30 10 20 25 23 19 6 

result:

ok accepted

Test #6:

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

input:

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

output:

22
37 44 4 6 19 17 21 38 50 23 36 48 26 15 42 45 35 12 33 11 9 22 

result:

ok accepted

Test #7:

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

input:

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

output:

10
2 99 39 1 32 5 29 79 8 60 

result:

ok accepted

Test #8:

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

input:

60 60 200
40 91
35 64
3 105
48 110
4 115
36 77
2 104
14 111
43 68
23 112
37 62
40 68
57 106
22 95
9 89
29 69
24 101
52 75
26 63
60 115
50 118
26 93
30 73
38 116
54 97
55 76
10 97
8 82
1 74
29 89
27 72
33 102
7 86
51 77
4 63
40 109
6 97
1 120
39 102
53 89
2 78
35 109
22 107
47 89
44 106
44 105
46 120...

output:

101
125 72 19 193 113 74 144 189 22 3 62 14 71 154 158 146 42 1 36 109 148 29 178 99 180 112 23 26 177 186 18 87 13 200 45 152 89 141 58 119 50 65 97 21 73 150 184 53 12 90 95 149 174 198 132 41 67 64 44 161 108 56 187 195 136 102 68 96 82 106 51 9 134 61 49 83 35 117 5 17 63 76 69 163 168 30 80 135...

result:

ok accepted

Test #9:

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

input:

60 60 500
17 63
3 65
31 120
58 94
36 76
14 120
54 96
30 97
43 119
53 67
41 75
59 84
49 70
11 81
27 70
2 105
44 94
13 115
16 97
3 95
19 83
2 89
29 119
16 77
26 99
25 115
25 93
43 84
43 61
45 105
38 69
24 100
16 118
33 73
6 101
17 67
10 84
49 73
45 118
48 92
22 93
1 111
8 72
19 107
23 95
1 112
21 108
...

output:

319
48 15 65 29 478 490 384 173 132 193 59 9 109 445 195 479 476 110 401 319 141 30 165 14 463 201 279 455 488 94 214 36 495 322 449 1 17 390 387 4 235 454 35 404 182 353 204 89 305 13 90 170 197 23 60 52 119 468 473 471 434 126 41 349 293 403 460 494 247 493 423 25 464 212 42 62 348 340 120 114 69 ...

result:

ok accepted

Test #10:

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

input:

60 60 1000
60 94
5 71
53 115
22 61
8 65
38 62
51 63
26 68
40 94
16 63
24 100
54 98
28 86
41 96
47 101
42 75
56 100
29 89
1 110
23 71
60 73
36 74
12 95
3 106
18 77
4 65
49 83
3 83
26 117
24 103
59 85
36 63
8 96
8 101
26 114
37 69
24 89
19 80
36 100
54 89
22 75
3 89
31 119
33 62
58 69
38 114
39 81
54 ...

output:

691
946 147 47 86 44 981 45 9 163 973 244 870 989 976 985 160 938 994 192 413 20 208 101 855 62 978 177 8 281 992 16 366 94 991 41 105 498 53 393 999 984 953 263 25 212 963 997 114 34 54 89 88 967 862 15 159 102 971 110 310 914 226 859 300 965 290 239 39 246 126 990 1000 100 92 596 931 977 108 917 2...

result:

ok accepted

Test #11:

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

input:

60 60 2000
40 120
9 78
35 69
18 102
19 117
22 84
4 72
53 68
49 73
16 107
50 93
16 80
35 72
31 112
9 67
47 97
35 65
14 96
49 111
48 117
55 104
43 97
17 74
9 76
45 114
38 117
18 112
11 114
58 72
3 116
32 95
38 113
10 104
17 93
36 94
16 106
17 84
43 61
46 61
20 62
22 72
18 73
3 118
22 70
44 68
34 75
47...

output:

1282
1919 10 1981 176 1991 1993 1970 1990 82 94 1947 53 46 226 80 215 235 1954 1987 1901 1906 1929 1931 37 1861 97 246 1899 255 23 1949 31 1815 290 1909 321 1922 1810 310 154 1998 1975 15 60 65 107 1916 96 113 1846 159 1873 654 1985 300 1950 1868 24 1996 292 1982 1938 39 1937 1986 1896 1942 1831 38 ...

result:

ok accepted

Test #12:

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

input:

60 60 2000
53 65
55 77
46 75
31 82
12 72
49 100
46 105
20 80
5 90
31 77
54 76
37 84
38 68
14 70
47 93
10 120
57 94
54 107
53 74
37 120
9 96
23 84
18 83
31 69
57 82
11 67
52 65
9 88
5 65
51 90
19 96
56 117
29 89
24 83
13 82
26 76
51 73
23 86
52 108
12 71
26 62
51 100
41 100
5 66
56 75
10 87
16 72
47 ...

output:

1232
32 3 96 45 31 1860 95 338 1582 1996 1811 143 1928 1925 400 1915 1927 1959 146 197 27 1808 1975 161 20 22 71 54 113 1825 12 115 1954 1964 147 2 1985 1839 1767 1977 1718 1930 1797 4 155 85 167 257 107 1901 1891 10 1746 1921 1618 1978 1841 1968 1908 29 1984 1939 73 1842 1799 1986 442 148 1561 1988...

result:

ok accepted

Test #13:

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

input:

60 60 2000
10 119
13 117
49 102
26 106
20 76
54 73
9 72
42 100
19 118
51 68
30 64
21 95
9 84
18 90
51 91
39 109
49 112
7 79
13 82
5 95
20 65
5 105
38 91
35 118
46 89
36 63
41 91
23 101
50 110
39 92
60 104
47 74
50 97
6 72
7 76
1 119
17 70
51 84
23 97
28 84
42 82
59 75
32 86
53 69
3 61
43 92
35 85
56...

output:

1578
242 2000 190 298 11 10 1954 96 121 87 1949 204 1962 176 1968 15 1990 572 26 1813 1988 28 763 1994 182 1918 216 129 239 1879 348 303 1957 1951 1886 214 267 103 328 1942 1973 877 14 1945 149 426 1898 108 237 263 1931 1846 4 1740 412 1978 23 20 147 1878 68 1927 171 1935 241 27 177 131 29 21 59 499...

result:

ok accepted

Test #14:

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

input:

60 60 3000
57 75
4 75
40 61
9 120
55 88
31 107
47 77
56 92
49 100
30 92
34 72
29 105
46 63
37 80
22 65
11 72
43 111
24 88
6 81
24 94
47 98
2 79
59 84
51 64
13 73
30 63
58 69
25 65
52 97
36 106
26 97
16 103
16 92
31 112
36 108
13 97
32 119
39 114
48 117
25 66
14 117
6 90
53 84
1 117
58 108
25 99
12 1...

output:

2810
25 29 2991 33 2998 30 36 105 10 70 297 2983 287 38 66 27 4 23 2997 212 136 68 145 2984 480 155 39 130 2993 37 331 315 76 605 2985 299 1 2956 71 158 272 200 2935 96 2 147 2968 12 2996 286 229 109 107 63 115 425 2964 531 2957 28 174 2990 277 15 17 67 40 326 2995 57 374 103 179 31 98 54 2965 169 9...

result:

ok accepted

Test #15:

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

input:

60 60 3000
47 106
32 101
35 118
6 104
34 111
16 78
29 112
48 96
32 114
41 70
21 80
16 75
42 80
9 90
26 88
15 95
13 105
27 110
53 102
43 83
35 94
26 67
10 92
48 69
53 120
54 90
58 69
9 66
50 109
53 106
39 84
39 89
17 116
33 77
30 84
27 89
41 87
35 89
16 109
26 90
37 91
4 103
9 76
32 102
29 61
58 115
...

output:

2608
68 2940 2977 2973 181 51 2963 2924 2978 2881 62 2998 2858 2843 3000 2975 2953 184 2 407 4 235 115 2996 2856 197 281 2997 31 144 2966 131 92 201 168 376 329 2970 2902 2941 2984 2967 130 2982 22 2983 103 536 307 35 2808 2914 2849 250 2892 125 545 134 2917 69 740 2994 2840 421 2923 2962 583 335 91...

result:

ok accepted

Test #16:

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

input:

60 60 3000
30 116
60 66
30 87
8 84
6 61
58 96
26 89
60 86
15 91
7 89
13 104
56 104
33 105
37 72
2 88
8 107
56 65
29 77
15 103
3 115
18 67
52 65
40 71
38 98
36 85
18 102
59 86
26 101
24 67
2 71
56 69
55 72
57 79
32 65
12 114
36 81
55 97
41 113
15 89
7 84
59 113
53 71
57 99
44 99
4 101
36 68
13 78
7 1...

output:

2746
21 131 73 35 140 69 2912 486 3000 263 112 84 255 2943 2947 92 2968 241 2975 63 179 444 410 2939 10 343 59 135 408 348 2992 2930 39 308 107 2979 11 46 2998 2997 2967 2953 2999 211 256 2982 658 575 161 2981 16 378 58 320 64 19 2960 113 2870 360 2906 167 2874 13 768 2988 124 2957 49 262 2927 180 2...

result:

ok accepted

Test #17:

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

input:

60 60 3000
32 72
16 110
13 102
52 65
36 79
39 118
16 64
46 108
56 116
10 109
35 117
28 90
31 83
36 78
14 77
6 104
4 64
5 73
34 63
21 66
56 61
26 64
37 106
53 92
2 91
35 102
40 99
57 95
40 79
53 104
20 72
60 118
41 112
60 106
2 101
60 113
50 87
31 102
46 88
44 98
18 101
34 87
52 63
52 86
56 85
8 99
5...

output:

1946
2984 2911 77 2833 157 2785 2994 2944 2812 2925 2947 2945 81 112 2811 2903 11 303 2910 2968 2691 225 524 2922 2960 156 2930 2991 28 168 17 20 44 2931 396 2852 36 2946 284 2798 2942 2914 2855 2918 2841 2799 2928 2978 33 195 286 46 2943 2725 248 2992 2780 2908 2905 345 346 2920 2757 90 2965 2819 2...

result:

ok accepted

Test #18:

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

input:

60 60 3000
13 110
32 77
31 63
23 75
28 119
16 84
32 113
50 114
15 66
47 96
21 97
41 81
55 88
25 110
59 112
1 100
45 115
27 66
24 66
38 94
40 67
39 95
6 109
30 75
3 117
43 111
28 118
37 101
57 66
58 90
57 79
47 69
13 87
6 115
57 101
54 88
14 78
22 68
53 78
58 73
10 74
40 94
43 107
34 93
19 85
44 86
5...

output:

2770
11 80 50 2955 74 2991 174 2942 2983 24 268 21 2989 71 38 2965 2872 37 48 54 151 82 67 271 25 97 369 14 76 219 328 217 2999 34 615 130 51 266 2979 261 293 2939 40 183 120 3000 5 141 641 153 2978 30 2921 341 269 2957 214 77 2958 2920 212 224 129 202 57 154 52 96 360 289 81 31 410 28 2998 2905 35 ...

result:

ok accepted

Test #19:

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

input:

80 80 200
32 95
60 86
23 146
79 154
7 81
66 81
56 96
74 100
20 120
54 157
48 148
69 144
60 87
74 87
3 141
60 150
48 125
39 129
37 82
4 81
19 95
30 132
62 136
67 118
77 119
79 129
51 119
51 152
72 114
34 110
27 84
40 112
24 123
32 133
28 131
34 102
75 102
5 93
30 135
39 131
4 160
24 107
49 148
75 149...

output:

106
1 102 156 21 152 60 148 100 106 2 30 37 124 105 98 93 99 191 36 44 113 133 27 23 25 126 192 43 17 109 83 11 90 88 149 92 61 63 38 96 119 95 39 73 114 82 150 151 183 7 158 67 159 131 172 50 26 4 49 199 52 153 56 142 169 84 164 42 33 170 48 128 187 123 18 58 35 75 19 137 138 195 70 181 134 197 91 ...

result:

ok accepted

Test #20:

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

input:

80 80 1000
25 148
12 123
32 124
64 137
45 81
30 114
3 135
13 142
50 130
23 113
42 146
64 139
66 148
5 136
62 86
19 137
57 128
1 90
56 103
38 155
43 84
3 88
62 130
12 87
15 107
27 117
6 135
17 132
54 149
53 109
5 121
17 93
6 132
50 133
62 94
20 88
6 143
44 148
33 131
61 118
68 149
57 141
46 159
55 15...

output:

806
147 987 50 36 997 136 12 229 96 981 629 996 503 14 180 49 4 961 921 108 143 584 609 75 214 249 191 80 111 153 433 114 82 995 199 2 303 41 962 205 66 974 46 218 62 148 100 306 638 954 331 38 131 34 52 347 25 7 13 276 761 936 127 31 15 137 35 348 266 65 243 358 993 262 236 140 904 606 142 156 947 ...

result:

ok accepted

Test #21:

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

input:

80 80 2000
53 123
41 154
25 132
32 137
40 149
78 99
2 105
11 110
30 91
26 129
41 110
75 131
62 98
15 87
6 144
35 103
16 136
69 134
56 146
78 159
2 155
15 140
24 134
34 113
61 88
22 131
73 156
46 116
68 113
48 115
28 92
22 93
53 156
56 149
27 104
56 91
25 140
52 87
50 129
48 91
58 127
15 125
12 111
1...

output:

1496
1880 173 1935 1940 355 76 5 1962 1977 364 107 1952 449 1957 129 476 1615 122 15 359 59 24 1951 1910 372 1981 1963 1795 1997 1936 29 814 82 26 1983 244 165 1985 1025 1834 1860 1971 46 1930 10 2000 92 41 1943 85 1909 1830 1877 190 110 1698 1918 87 1996 336 608 178 1945 180 648 111 1801 158 1888 1...

result:

ok accepted

Test #22:

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

input:

80 80 2000
7 97
42 84
29 152
46 115
34 111
50 121
34 153
62 150
63 138
14 154
27 134
34 116
20 90
37 143
66 149
62 102
10 160
43 110
37 152
29 112
5 99
68 139
55 122
74 135
43 113
71 159
5 131
37 106
70 118
3 124
2 87
35 130
74 99
70 134
44 143
55 134
26 81
10 133
47 130
24 92
77 108
13 133
56 87
39...

output:

1404
401 1993 1880 104 2 1905 146 84 1899 1924 1883 1997 93 252 60 63 1962 1965 1996 106 1860 1878 1897 1833 1870 1959 1941 1799 237 1869 44 1972 1977 58 183 1796 392 49 1971 43 1975 1930 1766 1944 1976 24 1838 166 47 1966 1986 1985 122 191 1967 132 208 51 1817 108 1710 41 347 173 32 523 1991 1994 3...

result:

ok accepted

Test #23:

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

input:

80 80 2000
75 99
6 84
42 111
54 127
12 116
42 113
18 114
22 131
70 139
29 83
5 98
50 83
77 104
20 132
24 100
55 132
54 151
52 110
61 128
44 127
74 105
58 160
61 104
42 93
80 160
54 98
48 103
11 87
38 152
29 103
18 135
72 160
77 154
1 116
6 134
2 112
37 134
13 154
51 157
75 114
77 131
9 139
12 106
34...

output:

1638
232 1946 1872 1974 1960 265 286 1936 1764 9 1818 119 300 301 61 1893 1959 250 1921 264 1931 1926 1979 1949 1824 957 592 74 4 1993 1973 720 1940 1928 1817 1932 24 84 279 460 58 572 178 1996 354 518 63 1938 162 116 10 233 797 70 307 12 30 1966 551 287 761 1867 443 20 1969 348 1972 73 1906 151 27 ...

result:

ok accepted

Test #24:

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

input:

80 80 3000
11 116
24 95
4 152
51 137
12 102
44 128
69 120
69 134
39 122
17 94
51 102
61 144
52 84
57 81
32 117
55 125
9 136
13 127
31 120
26 87
58 141
73 157
28 153
26 106
63 82
63 151
45 107
16 115
38 87
5 115
14 151
2 156
79 152
33 104
26 107
33 123
2 152
79 83
23 131
67 154
34 159
29 110
20 152
1...

output:

2518
39 2934 2981 2961 645 123 325 2999 320 81 2987 56 193 71 34 112 611 231 99 43 2917 36 230 2998 2994 62 104 235 410 29 259 163 2949 147 2963 60 2979 457 195 2967 2928 2925 89 2836 162 274 246 202 9 106 2857 2855 2991 156 218 2952 40 296 165 2951 426 2972 205 305 2958 2932 2919 2946 185 2726 307 ...

result:

ok accepted

Test #25:

score: 0
Accepted
time: 6ms
memory: 4352kb

input:

80 80 3000
53 81
62 95
69 96
5 110
41 101
18 123
55 110
51 148
36 117
55 108
72 130
9 152
26 147
38 100
30 155
19 155
50 91
15 100
74 110
33 146
41 154
46 113
37 91
43 133
56 137
66 131
39 114
10 107
11 99
47 133
64 91
30 120
13 156
17 94
7 82
50 85
45 108
24 115
73 90
18 107
34 97
27 147
58 91
78 1...

output:

2715
73 35 54 151 447 351 104 162 18 92 81 343 88 177 14 85 288 113 2994 465 25 197 93 417 511 87 2999 155 422 33 9 2991 519 133 255 3000 2978 2962 62 2996 469 102 12 51 433 2976 40 31 573 111 63 179 2988 64 52 48 145 96 117 47 2934 2983 599 22 144 452 27 32 116 239 213 136 1 66 334 229 166 57 114 3...

result:

ok accepted

Test #26:

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

input:

80 80 3000
74 117
47 82
50 131
13 156
58 101
29 157
56 151
75 87
11 135
78 82
71 151
16 157
68 102
26 159
45 130
70 122
68 123
11 91
42 142
59 125
52 141
9 105
33 110
74 140
21 83
29 130
20 104
61 156
1 94
9 102
40 97
57 90
44 104
67 120
12 144
36 116
55 114
77 155
60 110
60 93
36 151
37 137
22 155
...

output:

2355
140 48 2988 205 2946 2930 2989 61 2962 76 40 78 2952 136 119 2912 189 149 2944 2995 2967 176 35 55 806 2958 505 2972 300 2850 67 222 2931 2936 2841 237 679 2964 2950 368 2938 2965 45 2876 2935 215 2915 2801 98 295 88 19 2975 2812 52 2924 338 2846 1143 2987 2942 12 2957 165 118 9 463 37 287 341 ...

result:

ok accepted

Test #27:

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

input:

80 80 3000
29 138
41 120
64 108
62 95
71 147
45 110
37 154
71 82
49 84
55 82
18 81
1 141
41 139
78 130
3 135
65 134
48 102
25 81
17 121
21 83
10 125
49 104
63 144
14 111
64 130
23 87
13 97
72 100
36 97
37 100
46 110
59 82
7 86
73 157
77 98
75 122
15 108
27 106
18 149
54 133
48 106
63 86
58 150
13 13...

output:

2524
55 69 50 176 12 2957 71 2941 2989 20 277 316 2975 353 76 2968 2954 2911 2824 148 2932 2848 602 26 80 28 2929 2987 2785 108 2992 276 34 198 17 2938 2971 756 81 144 370 2889 82 336 2974 151 429 335 37 2988 99 364 153 474 259 2809 2997 2858 2844 503 32 202 226 2991 2920 2921 641 128 15 3000 102 29...

result:

ok accepted

Test #28:

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

input:

80 80 3000
77 151
47 107
20 102
48 160
69 104
16 155
52 154
64 118
70 132
30 141
66 132
36 100
66 109
12 147
33 145
48 142
72 149
44 154
29 117
60 127
63 118
21 115
61 150
50 131
12 148
39 108
8 155
62 153
6 87
80 130
27 153
33 128
18 150
80 121
62 95
8 96
39 151
26 123
23 120
35 124
31 113
54 100
1...

output:

1998
2789 155 267 16 4 2985 2994 2913 2657 2974 57 32 2892 48 2876 2897 28 2993 2936 2930 2951 704 2867 2880 422 2874 686 2975 308 2849 2919 2760 119 271 68 521 2599 203 1209 2835 2866 2925 24 176 2938 2751 2946 2948 143 2977 2945 2493 47 2911 313 74 2912 2717 2923 38 2887 226 2771 2958 2931 56 2953...

result:

ok accepted

Test #29:

score: 0
Accepted
time: 14ms
memory: 4608kb

input:

1000 1000 3000
42 1981
990 1593
249 1397
568 1481
729 1994
719 1296
178 1959
177 1008
585 1063
612 1102
888 1378
888 1789
883 1380
978 1981
113 1754
253 1953
902 1262
518 1588
806 1449
489 1271
368 1026
317 1123
2 1988
962 1227
336 1880
927 1703
414 1043
402 1032
766 1538
226 1736
799 1879
813 1143
...

output:

1578
1630 1906 2241 1165 1894 2822 1132 267 11 460 2987 1759 394 2524 2186 703 2022 2438 2739 1018 1493 66 632 12 1121 1532 493 2834 399 2888 927 879 2442 1075 1809 1649 2395 1619 432 2441 483 562 1684 2383 121 1374 1931 348 86 325 2228 964 261 2838 2902 1105 2826 566 423 1653 2775 2539 2154 486 384...

result:

ok accepted

Test #30:

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

input:

1000 1000 3000
912 1168
247 1188
798 1560
618 1138
611 1467
268 1411
302 1117
885 1023
934 1777
732 1717
827 1421
855 1063
928 1047
135 1603
59 1730
307 1539
681 1044
413 1011
44 1689
328 1891
101 1678
334 1171
931 1500
577 1793
556 1714
346 1748
628 1949
417 1736
59 1356
401 1783
67 1571
924 1064
1...

output:

1594
613 1243 1285 2923 163 913 1104 1339 2393 24 838 2837 2106 2487 1807 2665 504 2674 1379 491 2882 1174 2258 682 649 1635 552 2793 21 1445 935 2380 272 573 1944 1080 2144 332 2245 2171 1231 2309 2806 827 2304 1895 1962 1745 1997 1496 2675 2091 404 2176 2430 372 736 936 616 662 2059 251 1148 532 1...

result:

ok accepted

Test #31:

score: 0
Accepted
time: 14ms
memory: 4736kb

input:

1000 1000 3000
330 1699
664 1166
556 1642
273 1288
354 1795
435 1525
157 1163
200 1501
922 1144
264 1052
823 1819
998 1773
822 1869
268 1204
415 1681
355 1775
260 1214
567 1086
204 1099
509 1738
330 1147
382 1138
924 1961
221 1213
834 1739
895 1196
864 1342
174 1933
153 1175
343 1461
232 1836
811 11...

output:

1655
2138 471 2215 1767 1690 1255 2318 713 1331 327 316 1249 358 597 2180 2369 2959 1047 2909 353 1406 2612 2997 541 1600 2690 2863 2968 420 1878 203 2555 2341 2082 2037 417 2919 2404 2231 2043 1701 2251 2363 279 2499 444 1468 2942 351 884 946 506 1186 935 298 2648 2146 23 82 1562 1922 2572 1398 297...

result:

ok accepted

Test #32:

score: 0
Accepted
time: 15ms
memory: 4736kb

input:

1500 1500 3000
1341 1517
832 1618
1031 1651
1128 1677
206 1889
347 2836
225 2772
1198 1733
1307 1884
84 1870
425 2658
162 2097
467 2062
1406 2565
1143 1980
1335 2339
822 2100
310 1792
291 2224
1276 2244
1382 1532
50 1510
1010 2756
427 2992
1387 2727
812 1916
1007 2328
1480 2107
1337 2117
634 2621
60...

output:

1404
1146 1695 875 107 2440 340 307 2966 1398 2578 859 1978 963 275 1121 2246 2546 823 95 739 2724 857 536 2969 769 1033 2407 2859 1005 1073 1431 631 1511 898 548 2171 284 911 1435 223 12 800 213 441 576 1215 1208 1501 2691 81 2711 2710 1452 1973 1322 2927 2147 2864 694 1056 2250 19 477 253 2247 72 ...

result:

ok accepted

Test #33:

score: 0
Accepted
time: 14ms
memory: 4864kb

input:

1500 1500 3000
963 1846
402 2056
303 1852
588 2296
151 2990
226 2196
648 2054
1379 2292
1380 2920
476 2550
515 2519
573 1666
606 2770
180 2089
966 1885
565 2598
1041 1749
227 2525
1250 2576
135 2488
882 1767
63 2446
1054 2867
346 2742
601 1811
156 2279
828 2261
164 2318
1215 1806
989 1547
688 2798
1...

output:

1424
2009 1694 2852 1478 2659 2093 816 2219 1601 82 2521 1152 497 650 2940 310 1722 1262 2377 1964 104 2607 1855 2708 2476 1591 2220 888 1530 439 1398 1037 1397 1266 1226 2031 758 509 2315 701 847 2757 2973 215 2879 1641 2015 825 2333 2688 789 1611 2573 2675 1121 669 2776 2044 2625 1453 186 1061 651...

result:

ok accepted

Test #34:

score: 0
Accepted
time: 17ms
memory: 4608kb

input:

1500 1500 3000
1096 1885
448 2108
894 1764
709 1632
61 2276
1076 2084
1027 1782
1486 1725
616 1836
799 1947
1022 2781
1316 2373
642 1660
1430 2784
68 2181
1224 2665
1450 2212
563 2852
81 1596
462 2169
770 2219
1197 2031
657 2366
616 2170
1091 1783
1130 1968
312 1958
671 2599
465 2683
1144 1773
1344 ...

output:

1449
904 1630 2841 519 1932 1012 2487 2794 2959 2171 312 487 1995 1638 417 1129 301 1099 282 2967 2356 1203 724 2302 418 1385 2516 2504 2010 993 1312 1165 632 2412 2274 1842 684 1750 343 2083 46 2694 2349 771 1991 2153 254 1742 1547 1993 2492 1962 2081 2178 367 1735 1449 2043 2922 647 195 1685 1454 ...

result:

ok accepted

Test #35:

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

input:

3000 3000 3000
2456 3024
1202 5160
2592 4208
2830 4943
1279 5401
1554 5363
1051 3868
2353 4169
715 3495
2991 3962
903 3817
499 3427
1514 3738
805 3993
1681 4194
1999 3705
2935 5180
14 5270
420 3900
1857 5035
2587 3131
357 5790
2123 5059
2085 3573
2656 4794
1319 5107
971 5854
2212 4142
1452 3062
2907...

output:

1312
10 1444 2119 207 297 982 277 750 1394 1513 2807 863 2779 1706 1043 2270 1744 1709 439 478 178 2304 249 1342 2994 1461 2451 1082 491 1450 1253 425 1376 673 1581 2878 2916 1295 2460 498 1367 206 2281 1010 2507 1493 1825 53 2125 1909 1507 2693 638 992 2443 1228 2658 1334 1960 1406 2521 966 458 709...

result:

ok accepted

Test #36:

score: 0
Accepted
time: 29ms
memory: 4948kb

input:

3000 3000 3000
1225 3659
1285 5562
456 4991
234 5043
2878 5234
574 3408
283 5144
2343 4635
620 3335
868 5368
583 4477
168 5058
2245 3361
292 5035
2635 5228
745 5426
1136 4128
1383 3242
387 3091
792 5561
859 4534
97 3979
309 3385
2706 5354
2476 4940
2664 3304
1874 4625
197 5659
2253 3502
2034 5653
17...

output:

1328
1649 744 2122 1917 1248 1748 876 587 2529 1074 615 1813 414 123 1673 955 2704 1587 2434 1632 1357 1208 1389 891 1034 827 2041 1976 1356 31 2987 784 905 778 2199 947 163 554 380 1332 1581 1153 430 2169 1131 799 331 2817 2141 1155 1144 1393 1123 2105 2879 1353 2087 2598 1037 929 953 1739 1746 173...

result:

ok accepted

Test #37:

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

input:

3000 3000 3000
271 3216
919 3270
2084 3946
1699 3741
1761 5849
2381 3271
18 4257
858 3256
1250 4068
1291 3452
701 5072
2433 5871
173 4675
667 3842
25 4434
1289 4855
803 4656
19 4119
2904 5305
840 4229
1623 4731
448 3748
2983 5773
173 5976
736 4127
2544 4618
1853 4626
10 5952
1633 5075
234 4686
2646 ...

output:

1334
1096 2303 773 1610 2191 2338 2167 2796 536 2692 901 23 1432 2945 95 276 389 2669 858 2907 230 1968 634 1426 2409 583 668 1301 2835 1441 1859 1950 1721 2279 2665 2538 2346 2955 286 1960 268 1784 263 2061 1314 232 1624 2618 642 1752 824 2437 1297 2628 62 2759 1434 2494 1603 906 2840 2152 2607 724...

result:

ok accepted

Test #38:

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

input:

3000 3000 3000
1240 5393
448 3778
1526 5830
1069 4379
2113 5862
2197 3795
2060 5414
1389 5745
2001 4663
2058 3176
2620 4112
2317 5026
2291 5281
1835 5049
229 4896
1359 3573
78 3136
164 5183
515 4637
1256 4807
1810 3313
952 4561
1967 4231
2056 5900
2316 5234
2860 5322
1347 3002
371 5623
2341 4439
69 ...

output:

1264
2215 1678 1302 1415 1829 203 1577 2852 754 2193 2516 658 39 1400 1986 2999 2908 1399 694 2672 2977 400 1361 2744 2287 2667 854 1358 2240 2199 822 2783 1611 418 238 147 1816 725 1109 2816 1452 1602 1702 2115 1870 587 1994 1587 2294 1616 396 1615 686 482 835 625 1980 1802 1739 2488 2556 2692 265 ...

result:

ok accepted

Test #39:

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

input:

3000 3000 3000
2732 3825
1144 3457
2386 4614
324 3425
2126 4021
2074 3415
2793 3761
233 5169
2564 3807
1810 3200
1068 3668
1932 4718
2280 5699
2834 3937
2436 3949
1827 4285
252 3913
1492 3209
1103 4839
2432 3368
255 4553
473 4799
104 5606
1554 4561
425 4997
2573 4572
696 5263
71 3872
2980 5845
222 3...

output:

1284
1375 780 1719 1494 805 1061 2644 2092 1185 2008 197 2414 1702 1403 970 804 1571 2678 2189 881 2111 2532 771 362 2312 1120 2942 1692 1733 2213 2933 1004 1095 2365 1796 1320 1804 500 1730 1405 1317 2787 2155 2034 1700 2745 2701 185 2182 458 1630 1391 2317 2429 1886 1371 1772 59 1869 1506 1517 108...

result:

ok accepted

Test #40:

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

input:

80 80 3000
60 158
24 126
41 116
41 130
65 113
22 85
62 93
25 94
4 102
42 144
48 104
37 83
31 134
30 127
26 82
4 153
32 146
72 141
76 106
27 108
21 154
10 126
57 133
59 83
18 104
61 133
20 125
24 108
31 127
51 132
58 152
37 94
41 105
59 126
5 135
59 156
1 156
28 84
2 152
65 137
5 81
7 118
7 121
56 14...

output:

2595
565 2929 2 299 2998 3 2963 179 27 2989 466 13 39 2949 133 2974 355 80 94 105 2964 96 185 73 693 2982 53 2999 82 2994 166 66 64 2942 2985 107 2943 176 205 74 5 489 2946 394 46 67 93 567 2953 197 219 2996 41 516 35 68 70 45 266 3000 189 220 216 2916 135 22 332 231 447 48 119 33 2923 661 101 533 7...

result:

ok accepted

Test #41:

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

input:

80 80 3000
76 153
16 113
46 144
40 122
19 160
6 113
7 89
78 137
35 147
60 135
70 98
60 150
50 96
59 151
73 116
37 133
31 95
34 154
50 107
40 141
79 159
38 82
70 86
2 140
6 147
71 124
4 136
71 120
72 151
33 155
21 83
62 130
19 118
55 160
40 149
79 132
40 130
80 87
33 157
58 95
4 102
61 115
65 124
63 ...

output:

2690
75 34 2988 87 2983 3000 16 314 59 2957 2937 2948 864 101 2987 418 2996 208 187 258 58 324 30 33 251 90 775 49 176 27 136 480 2950 2930 433 340 39 343 2986 199 97 540 41 25 72 413 3 213 204 2978 2997 2942 143 2973 2953 253 68 11 227 2912 69 60 7 2959 277 146 50 2974 2982 2903 31 85 285 767 796 2...

result:

ok accepted

Test #42:

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

input:

80 80 3000
18 90
65 104
65 136
43 145
37 119
79 102
62 136
15 149
28 102
47 109
40 83
49 145
9 86
22 156
57 145
56 135
19 121
38 133
67 150
14 153
4 116
23 149
31 155
72 82
5 90
35 93
1 114
1 113
9 98
77 93
66 155
13 114
10 134
30 137
63 131
74 119
20 136
32 96
67 143
24 125
36 137
29 92
30 94
19 13...

output:

2404
2975 80 50 2981 2933 151 15 208 142 390 138 143 17 284 2997 2968 2915 2947 2992 56 474 27 2983 2985 2951 175 436 2998 122 2942 3 160 2893 2972 169 251 2974 416 63 30 2960 114 327 25 52 2978 28 2865 2908 2759 413 13 2950 282 581 22 751 94 81 264 2957 2869 61 42 2832 124 2881 2943 2879 26 12 2796...

result:

ok accepted

Test #43:

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

input:

100 100 3000
61 192
7 198
67 187
100 171
74 109
84 124
100 117
42 186
45 122
2 186
57 181
49 117
48 179
11 142
21 163
52 189
85 170
39 195
73 198
28 192
12 168
97 170
5 127
41 149
89 124
74 144
91 105
52 173
19 139
12 160
12 149
34 198
29 145
30 157
89 180
33 165
23 105
21 181
82 184
49 122
10 189
8...

output:

2812
109 632 51 75 112 2989 30 602 292 410 2984 108 348 165 14 1080 24 303 123 25 15 11 2910 2991 196 2975 31 79 2963 6 287 38 174 83 89 104 56 1 20 2969 59 185 641 98 289 58 17 72 252 341 412 3 40 502 259 471 82 156 2985 422 97 312 13 50 136 283 437 96 452 2961 669 2995 190 116 681 52 73 220 561 21...

result:

ok accepted

Test #44:

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

input:

100 100 3000
78 108
74 150
3 158
55 121
1 106
3 138
97 140
53 176
51 105
55 140
73 169
93 145
10 174
61 127
59 194
57 143
12 179
25 129
27 137
24 178
21 188
66 151
74 184
64 154
83 117
22 125
52 164
1 175
51 142
54 177
89 127
62 173
63 145
81 102
21 147
96 111
26 166
80 101
69 183
15 152
53 130
1 13...

output:

2553
86 2930 219 2967 43 163 134 228 11 83 274 2969 326 178 263 771 2991 2833 52 174 127 2979 13 225 4 17 2960 3 542 538 498 2839 2985 16 170 159 406 304 2846 240 365 294 71 47 2897 20 24 193 208 111 2906 99 312 652 2972 199 48 2996 298 2905 117 167 1389 2869 408 205 45 139 68 2989 321 244 211 88 12...

result:

ok accepted

Test #45:

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

input:

100 100 3000
48 150
49 127
42 138
24 150
67 141
87 126
45 118
20 145
98 118
52 176
8 150
19 131
40 142
13 108
17 140
9 174
24 170
5 193
53 172
15 122
10 110
86 195
56 174
35 164
46 199
68 155
84 188
53 163
88 122
82 139
83 102
5 197
78 153
57 191
61 187
50 142
30 156
97 156
42 107
24 189
96 122
1 14...

output:

2451
72 32 191 71 2908 94 2958 2827 269 11 223 136 179 1 2953 753 549 80 2963 54 73 398 2983 2981 152 195 2979 158 2949 82 319 5 2871 22 242 2924 2867 62 212 196 2982 279 18 2980 365 2957 132 49 615 2900 2930 198 120 382 2966 2950 2987 2943 14 2941 2915 522 90 2991 172 840 329 326 43 61 104 50 186 4...

result:

ok accepted

Test #46:

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

input:

500 500 3000
90 523
474 549
108 835
20 597
167 707
274 585
345 665
456 601
114 757
195 727
126 843
300 941
346 814
298 699
36 510
169 801
129 664
135 840
192 734
412 958
247 531
66 892
261 920
230 789
108 584
170 965
351 764
191 643
150 894
173 979
97 884
1 707
108 772
282 817
263 782
365 537
444 52...

output:

2990
263 390 454 591 587 1004 463 335 711 409 96 1704 1304 131 449 832 813 360 635 812 30 55 397 809 1265 2383 1093 1443 282 1160 1204 255 1016 349 2341 972 513 673 645 242 1778 424 92 1717 2410 675 894 274 709 54 224 212 88 527 332 753 367 473 791 71 457 647 974 306 289 653 365 94 80 233 9 546 340 ...

result:

ok accepted

Test #47:

score: 0
Accepted
time: 6ms
memory: 4608kb

input:

500 500 3000
457 981
496 955
394 548
362 673
103 659
303 981
39 523
173 664
346 540
396 735
351 847
185 681
440 752
131 586
447 608
98 853
280 515
198 579
162 575
308 640
449 533
471 705
128 655
355 546
495 982
158 657
410 657
38 833
116 784
212 718
184 688
22 685
42 916
410 738
465 554
312 712
456 ...

output:

2796
726 181 2689 740 130 659 556 521 250 658 635 146 397 2978 791 688 651 90 893 331 1627 2389 1253 500 1373 1196 1076 133 123 608 2787 310 1571 17 1362 313 538 139 172 2958 268 257 388 121 240 486 504 1198 1602 2959 1566 2994 258 741 405 106 357 2960 2955 547 552 1059 1264 179 462 69 309 348 39 14...

result:

ok accepted

Test #48:

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

input:

500 500 3000
120 735
270 735
156 857
284 776
215 764
102 826
206 929
460 861
486 839
166 693
452 811
298 768
276 928
315 978
196 828
132 746
436 786
222 775
21 619
88 611
320 960
194 874
498 975
410 706
409 924
327 979
275 644
257 925
202 611
280 849
394 816
220 505
224 645
322 799
95 695
313 621
21...

output:

2267
478 95 431 536 797 2987 103 2655 1401 958 968 916 2832 483 28 2964 377 2898 1984 2778 214 2920 1038 4 270 254 577 140 2839 1340 208 777 36 2808 2246 1146 2948 1496 562 792 135 1777 1302 399 187 1733 2714 141 558 468 576 425 2932 2755 407 875 2974 891 346 2943 2404 120 2911 644 2925 2812 163 256...

result:

ok accepted

Test #49:

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

input:

80 80 2999
78 101
75 105
33 137
9 104
76 122
42 116
6 135
51 155
62 95
9 107
34 125
68 160
34 111
56 132
65 102
71 133
67 101
37 130
60 133
8 113
60 113
61 121
77 101
42 157
1 94
74 115
53 100
65 113
29 147
42 122
43 85
28 139
54 125
42 148
21 154
62 115
69 91
54 148
64 144
8 125
38 142
51 93
39 104...

output:

2999
52 244 288 187 126 19 20 25 334 44 68 10 635 16 21 141 7 191 100 199 205 114 5 56 238 8 546 42 227 65 46 128 71 23 60 83 683 475 90 1 296 185 175 112 48 194 80 169 339 35 143 117 263 152 26 213 280 110 61 200 115 74 369 198 64 278 98 202 382 127 287 37 217 29 27 91 642 94 243 437 18 374 156 54 ...

result:

ok accepted

Test #50:

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

input:

80 80 2997
79 159
53 129
68 88
34 99
6 90
62 143
13 135
76 121
80 127
30 151
12 141
6 88
42 107
23 122
39 152
80 128
5 91
36 104
9 89
67 131
63 88
25 158
35 118
61 123
44 113
73 116
22 150
10 87
71 81
29 119
25 104
3 110
63 152
5 139
61 97
57 112
17 95
70 99
32 89
23 124
3 153
17 155
51 159
27 101
7...

output:

2993
67 214 147 12 59 73 17 120 40 46 127 21 187 20 48 34 264 739 38 87 620 84 284 68 100 150 138 93 239 91 105 126 4 368 28 23 110 337 298 271 315 362 229 566 361 10 283 240 11 72 279 826 329 52 217 41 140 294 200 809 104 62 160 256 30 137 267 420 7 247 58 293 180 897 145 323 69 224 479 292 22 588 ...

result:

ok accepted

Test #51:

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

input:

80 80 2997
57 81
6 112
14 102
29 159
15 103
53 109
6 87
11 145
45 148
43 85
57 82
68 116
29 129
41 86
57 126
42 100
68 136
74 154
38 141
26 144
37 107
5 81
24 95
61 131
48 149
27 88
75 99
4 134
15 104
29 146
13 102
16 128
70 101
52 100
26 154
72 127
17 113
45 102
32 158
28 83
42 159
22 121
58 158
2 ...

output:

2920
284 78 196 253 372 216 60 54 12 426 55 36 14 358 167 70 40 2989 80 125 188 175 137 131 42 238 101 177 2983 118 26 115 170 212 289 53 68 19 414 32 15 201 427 209 2994 222 45 230 193 347 425 17 335 111 189 574 145 67 301 429 2988 130 146 134 94 31 2993 51 548 351 61 147 227 213 1 297 464 33 441 1...

result:

ok accepted

Test #52:

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

input:

80 80 2999
34 150
76 97
22 138
13 130
65 152
39 145
69 103
20 108
10 100
66 95
60 93
17 126
6 110
2 113
79 158
77 155
65 119
50 108
1 123
22 130
11 83
51 125
58 124
72 118
3 105
59 90
24 122
63 99
36 97
73 104
9 121
13 124
35 99
60 134
24 104
55 96
29 100
10 102
20 129
70 133
63 89
16 150
17 111
37 ...

output:

2044
125 5 171 31 2962 44 2927 2829 40 108 303 2819 2956 180 2987 2975 158 12 2810 14 164 170 2792 2549 141 140 2932 2843 2998 2953 431 2911 2506 315 402 2966 657 2939 573 2990 301 77 76 2967 336 2981 233 2846 2588 2976 30 2937 70 598 58 169 2955 2917 1605 269 54 2961 376 27 45 135 159 2968 2929 241...

result:

ok accepted

Test #53:

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

input:

80 80 3000
26 107
48 88
12 145
29 150
77 156
12 137
36 143
11 120
71 129
51 134
48 96
12 116
5 135
31 151
12 85
80 147
54 119
73 87
38 159
10 83
2 154
4 139
51 114
66 118
73 97
64 146
27 104
36 100
53 85
80 157
8 150
48 123
42 160
61 81
42 108
46 122
74 94
52 116
42 96
2 93
63 103
21 87
28 88
57 155...

output:

540
2803 37 41 2804 225 178 2955 2920 2119 1688 1227 165 2558 271 2807 2278 59 2856 2820 49 1428 2406 2951 2455 26 22 2962 2787 75 2872 2585 2724 2311 807 2255 2731 68 2925 2416 79 2777 1584 2107 1772 1678 1444 2471 2447 29 2876 1931 2206 1709 2936 1179 82 2976 2772 2904 2899 2477 2175 2707 154 2785...

result:

ok accepted

Test #54:

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

input:

100 100 2997
61 183
100 170
23 125
72 200
25 159
87 169
64 120
47 154
54 176
82 185
83 180
53 101
38 166
46 191
10 111
99 105
20 192
97 152
84 133
49 174
67 147
12 137
57 130
16 111
74 102
97 198
65 112
77 122
26 189
46 112
58 112
69 134
94 154
77 117
32 132
72 197
75 105
52 121
57 117
86 172
43 120...

output:

2997
452 175 297 211 66 644 58 381 256 32 231 89 377 152 235 103 187 292 50 237 265 246 179 194 39 143 275 667 23 425 241 244 281 38 13 69 98 117 323 341 360 54 29 371 125 53 308 165 19 351 579 86 35 387 443 100 40 10 121 418 161 204 342 1193 30 343 378 75 91 99 512 28 14 20 277 1264 206 160 470 111...

result:

ok accepted

Test #55:

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

input:

100 100 2997
62 187
98 108
18 133
22 178
48 168
39 186
35 143
100 120
29 180
10 124
87 122
7 133
82 169
43 183
61 136
62 159
32 151
59 180
33 195
56 133
73 159
8 118
75 110
99 136
90 107
14 155
83 114
12 160
54 110
68 179
16 192
39 107
70 197
77 178
18 160
69 151
93 122
90 186
13 131
33 197
90 118
3...

output:

2991
133 30 80 205 199 87 50 43 422 23 440 347 208 533 29 73 96 148 18 286 186 555 684 267 48 89 6 62 325 9 55 101 175 222 245 27 214 128 81 668 107 118 142 304 5 65 182 851 305 659 71 72 70 657 203 542 221 129 137 116 185 552 84 59 24 58 704 799 276 181 224 558 11 47 158 223 37 77 605 494 57 288 12...

result:

ok accepted

Test #56:

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

input:

100 100 3000
66 176
42 155
34 127
33 197
65 166
67 151
46 192
39 180
90 195
7 181
61 188
85 144
96 139
89 135
26 143
56 138
3 108
79 123
42 194
95 179
30 156
97 122
93 167
57 115
32 128
87 166
9 111
68 196
12 139
10 168
84 179
60 105
29 167
41 128
79 117
9 170
13 174
15 164
70 102
85 110
22 133
68 1...

output:

2928
94 613 90 354 95 257 365 6 15 595 50 27 580 200 348 61 473 2986 77 261 43 243 68 80 159 542 217 202 78 406 71 733 335 128 13 106 266 46 161 162 537 152 177 156 24 211 100 383 40 229 12 142 109 58 503 29 164 108 62 935 65 16 259 205 35 293 148 575 49 133 88 96 97 72 129 602 201 208 2984 252 33 5...

result:

ok accepted

Test #57:

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

input:

100 100 2998
23 172
38 135
93 167
88 192
49 162
26 130
5 154
30 165
93 108
31 194
93 166
94 181
20 117
20 132
62 117
47 116
99 175
66 166
45 110
87 109
42 117
34 170
32 120
47 176
78 104
77 188
77 198
68 192
65 153
95 126
39 147
2 158
94 178
77 187
87 102
8 172
58 144
16 174
33 134
95 166
5 147
33 1...

output:

2056
2900 2938 27 211 2951 109 464 102 233 34 40 378 2997 55 2870 173 137 91 2934 350 7 2925 2935 2929 765 247 386 136 14 2786 13 154 2979 106 356 2796 2815 44 223 81 47 387 2753 140 2971 2927 528 2865 2953 234 2910 296 110 715 289 101 522 221 262 2911 2798 204 197 269 130 983 2789 97 345 2990 2836 ...

result:

ok accepted

Test #58:

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

input:

100 100 2998
45 150
68 167
44 198
72 191
22 144
81 180
36 183
8 163
22 113
8 103
33 137
30 102
18 119
71 181
66 107
5 189
46 137
65 112
38 181
51 128
26 200
84 160
64 159
39 175
7 193
10 160
92 130
67 147
76 158
83 102
50 122
9 179
67 142
28 133
3 158
96 124
73 193
48 127
47 141
73 177
86 102
51 166...

output:

556
2472 76 2944 77 306 2347 30 2964 55 2323 1158 272 1375 113 2086 2709 2881 1827 2503 2803 2015 2716 2752 220 12 2349 326 2355 1802 2097 2276 2941 2220 2697 144 233 2879 2030 2960 1634 120 2957 2390 1836 2152 2891 2117 253 141 14 190 315 1655 135 2952 2057 739 2155 715 2021 2852 2931 2684 1475 63 ...

result:

ok accepted

Test #59:

score: 0
Accepted
time: 6ms
memory: 4608kb

input:

500 500 2997
356 564
272 947
375 776
304 842
115 598
357 781
285 796
285 785
123 532
212 920
281 778
304 830
414 659
452 986
240 801
140 683
338 510
37 589
83 548
299 568
328 630
158 515
67 777
42 719
26 851
423 999
123 537
398 770
13 614
224 835
93 553
146 936
430 946
19 516
356 855
395 559
8 591
6...

output:

2997
1340 664 61 1714 481 1308 362 1781 914 451 41 745 233 75 391 162 376 56 1324 2174 331 653 169 493 194 557 1818 956 464 436 1137 238 788 1707 1447 72 214 104 1110 167 751 302 1329 3 1434 1375 608 521 1081 1547 314 532 511 758 595 644 29 498 252 179 769 855 396 1074 209 764 448 349 38 192 1149 22...

result:

ok accepted

Test #60:

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

input:

500 500 3000
455 904
178 787
97 956
452 524
346 997
441 899
458 597
344 662
236 813
453 549
20 843
239 938
249 999
181 506
172 656
389 515
13 773
288 790
338 988
26 525
94 793
344 862
215 704
79 854
167 780
368 577
95 843
364 541
76 637
34 897
137 681
35 518
398 843
354 784
284 644
315 955
328 929
4...

output:

2994
379 170 128 2108 2260 1086 388 1140 1026 302 675 732 1383 2965 121 614 129 329 692 1743 72 542 377 571 1017 460 715 2563 1310 771 1543 495 102 2389 188 504 394 21 522 280 911 557 838 1348 1585 641 1877 219 370 594 112 24 87 1377 650 33 252 630 361 218 889 397 260 2998 246 1353 611 395 2886 665 ...

result:

ok accepted

Test #61:

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

input:

500 500 2997
357 711
34 989
9 762
404 790
260 683
277 902
289 890
73 605
285 690
500 910
158 768
246 587
153 953
153 585
345 724
433 880
186 631
493 633
228 955
400 540
374 717
422 802
219 999
66 920
83 843
175 674
225 789
356 977
166 537
236 685
15 632
52 716
141 718
10 683
289 559
278 829
477 883
...

output:

2921
35 381 1113 1667 1641 776 479 221 2018 426 551 152 139 423 2942 292 617 541 2212 461 732 747 340 285 919 1404 37 714 1660 254 476 1287 848 535 193 566 470 208 1601 795 230 908 454 927 2183 1055 888 464 1033 885 283 585 1313 774 911 206 542 1707 518 304 1731 779 712 1015 502 797 210 5 912 330 66...

result:

ok accepted

Test #62:

score: 0
Accepted
time: 7ms
memory: 4608kb

input:

500 500 3000
293 734
37 611
29 515
281 564
414 723
31 796
403 556
284 687
205 592
350 526
349 699
128 911
348 869
292 813
160 596
59 631
388 990
184 621
351 752
90 555
317 758
409 686
304 821
266 977
253 522
400 857
256 646
447 884
230 926
102 760
167 577
375 619
101 675
40 650
149 806
189 743
314 6...

output:

2145
2975 1438 2068 456 103 793 676 14 445 2874 88 733 46 2194 397 2726 358 2956 2958 825 16 2639 2875 211 2578 1756 839 448 239 1116 904 2971 390 1227 2752 679 582 547 387 255 507 324 91 486 2980 2749 2357 658 1101 2604 2673 1352 305 880 2614 243 2851 2930 2832 83 1774 2789 2906 1668 2760 2277 493 ...

result:

ok accepted

Test #63:

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

input:

500 500 2998
83 866
14 735
68 854
473 743
355 643
89 702
40 859
469 810
233 675
282 797
452 854
109 675
352 990
267 694
155 747
406 868
184 958
287 985
317 960
299 648
189 626
323 712
109 688
309 597
81 805
127 653
468 911
274 697
149 554
473 988
98 939
465 748
384 985
87 734
26 614
89 913
395 542
1...

output:

732
2830 636 2104 2160 2181 1476 519 685 2166 1491 1424 1002 2838 898 339 2098 2875 1329 17 1775 1932 1004 1908 1609 1658 2570 2366 2282 1051 1118 192 1026 642 274 1568 784 710 2560 637 1451 2553 2378 951 2336 983 447 2474 1377 1095 110 2022 2284 1929 2265 1128 2068 2193 2060 2025 2260 2459 879 928 ...

result:

ok accepted

Test #64:

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

input:

3000 3000 2997
2245 4962
1812 5910
519 3608
531 3915
1172 5711
691 3009
738 3318
640 3846
924 5685
1206 4723
1353 4260
2983 5379
1935 5901
904 5905
2652 3675
1567 4509
933 4464
989 5349
1809 3388
1872 5139
1186 5448
1091 3671
1053 4752
1950 5098
2276 5715
1426 3411
1073 3283
2094 3473
2007 5734
2893...

output:

2997
1510 2346 1070 36 2823 817 2444 1426 1218 629 404 1565 1134 1483 1294 1849 2876 1763 1940 2758 750 988 2437 2019 1978 2244 448 1947 2745 2628 1660 2505 2135 1055 365 1046 2984 2117 201 1455 1123 1211 2569 262 382 2735 2008 220 190 2578 2921 1532 896 1514 1463 258 897 1325 1641 277 1499 2602 126...

result:

ok accepted

Test #65:

score: 0
Accepted
time: 29ms
memory: 5108kb

input:

3000 3000 2997
23 4451
64 5869
802 4208
2203 5931
2378 4831
677 3277
2614 3325
8 5690
812 5236
1161 3168
1907 4199
1367 5818
1807 3153
1284 5808
2711 4734
1486 4535
959 5246
1164 4742
2175 5612
1053 4482
502 5487
221 4262
2759 4333
1730 4568
729 3451
230 5851
1311 4593
486 3929
2333 3323
1499 3608
1...

output:

2989
123 931 2835 1571 1127 1097 1272 1185 1498 406 584 2519 713 1727 1059 1583 46 787 374 386 297 666 2049 2925 56 1326 894 2238 471 572 475 565 2947 2029 2593 585 2155 500 2318 2372 2772 1410 2910 1031 1670 1948 2316 651 811 1304 1761 29 2848 379 169 652 2140 351 2304 1065 1340 1869 1383 755 970 5...

result:

ok accepted

Test #66:

score: 0
Accepted
time: 31ms
memory: 5120kb

input:

3000 3000 2998
1444 4270
2253 3478
1646 5339
795 5577
1737 4556
371 5089
955 4868
536 5094
807 5921
288 5626
592 5635
2597 4586
1424 5882
2870 4809
1664 5962
1943 3044
1154 5362
2488 3445
2888 3048
1536 4490
422 5438
827 3840
407 4863
750 4930
2525 3572
2519 5844
2026 4399
44 5765
2368 3162
588 3398...

output:

2918
1780 737 72 1634 1180 1792 1421 1768 258 2588 2413 82 2284 896 1487 2835 2788 535 709 654 559 1579 2419 2991 174 1959 1950 2447 1953 1670 2433 398 1389 1479 2175 683 1148 340 2096 2212 1277 1508 627 187 666 357 586 111 641 2457 2365 2104 2877 663 306 2094 1194 2505 1574 1621 1268 1344 1060 1802...

result:

ok accepted

Test #67:

score: 0
Accepted
time: 41ms
memory: 5120kb

input:

3000 3000 2998
2744 4199
2615 5957
1855 4369
2068 3891
1172 3210
2535 3216
2444 4130
2874 3034
1461 4171
9 4682
1887 5250
2492 5315
2861 3869
2738 5597
2174 3601
1286 3766
2819 4707
2088 5309
394 5194
2062 5371
2716 4029
1435 4005
1170 4938
203 3293
2782 5235
1557 3623
703 3584
2903 3730
299 5425
28...

output:

2228
2716 962 1324 1048 2019 106 120 2210 468 2638 2363 1192 178 1679 2548 2537 1681 2922 238 18 2545 209 718 1687 909 1413 1498 802 2243 2926 1837 2220 250 36 1516 1200 2028 1840 2109 2964 2279 473 1264 23 1877 505 785 1625 2688 182 1167 1947 1118 378 2007 2693 1547 2000 1763 699 1195 2425 2138 196...

result:

ok accepted

Test #68:

score: 0
Accepted
time: 41ms
memory: 4892kb

input:

3000 3000 2998
1209 3777
2394 5629
2122 3086
2605 3539
1967 4707
1291 4325
1546 3818
2164 3202
1472 4031
1936 3661
303 4395
1622 3344
2688 4938
1991 5788
1021 4228
2686 4341
2984 3270
788 4266
2455 5827
619 3991
971 4304
1686 4162
1031 4885
422 4694
238 4014
2676 4951
2830 5712
202 4172
150 4078
132...

output:

1948
653 1668 1300 2488 2178 190 252 2475 2496 987 1776 687 1341 2350 17 161 2107 1934 2497 2658 2949 580 553 394 2232 2989 97 529 2192 963 862 1136 903 2368 1885 838 1520 1534 1903 2973 527 2545 132 399 1227 1828 563 2200 2448 2220 2456 1858 1317 2620 199 2434 2793 1973 875 1792 486 2003 2013 2018 ...

result:

ok accepted

Test #69:

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

input:

1 1 1
1 2

output:

1
1 

result:

ok accepted

Test #70:

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

input:

2 2 4
2 4
2 3
1 4
1 3

output:

2
1 4 

result:

ok accepted

Test #71:

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

input:

55 55 3000
1 101
49 91
29 87
42 56
52 81
26 60
3 59
37 99
19 91
37 64
34 104
14 82
47 62
27 56
33 84
22 92
4 106
40 63
28 109
34 100
2 83
3 76
13 74
37 58
30 105
43 78
4 99
27 88
34 90
49 83
2 69
14 74
31 62
45 69
34 74
20 62
28 106
19 92
24 83
43 77
38 62
8 58
28 85
51 109
51 56
7 105
2 102
8 73
17...

output:

870
2954 106 2870 13 36 2167 2785 2983 69 8 2948 2846 1781 2810 419 2635 164 469 5 15 6 2903 2877 154 1553 2887 2161 85 2819 2758 285 2771 111 1952 66 2908 41 196 22 254 2795 409 2659 92 3000 2991 179 2712 74 2448 2871 2604 543 2607 1945 44 149 2124 2896 2108 2950 10 2759 2701 357 2957 199 2840 167 ...

result:

ok accepted

Test #72:

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

input:

55 55 3000
43 78
18 83
8 90
25 95
15 86
27 56
49 64
55 67
38 71
33 80
23 82
5 67
6 95
48 102
22 96
46 99
32 85
46 63
40 108
22 58
7 90
3 80
44 95
12 96
41 84
50 66
16 97
10 57
32 63
6 65
47 88
19 64
16 76
26 102
16 110
7 77
17 106
47 93
27 62
19 103
28 98
21 73
38 104
40 61
49 57
13 94
20 83
32 86
2...

output:

1146
98 126 2904 2981 2770 2850 330 2861 46 2974 13 65 2978 2873 2693 251 2739 2990 23 2787 2791 2950 2915 2613 2956 2951 191 2781 2493 2511 25 436 2801 99 2988 2979 163 51 5 2719 2624 378 2737 2796 143 2775 40 274 176 48 2575 2732 35 2331 2927 2722 207 15 2914 70 2996 2999 2928 2870 2561 104 2804 2...

result:

ok accepted

Test #73:

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

input:

55 55 3000
38 110
19 101
2 66
1 84
19 90
8 98
26 87
27 100
34 109
38 59
17 92
39 88
27 77
22 78
25 69
40 92
27 84
19 88
47 99
39 69
36 94
3 58
2 94
10 76
26 59
2 93
14 82
41 75
46 93
12 89
26 66
6 75
35 87
28 86
25 86
8 101
15 56
20 102
46 96
50 94
43 107
10 65
4 72
17 95
6 66
29 103
6 70
13 73
41 6...

output:

878
35 2887 69 2797 115 2859 74 2811 171 4 1548 2542 2749 2907 2715 2961 230 8 2059 2857 2955 2935 13 2890 361 17 2108 2866 99 2157 2987 2330 135 1 2900 2595 14 2494 268 2039 221 2799 2941 219 2620 2492 2252 207 151 261 2486 2972 193 73 58 68 5 1935 2856 61 2415 2869 2534 2090 7 67 2923 2518 474 264...

result:

ok accepted

Test #74:

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

input:

55 55 3000
23 82
40 70
12 78
38 71
31 105
47 77
42 62
50 62
30 85
50 83
44 83
23 81
54 91
8 109
5 61
23 92
22 82
25 109
27 100
55 90
17 68
4 91
25 79
12 77
16 88
40 56
23 78
10 71
52 60
31 56
34 98
18 72
22 64
5 71
42 78
39 68
29 67
35 77
14 95
12 109
5 89
23 94
6 80
38 56
28 91
38 109
2 99
19 105
3...

output:

1120
92 2299 132 2905 2886 83 2361 2903 143 79 125 32 354 2888 342 2831 121 2874 2991 2956 263 2898 277 2686 2838 2987 2988 2817 2939 2801 30 184 2921 65 2869 2985 34 2851 2959 2442 5 421 377 2699 2624 2943 2994 2986 2867 2854 2723 2896 64 8 25 236 501 2999 474 2997 2615 240 139 73 115 158 2843 2907...

result:

ok accepted

Test #75:

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

input:

55 55 3000
22 88
32 101
17 57
46 76
47 63
25 93
47 87
30 77
37 84
12 100
12 97
42 62
5 59
40 107
55 66
55 71
10 83
21 108
27 91
33 82
6 65
33 87
35 61
37 98
54 69
41 101
23 106
13 100
49 79
15 59
48 79
2 102
45 63
23 68
26 88
12 78
46 71
50 98
41 99
52 85
23 61
2 77
11 68
7 102
14 73
33 83
7 62
22 1...

output:

1138
2795 144 2246 43 2928 4 2991 2398 2761 2946 353 2717 2441 2850 2927 2890 300 149 39 2907 2650 89 2962 2681 44 95 2913 293 2765 2941 2461 2736 61 2622 2750 2968 2940 178 111 2702 28 2 2226 2799 2868 2692 285 204 94 2438 2181 2939 371 179 132 2888 2956 50 200 2942 2816 2684 2687 2926 20 2359 165 ...

result:

ok accepted

Test #76:

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

input:

54 54 2916
32 103
44 55
25 97
49 74
41 98
51 73
6 85
12 108
46 65
15 65
14 102
11 97
24 78
39 72
47 106
22 61
9 64
17 95
23 101
47 97
50 101
36 96
42 62
32 76
6 61
53 75
14 101
4 59
5 95
12 57
5 103
24 104
45 71
13 78
42 79
19 87
16 85
9 101
14 58
44 64
29 86
25 77
41 63
2 68
21 60
12 105
4 91
48 92...

output:

54
125 26 312 6 72 89 61 15 71 33 2 103 23 255 56 14 81 182 22 75 306 70 2850 73 2882 133 138 58 64 42 32 50 16 45 77 36 93 79 147 10 11 34 2843 12 285 17 214 123 7 267 2834 101 44 161 

result:

ok accepted

Test #77:

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

input:

30 100 3000
24 50
27 78
16 110
4 98
23 35
2 127
14 66
11 37
13 65
26 80
29 49
17 111
2 37
8 56
30 44
18 84
15 104
22 33
4 96
16 87
9 67
11 62
8 106
22 118
11 63
5 68
11 39
18 82
15 80
23 78
11 40
1 71
6 79
8 88
3 47
26 102
16 101
17 108
22 128
30 70
16 98
5 90
18 116
20 32
9 101
22 59
7 93
2 118
14 ...

output:

30
2905 275 375 555 10 134 1 77 46 90 3000 144 207 597 2995 159 172 9 230 776 451 765 93 60 470 74 4 2520 84 166 

result:

ok accepted

Test #78:

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

input:

1 3000 3000
1 1538
1 1870
1 2459
1 2131
1 590
1 70
1 2995
1 2523
1 1896
1 702
1 769
1 2011
1 467
1 534
1 1228
1 2582
1 952
1 1092
1 2265
1 2657
1 2188
1 122
1 2992
1 827
1 323
1 2495
1 2088
1 877
1 210
1 1852
1 1237
1 278
1 1363
1 2993
1 1209
1 2733
1 1992
1 839
1 389
1 2885
1 1393
1 1328
1 507
1 20...

output:

0


result:

ok accepted

Test #79:

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

input:

2 1500 3000
2 1407
2 135
1 703
1 728
1 334
1 1034
1 1307
1 1389
2 1280
1 1361
1 366
1 1218
2 735
2 1079
2 1244
1 532
1 1491
2 108
2 1445
1 438
1 840
2 489
1 436
1 1468
2 249
1 225
1 719
1 596
2 680
1 183
2 835
1 39
2 335
2 768
1 730
1 90
1 953
1 1287
2 1232
2 1231
2 1043
1 715
1 1483
1 414
2 91
1 13...

output:

2
1927 825 

result:

ok accepted

Test #80:

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

input:

10 300 3000
10 98
5 272
2 285
1 178
10 101
3 82
9 11
3 293
10 249
8 255
3 186
5 173
6 227
3 57
9 172
7 127
4 124
10 103
10 192
4 266
8 67
8 292
7 177
7 184
3 90
3 122
6 139
8 279
2 256
8 139
3 74
4 286
7 18
5 253
1 261
8 141
1 80
10 97
4 183
9 298
4 191
4 297
10 201
1 231
5 58
6 279
1 293
4 233
5 83...

output:

10
894 139 10 33 1634 570 17 6 3 2152 

result:

ok accepted