QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#262066#7854. 这不是一道数据结构题hos_lyric#75 349ms76192kbC++1412.6kb2023-11-23 15:06:012024-07-04 03:08:38

Judging History

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

  • [2024-07-04 03:08:38]
  • 评测
  • 测评结果:75
  • 用时:349ms
  • 内存:76192kb
  • [2023-11-23 15:06:01]
  • 提交

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")

////////////////////////////////////////////////////////////////////////////////
template <unsigned M_> struct ModInt {
  static constexpr unsigned M = M_;
  unsigned x;
  constexpr ModInt() : x(0U) {}
  constexpr ModInt(unsigned x_) : x(x_ % M) {}
  constexpr ModInt(unsigned long long x_) : x(x_ % M) {}
  constexpr ModInt(int x_) : x(((x_ %= static_cast<int>(M)) < 0) ? (x_ + static_cast<int>(M)) : x_) {}
  constexpr ModInt(long long x_) : x(((x_ %= static_cast<long long>(M)) < 0) ? (x_ + static_cast<long long>(M)) : x_) {}
  ModInt &operator+=(const ModInt &a) { x = ((x += a.x) >= M) ? (x - M) : x; return *this; }
  ModInt &operator-=(const ModInt &a) { x = ((x -= a.x) >= M) ? (x + M) : x; return *this; }
  ModInt &operator*=(const ModInt &a) { x = (static_cast<unsigned long long>(x) * a.x) % M; return *this; }
  ModInt &operator/=(const ModInt &a) { return (*this *= a.inv()); }
  ModInt pow(long long e) const {
    if (e < 0) return inv().pow(-e);
    ModInt a = *this, b = 1U; for (; e; e >>= 1) { if (e & 1) b *= a; a *= a; } return b;
  }
  ModInt inv() const {
    unsigned a = M, b = x; int y = 0, z = 1;
    for (; b; ) { const unsigned q = a / b; const unsigned c = a - q * b; a = b; b = c; const int w = y - static_cast<int>(q) * z; y = z; z = w; }
    assert(a == 1U); return ModInt(y);
  }
  ModInt operator+() const { return *this; }
  ModInt operator-() const { ModInt a; a.x = x ? (M - x) : 0U; return a; }
  ModInt operator+(const ModInt &a) const { return (ModInt(*this) += a); }
  ModInt operator-(const ModInt &a) const { return (ModInt(*this) -= a); }
  ModInt operator*(const ModInt &a) const { return (ModInt(*this) *= a); }
  ModInt operator/(const ModInt &a) const { return (ModInt(*this) /= a); }
  template <class T> friend ModInt operator+(T a, const ModInt &b) { return (ModInt(a) += b); }
  template <class T> friend ModInt operator-(T a, const ModInt &b) { return (ModInt(a) -= b); }
  template <class T> friend ModInt operator*(T a, const ModInt &b) { return (ModInt(a) *= b); }
  template <class T> friend ModInt operator/(T a, const ModInt &b) { return (ModInt(a) /= b); }
  explicit operator bool() const { return x; }
  bool operator==(const ModInt &a) const { return (x == a.x); }
  bool operator!=(const ModInt &a) const { return (x != a.x); }
  friend std::ostream &operator<<(std::ostream &os, const ModInt &a) { return os << a.x; }
};
////////////////////////////////////////////////////////////////////////////////

constexpr unsigned MO = 1000000007;
using Mint = ModInt<MO>;

constexpr int LIM_INV = 400'010;
Mint inv[LIM_INV], fac[LIM_INV], invFac[LIM_INV];

void prepare() {
  inv[1] = 1;
  for (int i = 2; i < LIM_INV; ++i) {
    inv[i] = -((Mint::M / i) * inv[Mint::M % i]);
  }
  fac[0] = invFac[0] = 1;
  for (int i = 1; i < LIM_INV; ++i) {
    fac[i] = fac[i - 1] * i;
    invFac[i] = invFac[i - 1] * inv[i];
  }
}
Mint binom(Int n, Int k) {
  if (n < 0) {
    if (k >= 0) {
      return ((k & 1) ? -1 : +1) * binom(-n + k - 1, k);
    } else if (n - k >= 0) {
      return (((n - k) & 1) ? -1 : +1) * binom(-k - 1, n - k);
    } else {
      return 0;
    }
  } else {
    if (0 <= k && k <= n) {
      assert(n < LIM_INV);
      return fac[n] * invFac[k] * invFac[n - k];
    } else {
      return 0;
    }
  }
}


