QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#700703#9545. Magical Setucup-team087#TL 61ms4460kbC++149.7kb2024-11-02 13:18:482024-11-05 01:08:06

Judging History

你现在查看的是测评时间为 2024-11-05 01:08:06 的历史记录

  • [2024-11-05 20:19:41]
  • hack成功,自动添加数据
  • (/hack/1133)
  • [2024-11-05 15:42:21]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:TL
  • 用时:62ms
  • 内存:4472kb
  • [2024-11-05 15:40:40]
  • hack成功,自动添加数据
  • (/hack/1120)
  • [2024-11-05 01:08:06]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:100
  • 用时:61ms
  • 内存:4460kb
  • [2024-11-05 01:07:31]
  • hack成功,自动添加数据
  • (/hack/1119)
  • [2024-11-02 13:19:18]
  • 评测
  • 测评结果:100
  • 用时:57ms
  • 内存:4700kb
  • [2024-11-02 13:18:48]
  • 提交

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 <class T> T power(T a, long long e, T m) {
  for (T b = 1; ; (a *= a) %= m) {
    if (e & 1) (b *= a) %= m;
    if (!(e >>= 1)) return b;
  }
}

long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a == 0) return b;
  if (b == 0) return a;
  const int s = __builtin_ctzll(a | b);
  a >>= __builtin_ctzll(a);
  do {
    b >>= __builtin_ctzll(b);
    if (a > b) swap(a, b);
    b -= a;
  } while (b);
  return a << s;
}

bool isPrime(long long n) {
  if (n <= 1 || n % 2 == 0) return (n == 2);
  const int s = __builtin_ctzll(n - 1);
  const long long d = (n - 1) >> s;
  // http://miller-rabin.appspot.com/
  for (const long long base : {2, 325, 9375, 28178, 450775, 9780504, 1795265022}) {
    __int128 a = base % n;
    if (a == 0) continue;
    a = power<__int128>(a, d, n);
    if (a == 1 || a == n - 1) continue;
    bool ok = false;
    for (int i = 0; i < s - 1; ++i) {
      (a *= a) %= n;
      if (a == n - 1) {
        ok = true;
        break;
      }
    }
    if (!ok) return false;
  }
  return true;
}

// n >= 3, odd
void factorizeRec(long long n, vector<long long> &ps) {
  static constexpr int BLOCK = 256;
  if (isPrime(n)) {
    ps.push_back(n);
  } else {
    for (long long c = 2; ; ++c) {
      long long x, y = 2, y0, z = 1, d = 1;
      for (int l = 1; d == 1; l <<= 1) {
        x = y;
        for (int i = 0; i < l; ++i) y = (static_cast<__int128>(y) * y + c) % n;
        for (int i = 0; i < l; i += BLOCK) {
          y0 = y;
          for (int j = 0; j < BLOCK && j < l - i; ++j) {
            y = (static_cast<__int128>(y) * y + c) % n;
            z = (static_cast<__int128>(z) * (y - x)) % n;
          }
          if ((d = gcd(z, n)) != 1) break;
        }
      }
      if (d == n) {
        for (y = y0; ; ) {
          y = (static_cast<__int128>(y) * y + c) % n;
          if ((d = gcd(y - x, n)) != 1) break;
        }
      }
      if (d != n) {
        factorizeRec(d, ps);
        factorizeRec(n / d, ps);
        return;
      }
    }
  }
}

vector<pair<long long, int>> factorize(long long n) {
  vector<pair<long long, int>> pes;
  if (n >= 2) {
    const int s = __builtin_ctzll(n);
    if (s) pes.emplace_back(2, s);
    if (n >> s >= 2) {
      vector<long long> ps;
      factorizeRec(n >> s, ps);
      std::sort(ps.begin(), ps.end());
      const int psLen = ps.size();
      for (int i = 0, j = 0; i < psLen; i = j) {
        for (; j < psLen && ps[i] == ps[j]; ++j) {}
        pes.emplace_back(ps[i], j - i);
      }
    }
  }
  return pes;
}

vector<long long> divisors(long long n) {
  const auto pes = factorize(n);
  vector<long long> ds{1};
  for (const auto &pe : pes) {
    const int len0 = ds.size();
    const int len1 = len0 * (pe.second + 1);
    ds.resize(len1);
    for (int i = len0; i < len1; ++i) ds[i] = ds[i - len0] * pe.first;
  }
  std::sort(ds.begin(), ds.end());
  return ds;
}

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

