Submission #564809

# Submission time Handle Problem Language Result Execution time Memory
564809 2022-05-19T16:36:11 Z Kanon Fountain Parks (IOI21_parks) C++17
100 / 100
2542 ms 151484 KB
#include <bits/stdc++.h>
#include "parks.h"

using namespace std;

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
  return '"' + s + '"';
}

string to_string(const char* s) {
  return to_string((string) s);
}

string to_string(bool b) {
  return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}

template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}

template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__);

class matching {
  public:
  vector< vector<int> > g;
  vector<int> pa;
  vector<int> pb;
  vector<int> was;
  int n, m;
  int res;
  int iter;

  matching(int _n, int _m) : n(_n), m(_m) {
    assert(0 <= n && 0 <= m);
    pa = vector<int>(n, -1);
    pb = vector<int>(m, -1);
    was = vector<int>(n, 0);
    g.resize(n);
    res = 0;
    iter = 0;
  }

  void add(int from, int to) {
    assert(0 <= from && from < n && 0 <= to && to < m);
    g[from].push_back(to);
  }

  bool dfs(int v) {
    was[v] = iter;
    for (int u : g[v]) {
      if (pb[u] == -1) {
        pa[v] = u;
        pb[u] = v;
        return true;
      }
    }
    for (int u : g[v]) {
      if (was[pb[u]] != iter && dfs(pb[u])) {
        pa[v] = u;
        pb[u] = v;
        return true;
      }
    }
    return false;
  }

  int solve() {
    while (true) {
      iter++;
      int add = 0;
      for (int i = 0; i < n; i++) {
        if (pa[i] == -1 && dfs(i)) {
          add++;
        }
      }
      if (add == 0) {
        break;
      }
      res += add;
    }
    return res;
  }

  int run_one(int v) {
    if (pa[v] != -1) {
      return 0;
    }
    iter++;
    return (int) dfs(v);
  }
};

class dsu {
 public:
  vector<int> p;
  int n;

  dsu(){};

  dsu(int _n) : n(_n) {
    p.resize(n);
    iota(p.begin(), p.end(), 0);
  }

  inline int get(int x) {
    return (x == p[x] ? x : (p[x] = get(p[x])));
  }

  inline bool unite(int x, int y) {
    x = get(x);
    y = get(y);
    if (x != y) {
      p[x] = y;
      return true;
    }
    return false;
  }
};