// gg: bipartite graph between {vertex} and {biconnected component}
//   (|gg| - n) biconnected components
//   isolated point: not regarded as biconnected component (==> isolated in gg)
// f: DFS out-forest
// ess: edges in biconnected component
//   (u, v) with dis[u] <= dis[v]
//   self-loop at isolated point: not included in ess
struct Biconnected {
  int n, m;
  vector<vector<int>> g, f, gg;
  vector<vector<pair<int, int>>> ess;
  vector<int> par, rs;
  int zeit;
  vector<int> dis, fin, low;

  Biconnected() {}
  explicit Biconnected(int n_) : n(n_), m(0), g(n_) {}
  void ae(int u, int v) {
    ++m;
    assert(0 <= u); assert(u < n);
    assert(0 <= v); assert(v < n);
    g[u].push_back(v);
    if (u != v) g[v].push_back(u);
  }

  int stackVLen, stackELen;
  vector<int> stackV;
  vector<pair<int, int>> stackE;
  vector<int> cntPar;
  void dfs(int u) {
    stackV[stackVLen++] = u;
    dis[u] = low[u] = zeit++;
    for (const int v : g[u]) {
      if (par[u] == v && !cntPar[u]++) continue;
      if (~dis[v]) {
        if (dis[u] >= dis[v]) stackE[stackELen++] = std::make_pair(v, u);
        if (low[u] > dis[v]) low[u] = dis[v];
      } else {
        f[u].push_back(v);
        par[v] = u;
        rs[v] = rs[u];
        const int stackEPos = stackELen;
        stackE[stackELen++] = std::make_pair(u, v);
        dfs(v);
        if (low[u] > low[v]) low[u] = low[v];
        if (dis[u] <= low[v]) {
          const int x = gg.size();
          gg.emplace_back();
          ess.emplace_back();
          for (; ; ) {
            const int w = stackV[--stackVLen];
            gg[w].push_back(x);
            gg[x].push_back(w);
            if (w == v) break;
          }
          gg[u].push_back(x);
          gg[x].push_back(u);
          for (; stackELen > stackEPos; ) ess[x].push_back(stackE[--stackELen]);
        }
      }
    }
    fin[u] = zeit;
  }
  void build() {
    f.assign(n, {});
    gg.assign(n, {});
    ess.assign(n, {});
    par.assign(n, -1);
    rs.assign(n, -1);
    zeit = 0;
    dis.assign(n, -1);
    fin.assign(n, -1);
    low.assign(n, -1);
    stackV.resize(n);
    stackE.resize(m);
    cntPar.assign(n, 0);
    for (int u = 0; u < n; ++u) if (!~dis[u]) {
      stackVLen = stackELen = 0;
      rs[u] = u;
      dfs(u);
    }
  }

  // Returns true iff u is an articulation point
  //   <=> # of connected components increases when u is removed.
  inline bool isArt(int u) const {
    return (gg[u].size() >= 2);
  }

  // Returns w s.t. w is a child of u and a descendant of v in the DFS forest.
  // Returns -1 instead if v is not a proper descendant of u
  //   O(log(deg(u))) time
  int dive(int u, int v) const {
    if (dis[u] < dis[v] && dis[v] < fin[u]) {
      int j0 = 0, j1 = f[u].size();
      for (; j0 + 1 < j1; ) {
        const int j = (j0 + j1) / 2;
        ((dis[f[u][j]] <= dis[v]) ? j0 : j1) = j;
      }
      return f[u][j0];
    } else {
      return -1;
    }
  }
  // Returns true iff there exists a v-w path when u is removed.
  //   O(log(deg(u))) time
  bool isStillReachable(int u, int v, int w) const {
    assert(0 <= u); assert(u < n);
    assert(0 <= v); assert(v < n);
    assert(0 <= w); assert(w < n);
    assert(u != v);
    assert(u != w);
    if (rs[v] != rs[w]) return false;
    if (rs[u] != rs[v]) return true;
    const int vv = dive(u, v);
    const int ww = dive(u, w);
    if (~vv) {
      if (~ww) {
        return (vv == ww || (dis[u] > low[vv] && dis[u] > low[ww]));
      } else {
        return (dis[u] > low[vv]);
      }
    } else {
      if (~ww) {
        return (dis[u] > low[ww]);
      } else {
        return true;
      }
    }
  }
};

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