// Minimum cost flow by successive shortest paths.
// Assumes that there exists no negative-cost cycle.
// TODO: Check the range of intermediate values.
template <class Flow, class Cost> struct MinCostFlow {
  // Watch out when using types other than int and long long.
  static constexpr Flow FLOW_EPS = 1e-10L;
  static constexpr Flow FLOW_INF = std::numeric_limits<Flow>::max();
  static constexpr Cost COST_EPS = 1e-10L;
  static constexpr Cost COST_INF = std::numeric_limits<Cost>::max();

  int n, m;
  vector<int> ptr, nxt, zu;
  vector<Flow> capa;
  vector<Cost> cost;

  explicit MinCostFlow(int n_) : n(n_), m(0), ptr(n_, -1) {}
  void ae(int u, int v, Flow w, Cost c) {
    assert(0 <= u); assert(u < n);
    assert(0 <= v); assert(v < n);
    assert(0 <= w);
    nxt.push_back(ptr[u]); zu.push_back(v); capa.push_back(w); cost.push_back( c); ptr[u] = m++;
    nxt.push_back(ptr[v]); zu.push_back(u); capa.push_back(0); cost.push_back(-c); ptr[v] = m++;
  }

  vector<Cost> pot, dist;
  vector<bool> vis;
  vector<int> pari;

  // cost slopes[j] per flow when flows[j] <= flow <= flows[j + 1]
  vector<Flow> flows;
  vector<Cost> slopes;

  // Finds a shortest path from s to t in the residual graph.
  // O((n + m) log m) time.
  //   Assumes that the members above are set.
  //   The distance to a vertex might not be determined if it is >= dist[t].
  //   You can pass t = -1 to find a shortest path to each vertex.
  void shortest(int s, int t) {
    using Entry = pair<Cost, int>;
    priority_queue<Entry, vector<Entry>, std::greater<Entry>> que;
    for (int u = 0; u < n; ++u) { dist[u] = COST_INF; vis[u] = false; }
    for (que.emplace(dist[s] = 0, s); !que.empty(); ) {
      const Cost c = que.top().first;
      const int u = que.top().second;
      que.pop();
      if (vis[u]) continue;
      vis[u] = true;
      if (u == t) return;
      for (int i = ptr[u]; ~i; i = nxt[i]) if (capa[i] > FLOW_EPS) {
        const int v = zu[i];
        if (!vis[v]) {
          const Cost cc = c + cost[i] + pot[u] - pot[v];
          if (dist[v] > cc) { que.emplace(dist[v] = cc, v); pari[v] = i; }
        }
      }
    }
  }

  // Finds a minimum cost flow from s to t of amount min{(max flow), limFlow}.
  //   Bellman-Ford takes O(n m) time, or O(m) time if there is no negative-cost
  //   edge, or cannot stop if there exists a negative-cost cycle.
  //   min{(max flow), limFlow} shortest paths if Flow is an integral type.
  pair<Flow, Cost> run(int s, int t, Flow limFlow = FLOW_INF) {
    assert(0 <= s); assert(s < n);
    assert(0 <= t); assert(t < n);
    assert(s != t);
    assert(0 <= limFlow);
    pot.assign(n, 0);
    for (; ; ) {
      bool upd = false;
      for (int i = 0; i < m; ++i) if (capa[i] > FLOW_EPS) {
        const int u = zu[i ^ 1], v = zu[i];
        const Cost cc = pot[u] + cost[i];
        if (pot[v] > cc + COST_EPS) { pot[v] = cc; upd = true; }
      }
      if (!upd) break;
    }
    dist.resize(n);
    vis.resize(n);
    pari.resize(n);
    Flow totalFlow = 0;
    Cost totalCost = 0;
    flows.clear(); flows.push_back(0);
    slopes.clear();
    for (; totalFlow < limFlow; ) {
      shortest(s, t);
      if (!vis[t]) break;
      for (int u = 0; u < n; ++u) pot[u] += min(dist[u], dist[t]);
      Flow f = limFlow - totalFlow;
      for (int v = t; v != s; ) {
        const int i = pari[v]; if (f > capa[i]) { f = capa[i]; } v = zu[i ^ 1];
      }
      for (int v = t; v != s; ) {
        const int i = pari[v]; capa[i] -= f; capa[i ^ 1] += f; v = zu[i ^ 1];
      }
      totalFlow += f;
      totalCost += f * (pot[t] - pot[s]);
      flows.push_back(totalFlow);
      slopes.push_back(pot[t] - pot[s]);
    }
    return make_pair(totalFlow, totalCost);
  }
};

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