int construct_roads (vector<int> xvec, vector<int> yvec) {
  int N = xvec.size();

  map<pair<int, int>, int> to_v;
  for (int i = 0; i < N; i++) {
    to_v[make_pair(xvec[i], yvec[i])] = i;
  }

  auto get_v = [&](int X, int Y) {
    if (to_v.count(make_pair(X, Y))) {
      return to_v[make_pair(X, Y)];
    }
    return -1;
  };

  int n = 0;
  vector<vector<int>> g;
  map<pair<int, int>, int> to_face;
  vector<pair<int, int>> bench;
  auto get_face = [&](int X, int Y) {
    if (to_face.count(make_pair(X, Y))) {
      return to_face[make_pair(X, Y)];
    }
    bench.push_back({X, Y});
    g.push_back({});
    return to_face[make_pair(X, Y)] = n++;
  };

  int m = 0;
  vector<int> node1, node2, face1, face2;
  dsu fountain(N);
  int is_connected = N;
  auto make_edge = [&] (int x, int y, int X, int Y) {
    int u = get_v(x, y), v = get_v(X, Y);
    if (v == -1) {
      return;
    }
    node1.push_back(u);
    node2.push_back(v);
    is_connected -= fountain.unite(u, v);

    int f1, f2;
    if (x == X) {
      f1 = get_face(x + 1, (y + Y) / 2);
      f2 = get_face(x - 1, (y + Y) / 2);
    } else {
      f1 = get_face((x + X) / 2, y + 1);
      f2 = get_face((x + X) / 2, y - 1);
    }

    g[f1].push_back(m);
    g[f2].push_back(m);
    face1.push_back(f1);
    face2.push_back(f2);
    m++;
  };

  for (int i = 0; i < N; i++) {
    int x = xvec[i], y = yvec[i];
    make_edge(x, y, x + 2, y);
    make_edge(x, y, x, y + 2);
  }

  if (is_connected > 1) {
    return 0;
  }

  vector<int> removal(m);
  vector<int> is_deg4(n);
  for (int i = 0; i < n; i++) {
    is_deg4[i] = g[i].size() == 4;
    //assert(g[i].size() <= 4 && g[i].size() != 3 && g[i].size() != 0);
  }
  vector<vector<int>> nodes;

  {
    vector<set<int>> graph(n + 1);
    for (int e = 0; e < m; e++) {
      int u = face1[e], v = face2[e];
      graph[u].insert(v);
      graph[v].insert(u);
    }
    for (int i = 0; i < n; i++) {
      if (graph[i].size() & 1) {
        graph[i].insert(n);
        graph[n].insert(i);
      }
    }
    vector<int> way;
    function<void(int)> dfs = [&](int v) {
      vector<int> que = {v};
      while (que.size()) {
        int u = que.back();
        if (graph[u].empty()) {
          way.push_back(u);
          que.pop_back();
        } else {
          int b = *graph[u].begin();
          graph[u].erase(b);
          graph[b].erase(u);
          que.push_back(b);
        }
      }
    };

    vector<int> que;
    vector<int> in_queue(n + 1);
    for (int i = n; i >= 0; i--) {
      if (graph[i].empty()) {
        continue;
      }
      way.clear();
      dfs(i);
     // debug(way)
      //debug(graph)
      for (int v : way) {
        if (in_queue[v]) {
          nodes.push_back({});
          while (que.back() != v) {
            nodes.back().push_back(que.back());
            in_queue[que.back()] = 0;
            que.pop_back();
          }
          nodes.back().push_back(v);
        } else {
          que.push_back(v);
          in_queue[v] = 1;
        }
      }
     // debug(i, que)
      //assert(que.size() == 1 && que[0] == i);
      que.pop_back();
      in_queue[i] = 0;
    }
  }
  //debug(nodes)

  int sz = nodes.size();
  vector<vector<int>> edges;
  {
    map<pair<int, int>, int> cur;
    for (int e = 0; e < m; e++) {
      int u = face1[e], v = face2[e];
      cur[make_pair(u, v)] = e;
      cur[make_pair(v, u)] = e;
    }
    for (auto &p : nodes) {
      edges.push_back({});
      for (int i = 0; i < (int) p.size(); i++) {
        int u = p[i], v = p[(i + 1) % p.size()];
        if (cur.count(make_pair(u, v))) {
          edges.back().push_back(cur[make_pair(u, v)]);
        }
      }
      if (p.back() == n) {
        p.pop_back();
      }
    }
  }
  vector<int> que;
  vector<vector<int>> relaxed(n);
  vector<int> was(sz);

  for (int i = 0; i < sz; i++) {
    for (int j : nodes[i]) {
      relaxed[j].push_back(i);
    }
    bool ok = false;
    for (int j : nodes[i]) {
      if (!is_deg4[j]) {
        ok = true;
      }
    }
    if (ok) {
      que.push_back(i);
      was[i] = 1;
    }
  }

  for (int b = 0; b < (int) que.size(); b++) {
    int i = que[b];
    for (int j = 0; j < (int) edges[i].size(); j++) {
      int v = nodes[i][j], e = edges[i][j];
      if (is_deg4[v]) {
        removal[e] = 1;
        is_deg4[v] = 0;
        for (int t : relaxed[v]) {
          if (!was[t]) {
            que.push_back(t);
            was[t] = 1;
          }
        }
      }
    }
  }
  //assert((int) que.size() == sz);
  vector<int> paired(m, -1);
  matching mt(m, n);
  int cnt = m;
  for (int e = 0; e < m; e++) {
    if (removal[e]) {
      cnt--;
      continue;
    }
    mt.add(e, face1[e]);
    mt.add(e, face2[e]);
  }
  if (mt.solve() != cnt) {
    return 0;
  }
  for (int e = 0; e < m; e++) {
    if (removal[e]) {
      continue;
    }
    paired[e] = mt.pa[e];
  }

  /*auto build = [&] (vector<int> ru, vector<int> rv, vector<int> rx, vector<int> ry) {
    dsu d(N);
    int still_connected = N;
    set<pair<int, int>> checker;
    int S = ru.size();
    for (int i = 0; i < S; i++) {
      int x = xvec[ru[i]], y = yvec[ru[i]], X = xvec[rv[i]], Y = yvec[rv[i]];
      assert(checker.find({rx[i], ry[i]}) == checker.end());
      checker.insert({rx[i], ry[i]});
      if (x == X) {
        assert(abs(rx[i] - X) == 1 && ry[i] == (Y + y) / 2);
      } else {
        assert(abs(ry[i] - Y) == 1 && rx[i] == (X + x) / 2);
      }
      still_connected -= d.unite(ru[i], rv[i]);
      //cout << "" << x << " " << y << " " << X << " " << Y;

      //cout << "\n" << rx[i] << " " << ry[i] << "\n";
    }
    assert(still_connected == 1);
  };*/

  vector<int> ru, rv, rx, ry;
  for (int e = 0; e < m; e++) {
    if (removal[e]) {
      continue;
    }
    //assert(paired[e] != -1);
    ru.push_back(node1[e]);
    rv.push_back(node2[e]);
    int id = paired[e];
    //assert(~id);
    rx.push_back(bench[id].first);
    ry.push_back(bench[id].second);
  }
  build(ru, rv, rx, ry);
  return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2071 ms 129456 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 6 ms 980 KB Output is correct
26 Correct 7 ms 1208 KB Output is correct
27 Correct 9 ms 1512 KB Output is correct
28 Correct 636 ms 51712 KB Output is correct
29 Correct 1075 ms 78452 KB Output is correct
30 Correct 1568 ms 103540 KB Output is correct
31 Correct 2053 ms 129780 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 0 ms 304 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 300 KB Output is correct
43 Correct 4 ms 980 KB Output is correct
44 Correct 8 ms 1236 KB Output is correct
45 Correct 588 ms 54788 KB Output is correct
46 Correct 968 ms 79844 KB Output is correct
47 Correct 973 ms 79944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2071 ms 129456 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 6 ms 980 KB Output is correct
26 Correct 7 ms 1208 KB Output is correct
27 Correct 9 ms 1512 KB Output is correct
28 Correct 636 ms 51712 KB Output is correct
29 Correct 1075 ms 78452 KB Output is correct
30 Correct 1568 ms 103540 KB Output is correct
31 Correct 2053 ms 129780 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 0 ms 304 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 300 KB Output is correct
43 Correct 4 ms 980 KB Output is correct
44 Correct 8 ms 1236 KB Output is correct
45 Correct 588 ms 54788 KB Output is correct
46 Correct 968 ms 79844 KB Output is correct
47 Correct 973 ms 79944 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 256 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 1 ms 308 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 2270 ms 121216 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 9 ms 1364 KB Output is correct
58 Correct 31 ms 3764 KB Output is correct
59 Correct 28 ms 3280 KB Output is correct
60 Correct 908 ms 60280 KB Output is correct
61 Correct 1390 ms 82044 KB Output is correct
62 Correct 1754 ms 100852 KB Output is correct
63 Correct 2222 ms 121356 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1349 ms 151020 KB Output is correct
68 Correct 1342 ms 151176 KB Output is correct
69 Correct 1347 ms 150324 KB Output is correct
70 Correct 8 ms 1364 KB Output is correct
71 Correct 17 ms 2448 KB Output is correct
72 Correct 587 ms 54616 KB Output is correct
73 Correct 1057 ms 82744 KB Output is correct
74 Correct 1438 ms 109164 KB Output is correct
75 Correct 1652 ms 122940 KB Output is correct
76 Correct 1366 ms 150972 KB Output is correct
77 Correct 10 ms 1748 KB Output is correct
78 Correct 19 ms 2824 KB Output is correct
79 Correct 723 ms 58120 KB Output is correct
80 Correct 1071 ms 86660 KB Output is correct
81 Correct 1569 ms 116076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1161 ms 86268 KB Output is correct
21 Correct 1377 ms 87068 KB Output is correct
22 Correct 1200 ms 87076 KB Output is correct
23 Correct 1104 ms 128936 KB Output is correct
24 Correct 382 ms 18500 KB Output is correct
25 Correct 928 ms 71864 KB Output is correct
26 Correct 879 ms 71668 KB Output is correct
27 Correct 1368 ms 150784 KB Output is correct
28 Correct 1321 ms 150740 KB Output is correct
29 Correct 1398 ms 150716 KB Output is correct
30 Correct 1363 ms 150712 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 57 ms 7848 KB Output is correct
33 Correct 138 ms 9780 KB Output is correct
34 Correct 1312 ms 86340 KB Output is correct
35 Correct 22 ms 2832 KB Output is correct
36 Correct 148 ms 13288 KB Output is correct
37 Correct 401 ms 26436 KB Output is correct
38 Correct 478 ms 42136 KB Output is correct
39 Correct 700 ms 56256 KB Output is correct
40 Correct 965 ms 72012 KB Output is correct
41 Correct 1254 ms 88596 KB Output is correct
42 Correct 1504 ms 102612 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 212 KB Output is correct
46 Correct 1 ms 296 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 300 KB Output is correct
54 Correct 4 ms 852 KB Output is correct
55 Correct 6 ms 1236 KB Output is correct
56 Correct 626 ms 54732 KB Output is correct
57 Correct 974 ms 80000 KB Output is correct
58 Correct 965 ms 79872 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1365 ms 151052 KB Output is correct
63 Correct 1363 ms 151064 KB Output is correct
64 Correct 1342 ms 150216 KB Output is correct
65 Correct 8 ms 1364 KB Output is correct
66 Correct 19 ms 2448 KB Output is correct
67 Correct 620 ms 54612 KB Output is correct
68 Correct 1025 ms 82620 KB Output is correct
69 Correct 1477 ms 109180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
17 Correct 1406 ms 149360 KB Output is correct
18 Correct 1355 ms 151484 KB Output is correct
19 Correct 1319 ms 90452 KB Output is correct
20 Correct 1848 ms 117168 KB Output is correct
21 Correct 1374 ms 121224 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 145 ms 17668 KB Output is correct
24 Correct 52 ms 5760 KB Output is correct
25 Correct 273 ms 19892 KB Output is correct
26 Correct 532 ms 34520 KB Output is correct
27 Correct 735 ms 57180 KB Output is correct
28 Correct 953 ms 71460 KB Output is correct
29 Correct 1228 ms 85848 KB Output is correct
30 Correct 1457 ms 99628 KB Output is correct
31 Correct 1754 ms 114080 KB Output is correct
32 Correct 1748 ms 122832 KB Output is correct
33 Correct 1363 ms 151172 KB Output is correct
34 Correct 10 ms 1748 KB Output is correct
35 Correct 19 ms 2824 KB Output is correct
36 Correct 700 ms 58024 KB Output is correct
37 Correct 1153 ms 86568 KB Output is correct
38 Correct 1605 ms 116084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 591 ms 74736 KB Output is correct
10 Correct 38 ms 7768 KB Output is correct
11 Correct 253 ms 40324 KB Output is correct
12 Correct 59 ms 11396 KB Output is correct
13 Correct 103 ms 15784 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 4 ms 904 KB Output is correct
16 Correct 610 ms 74864 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2071 ms 129456 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 6 ms 980 KB Output is correct
26 Correct 7 ms 1208 KB Output is correct
27 Correct 9 ms 1512 KB Output is correct
28 Correct 636 ms 51712 KB Output is correct
29 Correct 1075 ms 78452 KB Output is correct
30 Correct 1568 ms 103540 KB Output is correct
31 Correct 2053 ms 129780 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 304 KB Output is correct
35 Correct 0 ms 304 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 300 KB Output is correct
43 Correct 4 ms 980 KB Output is correct
44 Correct 8 ms 1236 KB Output is correct
45 Correct 588 ms 54788 KB Output is correct
46 Correct 968 ms 79844 KB Output is correct
47 Correct 973 ms 79944 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 256 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 1 ms 308 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 2270 ms 121216 KB Output is correct
56 Correct 1 ms 212 KB Output is correct
57 Correct 9 ms 1364 KB Output is correct
58 Correct 31 ms 3764 KB Output is correct
59 Correct 28 ms 3280 KB Output is correct
60 Correct 908 ms 60280 KB Output is correct
61 Correct 1390 ms 82044 KB Output is correct
62 Correct 1754 ms 100852 KB Output is correct
63 Correct 2222 ms 121356 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1349 ms 151020 KB Output is correct
68 Correct 1342 ms 151176 KB Output is correct
69 Correct 1347 ms 150324 KB Output is correct
70 Correct 8 ms 1364 KB Output is correct
71 Correct 17 ms 2448 KB Output is correct
72 Correct 587 ms 54616 KB Output is correct
73 Correct 1057 ms 82744 KB Output is correct
74 Correct 1438 ms 109164 KB Output is correct
75 Correct 1652 ms 122940 KB Output is correct
76 Correct 1366 ms 150972 KB Output is correct
77 Correct 10 ms 1748 KB Output is correct
78 Correct 19 ms 2824 KB Output is correct
79 Correct 723 ms 58120 KB Output is correct
80 Correct 1071 ms 86660 KB Output is correct
81 Correct 1569 ms 116076 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 1161 ms 86268 KB Output is correct
86 Correct 1377 ms 87068 KB Output is correct
87 Correct 1200 ms 87076 KB Output is correct
88 Correct 1104 ms 128936 KB Output is correct
89 Correct 382 ms 18500 KB Output is correct
90 Correct 928 ms 71864 KB Output is correct
91 Correct 879 ms 71668 KB Output is correct
92 Correct 1368 ms 150784 KB Output is correct
93 Correct 1321 ms 150740 KB Output is correct
94 Correct 1398 ms 150716 KB Output is correct
95 Correct 1363 ms 150712 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 57 ms 7848 KB Output is correct
98 Correct 138 ms 9780 KB Output is correct
99 Correct 1312 ms 86340 KB Output is correct
100 Correct 22 ms 2832 KB Output is correct
101 Correct 148 ms 13288 KB Output is correct
102 Correct 401 ms 26436 KB Output is correct
103 Correct 478 ms 42136 KB Output is correct
104 Correct 700 ms 56256 KB Output is correct
105 Correct 965 ms 72012 KB Output is correct
106 Correct 1254 ms 88596 KB Output is correct
107 Correct 1504 ms 102612 KB Output is correct
108 Correct 0 ms 212 KB Output is correct
109 Correct 1 ms 212 KB Output is correct
110 Correct 1 ms 212 KB Output is correct
111 Correct 1 ms 296 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 1 ms 212 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 1 ms 212 KB Output is correct
117 Correct 1 ms 212 KB Output is correct
118 Correct 1 ms 300 KB Output is correct
119 Correct 4 ms 852 KB Output is correct
120 Correct 6 ms 1236 KB Output is correct
121 Correct 626 ms 54732 KB Output is correct
122 Correct 974 ms 80000 KB Output is correct
123 Correct 965 ms 79872 KB Output is correct
124 Correct 1 ms 212 KB Output is correct
125 Correct 1 ms 212 KB Output is correct
126 Correct 1 ms 212 KB Output is correct
127 Correct 1365 ms 151052 KB Output is correct
128 Correct 1363 ms 151064 KB Output is correct
129 Correct 1342 ms 150216 KB Output is correct
130 Correct 8 ms 1364 KB Output is correct
131 Correct 19 ms 2448 KB Output is correct
132 Correct 620 ms 54612 KB Output is correct
133 Correct 1025 ms 82620 KB Output is correct
134 Correct 1477 ms 109180 KB Output is correct
135 Correct 1406 ms 149360 KB Output is correct
136 Correct 1355 ms 151484 KB Output is correct
137 Correct 1319 ms 90452 KB Output is correct
138 Correct 1848 ms 117168 KB Output is correct
139 Correct 1374 ms 121224 KB Output is correct
140 Correct 1 ms 212 KB Output is correct
141 Correct 145 ms 17668 KB Output is correct
142 Correct 52 ms 5760 KB Output is correct
143 Correct 273 ms 19892 KB Output is correct
144 Correct 532 ms 34520 KB Output is correct
145 Correct 735 ms 57180 KB Output is correct
146 Correct 953 ms 71460 KB Output is correct
147 Correct 1228 ms 85848 KB Output is correct
148 Correct 1457 ms 99628 KB Output is correct
149 Correct 1754 ms 114080 KB Output is correct
150 Correct 1748 ms 122832 KB Output is correct
151 Correct 1363 ms 151172 KB Output is correct
152 Correct 10 ms 1748 KB Output is correct
153 Correct 19 ms 2824 KB Output is correct
154 Correct 700 ms 58024 KB Output is correct
155 Correct 1153 ms 86568 KB Output is correct
156 Correct 1605 ms 116084 KB Output is correct
157 Correct 1 ms 212 KB Output is correct
158 Correct 1 ms 212 KB Output is correct
159 Correct 1 ms 300 KB Output is correct
160 Correct 1 ms 296 KB Output is correct
161 Correct 2516 ms 110908 KB Output is correct
162 Correct 1334 ms 86292 KB Output is correct
163 Correct 1649 ms 99612 KB Output is correct
164 Correct 1618 ms 99668 KB Output is correct
165 Correct 2120 ms 104588 KB Output is correct
166 Correct 2347 ms 109480 KB Output is correct
167 Correct 326 ms 25040 KB Output is correct
168 Correct 102 ms 7928 KB Output is correct
169 Correct 365 ms 21968 KB Output is correct
170 Correct 848 ms 41052 KB Output is correct
171 Correct 1203 ms 52592 KB Output is correct
172 Correct 1014 ms 55684 KB Output is correct
173 Correct 1300 ms 66440 KB Output is correct
174 Correct 1601 ms 79804 KB Output is correct
175 Correct 1850 ms 90120 KB Output is correct
176 Correct 2230 ms 100560 KB Output is correct
177 Correct 2542 ms 111324 KB Output is correct