int N, M;
vector<int> A, B;


namespace brute {
Mint run() {
cerr<<"[brute::run]"<<endl;
  vector<int> ps(N);
  for (int u = 0; u < N; ++u) {
    ps[u] = u;
  }
  int ans = 0;
  vector<pair<int, int>> qs(M);
  do {
    if (ps[0] < ps[1]) {
      for (int i = 0; i < M; ++i) {
        qs[i] = make_pair(ps[A[i]], ps[B[i]]);
        if (qs[i].first > qs[i].second) {
          swap(qs[i].first, qs[i].second);
        }
      }
      sort(qs.begin(), qs.end());
      for (int i = 0; i < M; ++i) for (int j = i + 1; j < M; ++j) {
        if (qs[i].first < qs[j].first && qs[j].first < qs[i].second && qs[i].second < qs[j].second) {
          goto failed;
        }
      }
      ++ans;
     failed:{}
    }
  } while (next_permutation(ps.begin(), ps.end()));
  ans *= 2;
  return ans;
}
}  // brute


namespace sub2 {
Mint run() {
cerr<<"[sub2::run]"<<endl;
  vector<int> deg(N, 0);
  for (int i = 0; i < M; ++i) {
    ++deg[A[i]];
    ++deg[B[i]];
  }
  Mint ans = N;
  for (int u = 0; u < N; ++u) {
    ans *= fac[deg[u]];
  }
  return ans;
}
}  // sub2


namespace sub3 {
Mint run() {
cerr<<"[sub3::run]"<<endl;
  vector<vector<int>> graph(N);
  for (int i = 0; i < M; ++i) {
    graph[A[i]].push_back(B[i]);
    graph[B[i]].push_back(A[i]);
  }
  vector<int> deg(N, 0);
  for (int u = 0; u < N; ++u) {
    deg[u] = graph[u].size();
  }
  queue<int> que;
  vector<int> on(N, 1);
  for (int u = 0; u < N; ++u) if (deg[u] == 1) {
    que.push(u);
  }
  for (; que.size(); ) {
    const int u = que.front();
    que.pop();
    on[u] = 0;
    for (const int v : graph[u]) if (on[v]) {
      if (--deg[v] == 1) {
        que.push(v);
      }
    }
  }
  for (int u = 0; u < N; ++u) {
    deg[u] = graph[u].size();
  }
  Mint ans = 2 * N;
  for (int u = 0; u < N; ++u) {
    ans *= fac[deg[u] - on[u]];
  }
  return ans;
}
}  // sub3


namespace sub5 {
Mint run() {
cerr<<"[sub5::run]"<<endl;
  Biconnected G(N);
  for (int i = 0; i < M; ++i) {
    G.ae(A[i], B[i]);
  }
  G.build();
// cerr<<"gg = "<<G.gg<<endl;
  Mint ans = N;
  for (int x = N; x < (int)G.gg.size(); ++x) {
    if (G.gg[x].size() >= 3) {
      ans *= 2;
    }
  }
  for (int u = 0; u < N; ++u) {
    ans *= fac[G.gg[u].size()];
  }
  return ans;
}
}  // sub5