int N;
vector<int> A;

int main() {
  for (; ~scanf("%d", &N); ) {
    A.resize(N);
    for (int i = 0; i < N; ++i) {
      scanf("%d", &A[i]);
    }
    
    vector<vector<Int>> pss(N);
    vector<int> ds;
    vector<pair<int, int>> dis;
    for (int i = 0; i < N; ++i) {
      const auto pes = factorize(A[i]);
      for (const auto &pe : pes) {
        pss[i].push_back(pe.first);
      }
      const auto divs = divisors(A[i]);
      for (const Int d : divs) {
        ds.push_back(d);
        dis.emplace_back(d, i);
      }
    }
    sort(ds.begin(), ds.end());
    ds.erase(unique(ds.begin(), ds.end()), ds.end());
    reverse(ds.begin(), ds.end());
    sort(dis.begin(), dis.end());
    const int dsLen = ds.size();
    auto id = [&](int d) -> int {
      return lower_bound(ds.begin(), ds.end(), d, greater<int>{}) - ds.begin();
    };
cerr<<"|ds| = "<<dsLen<<endl;
// cerr<<"ds = "<<ds<<endl;
    
    MinCostFlow<int, int> mcf(dsLen + 2);
    const int s = dsLen, t = dsLen + 1;
    for (int i = 0; i < N; ++i) {
      const int u = id(A[i]);
      mcf.ae(s, u, 1, 0);
    }
    for (int u = 0; u < dsLen; ++u) {
      auto it = lower_bound(dis.begin(), dis.end(), make_pair(ds[u], -1));
// cerr<<ds[u]<<" "<<pss[it->second]<<endl;
      for (const auto &p : pss[it->second]) {
        if (ds[u] % p == 0) {
          const int v = id(ds[u] / p);
          mcf.ae(u, v, N, -1);
        }
      }
    }
    for (int u = 0; u < dsLen; ++u) {
      mcf.ae(u, t, 1, 0);
    }
    const auto res = mcf.run(s, t, N);
    printf("%d\n", -res.second);
    assert(res.first == N);
  }
  return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 4 6

output:

3

result:

ok single line: '3'

Test #2:

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

input:

6
2 3 5 6 10 12

output:

3

result:

ok single line: '3'

Test #3:

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

input:

1
1

output:

0

result:

ok single line: '0'

Test #4:

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

input:

1
735134400

output:

15

result:

ok single line: '15'

Test #5:

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

input:

2
1 2

output:

0

result:

ok single line: '0'

Test #6:

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

input:

20
41 93 206 223 284 297 339 403 474 518 521 571 637 729 734 754 837 842 945 1000

output:

37

result:

ok single line: '37'

Test #7:

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

input:

20
35922304 124138674 156896716 201255078 360247130 439329090 443603089 467049996 561750675 589197670 620970522 630712763 674436226 687175642 692397650 708613992 784328202 793365993 895628657 1000000000

output:

92

result:

ok single line: '92'

Test #8:

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

input:

40
8 51 82 93 114 165 174 187 216 224 248 325 328 330 331 336 358 368 403 410 414 463 472 520 577 613 626 667 744 749 802 844 887 903 904 910 911 959 979 1000

output:

71

result:

ok single line: '71'

Test #9:

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

input:

40
58725 66885 87908 92237 138500 140194 171682 227647 238817 311307 444556 454975 459318 465376 469292 469455 476914 513372 521171 531237 543467 566340 598915 601369 638925 654913 757870 784366 795827 796087 835627 846885 864797 876699 908007 914151 917570 989631 995272 1000000

output:

111

result:

ok single line: '111'

Test #10:

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

input:

40
99752893 101979689 107216467 130339540 137493510 138738208 162741062 180249929 186516816 187235074 358278013 384785273 400149496 411395765 421357351 437374604 455076645 505755921 523688878 530891027 573299367 596827139 637359701 639369172 657663951 777572838 796566287 825817949 831054329 84740378...

output:

128

result:

ok single line: '128'

Test #11:

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

input:

100
3 18 24 55 60 71 82 83 89 90 103 110 129 161 204 208 209 225 228 233 260 279 283 287 291 321 329 338 343 360 369 371 384 401 408 420 431 435 442 446 450 461 473 484 489 496 499 510 511 521 526 529 539 546 548 551 567 568 602 606 631 642 643 649 652 663 670 680 687 704 711 717 730 746 776 779 786...

output:

145

result:

ok single line: '145'

Test #12:

score: 0
Accepted
time: 8ms
memory: 4240kb

input:

100
19303936 22038015 24731746 28433798 33071886 34624499 46331683 49242785 57793889 85183900 99228787 121211959 121455741 121604367 122656838 142760737 161523016 188225464 210782097 222034252 224345010 230364653 243777644 261299274 269988981 285750541 287013597 287075370 320694094 343378671 4017154...

output:

325

result:

ok single line: '325'

Test #13:

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

input:

300
5 7 11 17 18 20 21 29 30 34 36 45 46 47 49 52 53 57 61 62 63 67 84 86 88 91 93 97 100 105 115 118 129 135 140 143 145 147 151 162 174 175 176 180 186 199 204 205 210 213 215 217 219 222 223 229 231 235 236 237 243 245 247 250 265 266 268 269 270 277 280 284 286 288 289 290 294 297 301 303 305 31...

output:

280

result:

ok single line: '280'

Test #14:

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

input:

300
2524 7089 7240 8917 13393 18978 20723 22083 22870 23108 24917 27032 27932 29466 33702 35729 37231 40509 42105 46630 50133 52114 60192 61431 63589 66831 73669 74133 75079 75085 76698 76956 82900 84352 89376 89725 91582 93228 95721 96337 104620 105974 107004 108495 112126 114539 124273 125013 1296...

output:

737

result:

ok single line: '737'

Test #15:

score: 0
Accepted
time: 53ms
memory: 4316kb

input:

300
3214472 5686438 7498489 8153449 10901408 11904555 12249901 15868342 17591998 21550384 26486927 28187351 43738496 56878914 63354478 66909905 68799118 71022752 73330523 75751053 76827761 80363922 87657073 89729947 93175069 93923577 94884550 96398806 97120985 100276275 105016979 124505538 124794641...

output:

934

result:

ok single line: '934'

Test #16:

score: 0
Accepted
time: 22ms
memory: 4456kb

input:

300
31501984 444810752 2391008 409578496 191968256 16137824 893446144 81166336 318712 578573312 25060352 26704736 31794944 230875136 393853952 649428992 525026 236914 12241408 3695092 3468044 13582336 274677248 1661432 240643072 59896064 723586 2763032 175171072 6873952 45877376 37155584 28561696 83...

output:

1852

result:

ok single line: '1852'

Test #17:

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

input:

300
46259991 210931047 8715771 4331799 596401461 1601361 5295861 162853 65064789 4051143 24666363 31097277 213591897 60686739 3584907 136454949 1249389 110477 11326311 21542841 345567141 722750283 465436611 50825961 348851 111537 511888491 405781 6671097 8024823 513977 7006761 135043 193247 6412347 ...

output:

1001

result:

ok single line: '1001'

Test #18:

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

input:

300
8848089 734303 36493 145146087 575693 391187961 23281371 544699 56660067 254099511 726500259 100203237 643243 609959403 883691 891101 436467609 908723 226521441 65119 21791079 721381 655181 259934427 323537 140304069 24074847 2096307 632483 941489 301246857 24595839 10180377 15189957 8641431 532...

output:

907

result:

ok single line: '907'

Test #19:

score: 0
Accepted
time: 25ms
memory: 4192kb

input:

300
542728512 8613144 893383 209449 618349 796259 61329384 44080488 328411 797473 318811 603443 245071 797003712 21188808 19061928 108709 87221 29605824 63455544 336581568 16519176 344587 234713 27380952 10077768 66992832 32446152 535351 561650112 464143 142433 589471 343081 967391 68631912 30601152...

output:

936

result:

ok single line: '936'

Test #20:

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

input:

300
372121 605257 194827 668579 624271 614723710 4943 36709 696989 902089 541721 320591 273719 166843 637603 434867 631733 906497 985057 927403 400151 446863 229459 665069 223841 853637 839491 523519 330199 466909 955819 159293 800143 427967 249541 898129 262957 798751 603487 974863 551981 424331 91...

output:

19

result:

ok single line: '19'

Test #21:

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

input:

300
930746368 796788736 660118528 882722816 848647168 885671936 857288704 740512768 585419776 877677568 628363264 659588096 565243904 537580544 669672448 610358272 729438208 590833664 670263296 643825664 666223616 991474688 707989504 866444288 639437824 514164736 649398272 971568128 874479616 566969...

output:

3330

result:

ok single line: '3330'

Test #22:

score: 0
Accepted
time: 36ms
memory: 4176kb

input:

300
575802368 252647168 252470528 884948992 250014976 784027648 512828416 904784896 590728192 541355008 873479168 278797312 758526976 349290496 739828736 791538688 262684672 370035712 931459072 877106176 466038784 601293824 555470848 571485184 321614848 555600896 654797824 385567744 252465152 675367...

output:

3237

result:

ok single line: '3237'

Test #23:

score: 0
Accepted
time: 40ms
memory: 4176kb

input:

300
395506688 555744256 315894784 612666368 768019456 290729984 762523648 861114368 629513216 254249984 619123712 254276864 899940352 731051008 794561536 347558912 533086208 791953408 670456832 978243584 764240896 299908096 571584512 707777536 845627392 663571456 720729088 884150272 630811648 710935...

output:

3211

result:

ok single line: '3211'

Test #24:

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

input:

300
438899553 605594151 583731441 191392389 709244829 532504611 287247141 555396669 354043953 279105669 906605541 307924497 364927923 509329701 727697277 667817217 309758661 237960909 532621251 635147811 180251811 691062111 338994477 673612767 383651559 550327203 216391257 169749837 517616973 367547...

output:

1935

result:

ok single line: '1935'

Test #25:

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

input:

300
671523453 101843487 385510509 116034201 567597213 124476021 431113833 441856377 308615589 372213549 538373061 415345563 616459167 658580787 673210359 76806711 222023511 275561271 178401609 236852829 646272351 185010723 60249663 683534457 55379943 159663393 896383503 43618257 704488833 613881423 ...

output:

1879

result:

ok single line: '1879'

Test #26:

score: 0
Accepted
time: 61ms
memory: 4456kb

input:

300
43641432 71556552 67287384 56477448 66311928 16889112 70637544 40184136 35950248 16125768 22916808 58875912 45354744 577191744 24906456 62656488 577222848 22391784 64821096 30509928 92809152 24118056 31178376 39757896 223601472 54635544 70736616 58162248 38353464 37196424 42600456 41052456 54082...

output:

1811

result:

ok single line: '1811'

Test #27:

score: 0
Accepted
time: 42ms
memory: 4196kb

input:

300
277259264 320155659 458044551 902597000 598091283 992564224 533622784 648910000 411089375 351622144 666464193 152057731 216676873 696968192 628596875 308619776 614352896 336146432 169181696 480272896 373421056 848417000 384694784 739859375 141679000 316808496 337061169 773146624 404253125 342449...

output:

2134

result:

ok single line: '2134'

Test #28:

score: 0
Accepted
time: 46ms
memory: 4220kb

input:

300
557993367 191862016 506817648 560464272 446374912 717967000 319967577 178961132 177801181 164050596 97718528 187449892 234008576 178267275 799432875 220761031 305234375 220090625 332943125 166466800 72840068 218762325 135690496 107470987 273115125 280633339 83491236 568646973 207918675 294191028...

output:

1771

result:

ok single line: '1771'

Test #29:

score: 0
Accepted
time: 45ms
memory: 4252kb

input:

300
201869100 244176444 172933000 355100152 196011875 433165248 175497916 202885376 216104356 767713576 142971523 118099152 166597156 316609884 91056113 613664387 210882744 178427277 350846800 226195600 480896936 161246016 205801984 303599164 172633536 953095949 853955100 214344653 221401575 5700663...

output:

1539

result:

ok single line: '1539'

Test #30:

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

input:

300
17985046 26341272 22672752 45480550 37125205 64059385 374571308 33371555 28004150 216460224 44436598 417208887 102303643 957005672 28632137 44065850 192262708 657055700 356920532 14377222 220534893 62233992 39381815 726085675 18171226 24484781 33935965 768722688 348396875 144186300 33402374 2473...

output:

1129

result:

ok single line: '1129'

Test #31:

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

input:

300
254501888 938632192 599680503 385706875 616838125 744671875 577448125 880449536 721298432 870984704 907015625 385033743 863836569 240055625 390359817 939594752 230783125 687674368 396855625 603216875 836492288 592368633 553072617 919271875 828172288 659226681 318393344 542150656 463474688 300713...

output:

2300

result:

ok single line: '2300'

Test #32:

score: 0
Accepted
time: 37ms
memory: 4236kb

input:

300
442017648 904671875 227614457 259077847 196722216 648584375 991767321 825736192 479900672 333287269 551404544 708057088 520462989 932928273 382104621 659677151 514430352 828982512 897327104 365854375 671392768 847689857 367692291 500239071 367320501 471044987 476766729 399560704 362729259 542257...

output:

2134

result:

ok single line: '2134'

Test #33:

score: 0
Accepted
time: 20ms
memory: 4144kb

input:

300
32358028 993197 859609 438829694 108718802 818260776 416653966 487934859 22501 68321067 479029 210173 827699 902834787 269054602 223645834 150679586 321411621 833420392 578988893 685176434 294341 729672774 337231029 492436018 806444014 363102106 395653802 961093656 798489674 414653 533138155 761...

output:

579

result:

ok single line: '579'

Test #34:

score: 0
Accepted
time: 40ms
memory: 4204kb

input:

300
1916756 5789912 379330815 555411510 680164727 534652944 86278269 3364964 696642 9041 468288841 476370596 525971428 609120739 3633732 231788223 548744536 975265 120957920 819743387 18775552 836214532 130144536 21682900 34984900 541901270 137049344 601628304 2002491 6759290 360782013 79224100 3094...

output:

987

result:

ok single line: '987'

Test #35:

score: 0
Accepted
time: 37ms
memory: 4192kb

input:

300
880539653 99924050 804355221 933110863 3965276 28429696 960962543 114541279 912201252 396539292 809838305 77127457 5197970 874826146 256506762 118719969 10836994 66743552 68297344 4724792 264665946 35452904 533811538 6268 821232584 949569064 992312889 818362739 3458725 21665799 161326889 1675724...

output:

988

result:

ok single line: '988'

Test #36:

score: 0
Accepted
time: 43ms
memory: 4236kb

input:

300
490462208 639950199 26896293 7692179 4932190 1853276 172540133 616618748 402274593 866740330 4892101 826259571 8296545 357960968 980719892 140578173 7968732 16345073 665237152 704949472 26566987 997229046 47335021 5349838 534331266 748516841 35931161 194238208 40321193 11387286 851494431 1177979...

output:

1010

result:

ok single line: '1010'

Test #37:

score: 0
Accepted
time: 33ms
memory: 4232kb

input:

300
539502820 663171968 5316146 21234800 39494117 98906149 993108631 289795795 882566953 317873358 714913520 403330826 969598585 532266830 4798325 84427853 639238 1880377 6298905 480146479 3704817 982266449 25780681 3886918 966090011 29693375 868148561 274934875 519552098 913291663 18154075 15038065...

output:

742

result:

ok single line: '742'

Test #38:

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

input:

300
67439488 14059542 890155091 93224375 5073273 215932753 370661058 132311591 481532 1735675 1434627 625878567 768295235 54503872 173618847 933402014 38765696 560152 273098876 586803612 330794 1367109 8220447 12952525 77847296 59390336 59221297 277245736 71910016 65322531 7687899 3776504 133894 427...

output:

1001

result:

ok single line: '1001'

Test #39:

score: 0
Accepted
time: 45ms
memory: 4216kb

input:

300
2020353 2170317 30637668 5797648 486730819 5955649 407861248 77905933 79804948 74653665 249246735 16517125 20414673 142271992 640119741 3050312 779065875 934012135 3656863 868408608 118483712 572050119 332961506 145223361 8395137 4105096 261729973 152276328 613110438 77314304 446332802 465168960...

output:

1029

result:

ok single line: '1029'

Test #40:

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

input:

300
206369 313583 419155923 219677 26164141 6563 885076705 807770201 177589 169399 930818447 912983918 282493 70121 264791 123289 128449643 910660854 36257916 241132887 264289 94111 305159090 284201 208223 58400182 223253 42829 284831 456109562 289193 42473 7673 304481 286063 63955689 16381 258253 6...

output:

420

result:

ok single line: '420'

Extra Test:

score: 0
Extra Test Passed