namespace sub6 {
bool adj[310][310];
vector<int> tri[310][310];

int cnt;
bool dfs(int u, int v, int p) {
  if (u > v) {
    swap(u, v);
  }
  ++cnt;
  if (cnt > M) {
    return false;
  }
  auto ws = tri[u][v];
  {
    auto it = find(ws.begin(), ws.end(), p);
    if (it != ws.end()) {
      ws.erase(it);
    }
  }
  if (ws.size() >= 2) {
    return false;
  } else if (ws.size() == 1) {
    const int w = ws[0];
    if (!dfs(u, w, v)) return false;
    if (!dfs(v, w, u)) return false;
  }
  return true;
}

Mint run() {
cerr<<"[sub6::run]"<<endl;
  memset(adj, 0, sizeof(adj));
  for (int i = 0; i < M; ++i) {
    adj[A[i]][B[i]] = true;
    adj[B[i]][A[i]] = true;
  }
  for (int u = 0; u < N; ++u) for (int v = u + 1; v < N; ++v) {
    tri[u][v].clear();
    if (adj[u][v]) {
      for (int w = 0; w < N; ++w) if (adj[u][w] && adj[v][w]) {
        tri[u][v].push_back(w);
      }
    }
    if (tri[u][v].size() >= 3) {
cerr<<"[sub6] FAIL:"<<__LINE__<<endl;
      return 0;
    }
  }
  for (int u = 0; u < N; ++u) for (int v = u + 1; v < N; ++v) {
    if (tri[u][v].size() == 1) {
      cnt = 0;
      if (!dfs(u, v, -1)) {
cerr<<"[sub6] FAIL:"<<__LINE__<<endl;
        return 0;
      }
      if (cnt != M) {
cerr<<"[sub6] FAIL:"<<__LINE__<<endl;
        return 0;
      }
      goto done;
    }
  }
cerr<<"[sub6] FAIL:"<<__LINE__<<endl;
  return 0;
 done:{}
  return 2 * N;
}
}  // sub6


int main() {
  prepare();
  
  for (; ~scanf("%d%d", &N, &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];
    }
    
    Mint ans = 0;
    if (M <= 2 * N - 3) {
      if (M == 2 * N - 3) {
        ans = sub6::run();
      } else if (N <= 10) {
        ans = brute::run();
      } else {
        ans = sub5::run();
      }
    }
    printf("%u\n", ans.x);
#ifdef LOCAL
const Mint brt=brute::run();
if(brt!=ans)cerr<<N<<" "<<M<<" "<<A<<" "<<B<<": "<<brt<<" "<<ans<<endl;
assert(brt==ans);
#endif
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 6ms
memory: 10852kb

input:

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

output:

56

result:

ok single line: '56'

Test #2:

score: 0
Accepted
time: 349ms
memory: 10812kb

input:

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

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 279ms
memory: 11108kb

input:

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

output:

0

result:

ok single line: '0'

Test #4:

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

input:

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

output:

40

result:

ok single line: '40'

Subtask #2:

score: 5
Accepted

Test #5:

score: 5
Accepted
time: 251ms
memory: 76116kb

input:

200000 199999
76849 117660
190775 11517
36929 136177
161792 186900
165326 184615
74197 120051
7891 83240
121896 35204
83314 195652
104144 158348
71191 182187
122824 50031
108950 179173
165120 190230
156949 181392
171984 82834
96017 30143
58114 108979
38698 90371
185399 171751
139913 99465
71566 1324...

output:

437454115

result:

ok single line: '437454115'

Test #6:

score: 0
Accepted
time: 260ms
memory: 75844kb

input:

200000 199999
6574 23146
34257 69209
155380 164090
110026 127221
193115 99889
5635 174278
55712 77121
26697 49953
22754 96882
63538 126940
194879 165261
41026 41295
30210 92107
74413 48768
21400 93816
132836 161798
106855 181482
139713 172322
188984 22749
138035 187484
119125 94408
106547 197156
855...

output:

113291706

result:

ok single line: '113291706'

Test #7:

score: 0
Accepted
time: 235ms
memory: 75752kb

input:

200000 199999
31632 184606
168095 2953
125939 52574
192991 195231
89249 63587
67762 15189
127486 26911
55580 120635
164243 67832
132583 173571
144167 123204
145229 101807
103885 170616
134195 61189
192909 104601
164109 127893
96486 109669
155596 168629
144450 40523
111830 166912
21452 144116
168225 ...

output:

695768886

result:

ok single line: '695768886'

Test #8:

score: 0
Accepted
time: 196ms
memory: 75848kb

input:

200000 199999
163361 68930
19490 33356
160159 49369
191573 191277
25950 191040
87000 96084
87600 7514
36433 91932
124379 117605
192879 188658
132884 148743
167108 124881
145773 56391
131418 128073
157008 76084
141192 147983
85318 133420
94748 189411
50453 78717
71148 12192
164264 189793
112210 18103...

output:

733222740

result:

ok single line: '733222740'

Subtask #3:

score: 5
Accepted

Dependency #2:

100%
Accepted

Test #9:

score: 5
Accepted
time: 250ms
memory: 75972kb

input:

200000 200000
12724 99480
110070 33803
133108 189774
90549 132698
44107 190886
80834 45073
196688 3535
65325 152337
190962 142430
1881 60227
26322 185955
145062 99829
183113 179795
10631 100971
60798 37230
149752 51457
119906 123989
118777 44821
140764 181969
101534 197139
108651 135722
56961 189607...

output:

845696751

result:

ok single line: '845696751'

Test #10:

score: 0
Accepted
time: 231ms
memory: 76192kb

input:

200000 200000
101889 44867
88241 190435
89839 146284
5148 128828
32602 156348
31195 126576
146414 147950
70778 100220
13083 26015
6144 91822
141590 111136
44593 74957
138472 185562
75610 171998
48845 71030
175023 164685
128735 168341
15747 73835
169514 55205
119817 136636
190706 86265
148598 41994
1...

output:

654417965

result:

ok single line: '654417965'

Test #11:

score: 0
Accepted
time: 227ms
memory: 76040kb

input:

200000 200000
153577 8632
61036 84864
7655 90000
148729 89342
137385 7553
10222 50803
46720 102913
47837 105292
110223 81670
91157 108026
153903 139607
13230 84612
18282 113252
45158 195698
100923 170852
105927 41217
65631 826
105522 53451
173143 188641
176689 86349
150960 193904
15934 34208
72591 1...

output:

30336343

result:

ok single line: '30336343'

Test #12:

score: 0
Accepted
time: 225ms
memory: 75832kb

input:

200000 200000
139569 146207
179144 129709
26078 199032
175722 54209
174513 62650
157339 171357
119600 146013
50746 126175
183634 29260
30876 146213
53398 117000
115599 60981
90560 139790
2685 32865
53251 13733
60624 85594
41186 142244
157755 21032
167206 188574
161858 198651
157000 150869
113701 751...

output:

184856401

result:

ok single line: '184856401'

Subtask #4:

score: 20
Accepted

Test #13:

score: 20
Accepted
time: 2ms
memory: 10880kb

input:

300 305
289 290
34 35
111 140
90 93
233 240
110 271
116 117
12 21
141 142
53 57
21 85
99 102
34 42
183 184
240 264
252 253
223 224
159 160
126 131
112 113
28 33
50 52
204 208
185 188
46 50
262 264
197 199
111 136
259 261
290 294
49 50
263 264
210 212
291 294
203 208
184 185
120 121
111 131
210 240
2...

output:

482487615

result:

ok single line: '482487615'

Test #14:

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

input:

300 320
233 237
208 217
90 92
277 278
226 246
79 80
37 40
1 9
190 191
213 214
94 96
231 232
162 163
9 10
226 227
172 173
168 169
131 135
158 159
133 134
59 60
61 102
52 57
161 180
172 174
84 86
207 208
54 55
9 16
118 119
122 123
166 170
212 215
38 39
264 266
180 196
65 69
287 288
22 23
24 28
201 202...

output:

821115099

result:

ok single line: '821115099'

Test #15:

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

input:

300 350
104 106
257 259
216 298
250 251
147 148
217 218
220 267
284 285
249 250
232 233
145 209
257 258
283 287
232 238
255 256
206 207
189 190
23 25
48 51
75 115
187 193
14 18
90 94
81 82
45 48
90 91
42 44
51 54
154 155
174 175
60 62
82 85
99 100
160 161
216 217
200 202
226 231
255 257
252 253
36 3...

output:

427803536

result:

ok single line: '427803536'

Test #16:

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

input:

300 400
59 60
221 225
12 29
77 79
192 197
85 87
79 80
121 122
197 199
66 67
229 231
23 24
35 46
191 201
233 235
211 212
7 8
209 210
175 176
60 61
152 156
211 213
205 206
285 286
73 74
43 44
138 141
290 291
254 259
115 116
214 216
105 106
81 84
25 28
151 165
135 141
206 214
77 78
185 186
200 201
3 12...

output:

887964015

result:

ok single line: '887964015'

Test #17:

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

input:

300 500
161 164
45 46
199 201
87 88
44 50
216 218
65 68
209 225
96 97
111 113
293 294
262 263
91 92
76 77
31 38
235 267
292 294
109 111
65 67
186 188
18 19
2 3
9 10
255 256
7 8
61 63
261 267
250 252
91 97
1 8
183 229
267 268
79 80
274 275
140 141
133 277
166 168
254 255
240 245
46 47
59 63
250 251
1...

output:

217536838

result:

ok single line: '217536838'

Subtask #5:

score: 20
Accepted

Test #18:

score: 20
Accepted
time: 2ms
memory: 11224kb

input:

300 500
279 256
263 65
40 62
236 256
8 193
164 235
242 256
27 219
72 244
49 253
289 261
162 113
196 199
121 222
293 245
33 186
206 279
111 139
97 15
203 24
245 157
184 59
188 90
239 283
42 5
107 108
267 51
200 126
286 282
293 59
42 261
276 216
152 6
92 220
225 69
88 166
179 109
158 144
133 18
147 18...

output:

159215763

result:

ok single line: '159215763'

Test #19:

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

input:

300 400
266 230
93 211
207 79
137 173
3 72
277 182
143 250
297 136
285 26
11 98
188 257
271 65
298 259
58 109
193 227
180 195
137 56
104 285
39 9
166 33
41 188
72 243
25 80
81 268
190 158
76 90
191 266
1 145
119 138
241 7
179 103
275 108
144 235
164 248
146 64
69 285
288 200
90 51
5 163
116 255
280 ...

output:

910719722

result:

ok single line: '910719722'

Test #20:

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

input:

300 360
103 272
29 124
224 18
197 163
237 39
40 192
267 288
137 181
42 80
300 148
293 181
150 256
99 274
169 254
97 107
239 154
121 282
254 273
181 296
26 162
297 202
225 24
273 280
59 98
23 18
76 96
107 205
142 196
1 141
196 240
71 292
190 188
263 197
194 227
37 186
286 17
228 139
64 18
243 152
166...

output:

392453747

result:

ok single line: '392453747'

Test #21:

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

input:

300 330
40 16
254 156
114 293
90 109
236 82
44 153
243 5
277 201
198 229
286 149
250 253
84 130
291 180
2 262
110 153
93 225
12 57
30 92
170 247
86 105
110 87
256 167
27 230
200 99
84 194
113 207
176 245
55 47
16 23
74 42
222 240
27 253
109 254
226 15
118 31
101 33
260 154
223 78
173 63
209 248
293 ...

output:

109903798

result:

ok single line: '109903798'

Test #22:

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

input:

300 310
92 178
136 186
203 85
8 166
150 245
119 97
113 131
296 163
157 47
169 191
108 238
215 244
22 1
87 300
238 118
230 123
214 192
230 140
251 142
209 54
244 166
173 269
276 284
43 38
183 121
65 236
73 76
241 145
99 230
88 57
150 35
157 244
83 201
262 169
97 43
273 64
294 157
119 201
207 65
28 21...

output:

419876890

result:

ok single line: '419876890'

Subtask #6:

score: 20
Accepted

Test #23:

score: 20
Accepted
time: 3ms
memory: 10948kb

input:

300 597
181 11
16 186
144 42
80 274
72 186
238 172
7 268
225 118
198 84
274 214
170 27
181 44
171 74
270 266
20 6
296 108
45 25
32 198
99 86
129 110
281 273
67 47
259 107
277 265
264 145
215 218
264 164
156 281
100 23
284 125
109 280
92 203
108 74
227 171
213 81
262 239
206 111
5 23
90 121
77 274
23...

output:

600

result:

ok single line: '600'

Test #24:

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

input:

300 597
145 168
81 149
192 248
114 243
113 25
201 259
190 156
225 40
127 199
225 33
229 4
298 36
243 81
31 163
192 294
258 31
8 299
210 28
87 143
180 205
270 281
257 174
173 187
203 128
179 292
34 4
292 236
288 248
78 255
7 239
191 124
227 194
113 187
270 93
164 238
256 37
121 88
279 133
11 99
189 1...

output:

600

result:

ok single line: '600'

Test #25:

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

input:

300 597
137 70
124 146
24 239
38 218
186 180
244 153
274 153
274 298
256 126
36 174
172 157
60 274
270 87
207 14
114 280
221 51
165 106
166 25
29 62
210 122
104 157
218 173
134 154
65 120
131 46
45 262
138 253
48 187
118 114
101 184
47 244
200 60
296 267
34 128
129 165
53 246
102 123
153 238
238 249...

output:

600

result:

ok single line: '600'

Test #26:

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

input:

300 597
279 221
253 68
255 267
293 234
88 82
272 133
157 107
129 78
221 160
45 205
8 197
295 127
212 288
232 224
274 23
101 65
4 272
112 300
51 225
221 236
213 236
166 182
87 57
236 254
295 259
28 128
124 39
157 177
133 49
64 45
291 94
161 111
98 144
244 92
135 64
39 44
171 244
241 238
268 296
208 2...

output:

0

result:

ok single line: '0'

Test #27:

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

input:

300 597
240 186
292 198
221 201
168 95
237 175
71 272
55 257
181 281
47 115
188 83
251 142
297 77
271 181
68 75
267 209
195 92
22 54
134 300
253 251
238 13
179 199
246 144
61 199
65 271
113 46
180 204
144 209
84 184
124 250
238 212
70 30
118 125
175 39
88 54
253 159
208 243
115 262
30 128
214 22
187...

output:

0

result:

ok single line: '0'

Test #28:

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

input:

300 597
166 131
24 224
206 54
208 109
243 157
191 268
162 109
260 285
238 144
193 283
57 12
145 76
186 192
24 72
96 243
80 137
144 127
59 87
50 106
179 170
93 261
249 66
160 210
177 239
183 287
226 249
115 195
252 153
289 284
93 144
280 227
289 170
17 210
14 217
154 54
149 177
138 88
294 230
211 93
...

output:

0

result:

ok single line: '0'

Subtask #7:

score: 0
Wrong Answer

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #29:

score: 10
Accepted
time: 6ms
memory: 10928kb

input:

300 500
7 123
207 27
201 68
247 242
161 144
296 61
91 289
220 48
167 48
11 200
144 19
96 249
202 7
24 152
149 198
51 253
145 167
231 218
151 66
61 7
285 139
16 153
256 202
20 36
244 161
17 215
58 124
24 88
187 217
189 15
189 279
216 182
34 213
65 287
192 262
60 224
175 112
42 206
148 226
146 43
226 ...

output:

415588302

result:

ok single line: '415588302'

Test #30:

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

input:

300 400
220 267
181 218
108 226
109 23
243 167
252 9
274 24
195 130
4 134
200 101
258 166
130 266
220 170
261 60
139 160
255 191
150 242
93 229
69 202
194 14
191 258
102 298
172 61
24 96
207 200
262 181
63 162
259 292
21 242
56 217
156 132
6 64
62 248
85 77
211 60
142 171
224 94
26 109
71 76
112 6
1...

output:

703133826

result:

ok single line: '703133826'

Test #31:

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

input:

300 350
46 212
238 202
32 141
270 121
22 268
17 171
13 54
140 292
222 163
197 109
260 37
14 92
176 133
205 168
112 173
222 295
190 178
66 147
46 73
282 225
299 173
252 295
161 178
140 18
298 146
76 90
171 226
256 252
270 126
8 138
131 30
138 201
85 101
79 244
220 96
119 94
138 148
3 221
255 241
283 ...

output:

768971311

result:

ok single line: '768971311'

Test #32:

score: -10
Wrong Answer
time: 5ms
memory: 10884kb

input:

300 351
285 205
155 58
266 214
95 158
223 222
255 221
244 226
191 205
247 1
43 140
87 99
224 57
63 248
55 94
242 57
128 257
59 286
187 79
67 47
57 111
162 160
169 27
184 163
51 143
149 187
31 165
177 47
221 46
38 193
129 55
187 265
266 156
147 173
247 132
59 169
56 138
149 29
274 144
293 106
283 16
...

output:

156185757

result:

wrong answer 1st lines differ - expected: '0', found: '156185757'

Subtask #8:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #7:

0%