QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#635968#8628. 最大连续和wzj333000 1ms3912kbC++2316.1kb2024-10-12 21:38:552024-10-12 21:38:55

Judging History

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

  • [2024-10-12 21:38:55]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3912kb
  • [2024-10-12 21:38:55]
  • 提交

answer

/**
  * created     : 12.10.2024 20:25:04
  * author      : wzj33300
  */

#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include <algo/debug.h>
#else
#define debug(...) 42
#define assert(...) 42
#endif

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using db = long double;  // or double, if TL is tight
using str = string;      // yay python!

// pairs
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
#define mp make_pair
#define fi first
#define se second

// ^ lol this makes everything look weird but I'll try it
template <class T>
using vc = vector<T>;
template <class T, size_t SZ>
using AR = array<T, SZ>;
using vi = vc<int>;
using vb = vc<bool>;
using vl = vc<ll>;
using vd = vc<db>;
using vs = vc<str>;
using vpi = vc<pi>;
using vpl = vc<pl>;
using vpd = vc<pd>;

// vectors
// oops size(x), rbegin(x), rend(x) need C++17
#define sz(x) int((x).size())
#define bg(x) begin(x)
#define all(x) bg(x), end(x)
#define rall(x) x.rbegin(), x.rend()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define pb push_back
#define eb emplace_back
#define ft front()
#define bk back()

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
#define rep1n(i, n) for (int i = 1; i <= (n); ++i)
#define repr(i, n) for (int i = (n) - 1; i >= 0; --i)

#define rep_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))

#define lb lower_bound
#define ub upper_bound
template <class T>
int lwb(vc<T>& a, const T& b) {
  return int(lb(all(a), b) - bg(a));
}
template <class T>
int upb(vc<T>& a, const T& b) {
  return int(ub(all(a), b) - bg(a));
}
// const int MOD = 998244353;  // 1e9+7;
const int Big = 1e9;  // not too close to INT_MAX
const ll BIG = 1e18;  // not too close to LLONG_MAX
const db PI = acos((db)-1);
const int dx[4]{1, 0, -1, 0}, dy[4]{0, 1, 0, -1};  // for every grid problem!!
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

int pct(int x) { return __builtin_popcount(x); }
int pct(u32 x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int pct(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}  // set a = min(a,b)
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}  // set a = max(a,b)

template <class T, class U>
T fstTrue(T lo, T hi, U f) {
  ++hi;
  assert(lo <= hi);  // assuming f is increasing
  while (lo < hi) {  // find first index such that f is true
    T mid = lo + (hi - lo) / 2;
    f(mid) ? hi = mid : lo = mid + 1;
  }
  return lo;
}
template <class T, class U>
T lstTrue(T lo, T hi, U f) {
  --lo;
  assert(lo <= hi);  // assuming f is decreasing
  while (lo < hi) {  // find first index such that f is true
    T mid = lo + (hi - lo + 1) / 2;
    f(mid) ? lo = mid : hi = mid - 1;
  }
  return lo;
}

namespace seg_tree {

// Floor of log_2(a); index of highest 1-bit
inline int floor_log_2(int a) {
  return a ? bit_width(unsigned(a)) - 1 : -1;
}

struct point {
  int a;
  point() : a(0) {}
  explicit point(int a_) : a(a_) { assert(a >= -1); }

  explicit operator bool() { return bool(a); }

  // This is useful so you can directly do array indices
  /* implicit */ operator int() const { return a; }

  point c(bool z) const {
    return point((a << 1) | z);
  }

  point operator[](bool z) const {
    return c(z);
  }

  point p() const {
    return point(a >> 1);
  }

  friend std::ostream& operator<<(std::ostream& o, const point& p) { return o << int(p); }

  template <typename F>
  void for_each(F f) const {
    for (int v = a; v > 0; v >>= 1) {
      f(point(v));
    }
  }

  template <typename F>
  void for_parents_down(F f) const {
    // strictly greater than 0
    for (int L = floor_log_2(a); L > 0; L--) {
      f(point(a >> L));
    }
  }

  template <typename F>
  void for_parents_up(F f) const {
    for (int v = a >> 1; v > 0; v >>= 1) {
      f(point(v));
    }
  }

  point& operator++() {
    ++a;
    return *this;
  }
  point operator++(int) { return point(a++); }
  point& operator--() {
    --a;
    return *this;
  }
  point operator--(int) { return point(a--); }
};

struct range {
  int a, b;
  range() : a(1), b(1) {}
  range(int a_, int b_) : a(a_), b(b_) {
    assert(1 <= a && a <= b && b <= 2 * a);
  }
  explicit range(std::array<int, 2> r) : range(r[0], r[1]) {}

  explicit operator std::array<int, 2>() const {
    return {a, b};
  }

  const int& operator[](bool z) const {
    return z ? b : a;
  }

  friend std::ostream& operator<<(std::ostream& o, const range& r) { return o << "[" << r.a << ".." << r.b << ")"; }

  // Iterate over the range from outside-in.
  //   Calls f(point a)
  template <typename F>
  void for_each(F f) const {
    for (int x = a, y = b; x < y; x >>= 1, y >>= 1) {
      if (x & 1) f(point(x++));
      if (y & 1) f(point(--y));
    }
  }

  // Iterate over the range from outside-in.
  //   Calls f(point a, bool is_right)
  template <typename F>
  void for_each_with_side(F f) const {
    for (int x = a, y = b; x < y; x >>= 1, y >>= 1) {
      if (x & 1) f(point(x++), false);
      if (y & 1) f(point(--y), true);
    }
  }

  // Iterate over the range from left to right.
  //    Calls f(point)
  template <typename F>
  void for_each_l_to_r(F f) const {
    int anc_depth = floor_log_2((a - 1) ^ b);
    int anc_msk = (1 << anc_depth) - 1;
    for (int v = (-a) & anc_msk; v; v &= v - 1) {
      int i = countr_zero(unsigned(v));
      f(point(((a - 1) >> i) + 1));
    }
    for (int v = b & anc_msk; v;) {
      int i = floor_log_2(v);
      f(point((b >> i) - 1));
      v ^= (1 << i);
    }
  }

  // Iterate over the range from right to left.
  //    Calls f(point)
  template <typename F>
  void for_each_r_to_l(F f) const {
    int anc_depth = floor_log_2((a - 1) ^ b);
    int anc_msk = (1 << anc_depth) - 1;
    for (int v = b & anc_msk; v; v &= v - 1) {
      int i = countr_zero(unsigned(v));
      f(point((b >> i) - 1));
    }
    for (int v = (-a) & anc_msk; v;) {
      int i = floor_log_2(v);
      f(point(((a - 1) >> i) + 1));
      v ^= (1 << i);
    }
  }

  template <typename F>
  void for_parents_down(F f) const {
    int x = a, y = b;
    if ((x ^ y) > x) {
      x <<= 1, std::swap(x, y);
    }
    int dx = countr_zero(unsigned(x));
    int dy = countr_zero(unsigned(y));
    int anc_depth = floor_log_2((x - 1) ^ y);
    for (int i = floor_log_2(x); i > dx; i--) {
      f(point(x >> i));
    }
    for (int i = anc_depth; i > dy; i--) {
      f(point(y >> i));
    }
  }

  template <typename F>
  void for_parents_up(F f) const {
    int x = a, y = b;
    if ((x ^ y) > x) {
      x <<= 1, std::swap(x, y);
    }
    int dx = countr_zero(unsigned(x));
    int dy = countr_zero(unsigned(y));
    int anc_depth = floor_log_2((x - 1) ^ y);
    for (int i = dx + 1; i <= anc_depth; i++) {
      f(point(x >> i));
    }
    for (int v = y >> (dy + 1); v; v >>= 1) {
      f(point(v));
    }
  }
};

struct in_order_layout {
  // Alias them in for convenience
  using point = seg_tree::point;
  using range = seg_tree::range;

  int n, s;
  in_order_layout() : n(0), s(0) {}
  in_order_layout(int n_) : n(n_), s(n ? bit_ceil(unsigned(n)) : 0) {}

  point get_point(int a) const {
    assert(0 <= a && a < n);
    a += s;
    return point(a >= 2 * n ? a - n : a);
  }

  range get_range(int a, int b) const {
    assert(0 <= a && a <= b && b <= n);
    if (n == 0) return range();
    a += s, b += s;
    return range((a >= 2 * n ? 2 * (a - n) : a), (b >= 2 * n ? 2 * (b - n) : b));
  }

  range get_range(std::array<int, 2> p) const {
    return get_range(p[0], p[1]);
  }

  int get_leaf_index(point pt) const {
    int a = int(pt);
    assert(n <= a && a < 2 * n);
    return (a < s ? a + n : a) - s;
  }

  std::array<int, 2> get_node_bounds(point pt) const {
    int a = int(pt);
    assert(1 <= a && a < 2 * n);
    int l = countl_zero(unsigned(a)) - countl_zero(unsigned(2 * n - 1));
    int x = a << l, y = (a + 1) << l;
    assert(s <= x && x < y && y <= 2 * s);
    return {(x >= 2 * n ? (x >> 1) + n : x) - s, (y >= 2 * n ? (y >> 1) + n : y) - s};
  }

  int get_node_split(point pt) const {
    int a = int(pt);
    assert(1 <= a && a < n);
    int l = countl_zero(unsigned(2 * a + 1)) - countl_zero(unsigned(2 * n - 1));
    int x = (2 * a + 1) << l;
    assert(s <= x && x < 2 * s);
    return (x >= 2 * n ? (x >> 1) + n : x) - s;
  }

  int get_node_size(point pt) const {
    auto bounds = get_node_bounds(pt);
    return bounds[1] - bounds[0];
  }
};

struct circular_layout {
  // Alias them in for convenience
  using point = seg_tree::point;
  using range = seg_tree::range;

  int n;
  circular_layout() : n(0) {}
  circular_layout(int n_) : n(n_) {}

  point get_point(int a) const {
    assert(0 <= a && a < n);
    return point(n + a);
  }

  range get_range(int a, int b) const {
    assert(0 <= a && a <= b && b <= n);
    if (n == 0) return range();
    return range(n + a, n + b);
  }

  range get_range(std::array<int, 2> p) const {
    return get_range(p[0], p[1]);
  }

  int get_leaf_index(point pt) const {
    int a = int(pt);
    assert(n <= a && a < 2 * n);
    return a - n;
  }

  // Returns {x,y} so that 0 <= x < n and 1 <= y <= n
  // If the point is non-wrapping, then 0 <= x < y <= n
  std::array<int, 2> get_node_bounds(point pt) const {
    int a = int(pt);
    assert(1 <= a && a < 2 * n);
    int l = countl_zero(unsigned(a)) - countl_zero(unsigned(2 * n - 1));
    int s = bit_ceil(unsigned(n));
    int x = a << l, y = (a + 1) << l;
    assert(s <= x && x < y && y <= 2 * s);
    return {(x >= 2 * n ? x >> 1 : x) - n, (y > 2 * n ? y >> 1 : y) - n};
  }

  // Returns the split point of the node, such that 1 <= s <= n.
  int get_node_split(point pt) const {
    int a = int(pt);
    assert(1 <= a && a < n);
    return get_node_bounds(pt.c(0))[1];
  }

  int get_node_size(point pt) const {
    auto bounds = get_node_bounds(pt);
    int r = bounds[1] - bounds[0];
    return r > 0 ? r : r + n;
  }
};

}  // namespace seg_tree

template <typename Info>
class SimpleSegmentTree {
 public:
  int n;
  vector<Info> infos;
  seg_tree::in_order_layout layout;

  void UpdateNode(seg_tree::point a) {
    infos[a] = infos[a.c(0)].Unite(infos[a.c(1)]);
  }

  SimpleSegmentTree(int n_) : SimpleSegmentTree(vector<Info>(n_)) {}

  SimpleSegmentTree(const vector<Info>& a) : n(int(a.size())) {
    assert(n > 0);
    infos.resize(2 * n);
    layout = seg_tree::in_order_layout(n);
    for (int i = 0; i < n; i++) {
      infos[layout.get_point(i)] = a[i];
    }
    for (int i = n - 1; i >= 1; i--) {
      infos[i] = infos[2 * i].Unite(infos[2 * i + 1]);
    }
  }

  void Set(int p, const Info& v) {
    auto pt = layout.get_point(p);
    infos[pt] = v;
    pt.for_parents_up([&](seg_tree::point a) {
      UpdateNode(a);
    });
  }

  Info Query(int l, int r) {
    auto rng = layout.get_range(l, r);
    Info res;
    rng.for_each_l_to_r([&](seg_tree::point a) {
      res = res.Unite(infos[a]);
    });
    return res;
  }

  Info Get(int p) {
    auto pt = layout.get_point(p);
    return infos[pt];
  }

  template <typename F>
  int MaxRight(int l, F f) {
    auto rng = layout.get_range(l, n);
    int res = n;
    Info sum;
    rng.for_each_l_to_r([&](seg_tree::point a) {
      if (res != n) {
        return;
      }
      auto new_sum = sum.Unite(infos[a]);
      if (f(new_sum)) {
        sum = new_sum;
        return;
      }
      while (a < n) {
        new_sum = sum.Unite(infos[a.c(0)]);
        if (f(new_sum)) {
          sum = new_sum;
          a = a.c(1);
        } else {
          a = a.c(0);
        }
      }
      res = layout.get_node_bounds(a)[0];
    });
    return res;
  }

  template <typename F>
  int MinLeft(int r, F f) {
    auto rng = layout.get_range(0, r);
    int res = 0;
    Info sum;
    rng.for_each_r_to_l([&](seg_tree::point a) {
      if (res != 0) {
        return;
      }
      auto new_sum = infos[a].Unite(sum);
      if (f(new_sum)) {
        sum = new_sum;
        return;
      }
      while (a < n) {
        new_sum = infos[a.c(1)].Unite(sum);
        if (f(new_sum)) {
          sum = new_sum;
          a = a.c(0);
        } else {
          a = a.c(1);
        }
      }
      res = layout.get_node_bounds(a)[1];
    });
    return res;
  }
};

struct Info {
  int mx = 0, cnt = 0;
  ll sum = 0;

  Info Unite(Info b) const {
    Info res;
    res.mx = std::max(mx, b.mx), res.cnt = cnt + b.cnt, res.sum = sum + b.sum;
    return res;
  }

  static Info GetDefault([[maybe_unused]] int l, [[maybe_unused]] int r) {
    return Info();
  }
};

// signed main() {
int main() {
  // freopen(".in", "r",stdin);
  // freopen(".out","w",stdout);
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  std::cin >> n >> m;
  vi a(n), b(m), al;
  for (auto& i : a) std::cin >> i, al.eb(i);
  for (auto& i : b) std::cin >> i, al.eb(i);
  std::sort(all(b), greater());
  b.resize(n, -Big * 2);
  std::sort(all(al));
  al.erase(std::unique(all(al)), al.end());
  int N = sz(al);
  vl sa(n + 1), sb(m + 1);
  for (int i = 0; i < n; i++) sa[i + 1] = sa[i] + a[i], a[i] = lwb(al, a[i]);
  for (int i = 0; i < m; i++) sb[i + 1] = sb[i] + b[i], b[i] = lwb(al, b[i]);

  SimpleSegmentTree<Info> tr(n);

  vi buc(N);
  for (int i = 0; i < n; i++) buc[a[i]]++;
  for (int i = 1; i < N; i++) buc[i] += buc[i - 1];
  buc.insert(buc.begin(), 0), buc.pop_back();
  auto add = [&](int x) {
    tr.Set(buc[x]++, Info{x, 1, al[x]});
  };
  auto del = [&](int x) {
    tr.Set(--buc[x], Info{0, 0, 0});
  };
  int L = 0, R = -1;
  auto div = [&](auto&& div, int l, int r, int pl, int pr) -> ll {
    debug(l, r, pl, pr);
    if (l > r) return -BIG;
    int mid = l + r >> 1;
    while (L > pl) add(a[--L]);
    while (R < std::min(mid, pr)) add(a[++R]);
    while (L < pl) del(a[L++]);
    while (R > std::min(mid, pr)) del(a[R--]);
    ll ans = -BIG;
    int p;
    while (L <= std::min(mid, pr)) {
      int k = tr.MaxRight(0, [&](const Info& x) {
        debug(x.cnt);
        if (x.cnt == 0) return true;
        return x.mx < b[x.cnt - 1];
      });
      auto c = tr.Query(0, k);
      ll ansnow = sa[mid + 1] - sa[L] - c.sum + sb[c.cnt];
      if (ckmax(ans, ansnow)) p = L;
      del(a[L++]);
    }
    return std::max({ans, div(div, l, mid - 1, pl, p), div(div, mid + 1, r, p, pr)});
  };
  std::cout << div(div, 0, n - 1, 0, n - 1);
  return 0;
}

/*

找到最后一个 k 满足 a_k<b_k a从小到大排序 b从大到小排序 满足单调性 线段树二分

注意处理a相等的情况

*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 20
Accepted
time: 1ms
memory: 3720kb

input:

497 404
917535854 939575385 985070918 788445476 990228874 890712076 973415095 975904486 794872088 958037942 894373426 975435251 821587328 898697908 848044776 985486749 977595334 985578214 961966222 967928299 846072308 998679302 989797646 987698522 755351683 893841487 986707387 832412612 973338351 92...

output:

483851132608

result:

ok 1 number(s): "483851132608"

Test #2:

score: 20
Accepted
time: 1ms
memory: 3608kb

input:

496 13
975537796 867824005 731905698 995044734 980663118 979671628 948113905 961691035 916377605 973634815 963676914 968266658 845279779 967647040 977551474 953069751 898164359 800993445 967373577 926295172 961939352 971469513 966783255 983637364 942997390 909279266 924009236 991590090 999500351 997...

output:

464615676533

result:

ok 1 number(s): "464615676533"

Test #3:

score: 20
Accepted
time: 1ms
memory: 3648kb

input:

494 199
926827016 952344126 978952774 984160671 764453527 987217588 966884035 829168774 892004441 970379925 925734206 998053653 983696512 931554802 998190181 975325858 956456983 952308401 845098341 900126151 893590537 890004652 961645284 920444541 812442265 884028508 876051681 993154406 984329290 99...

output:

463658462826

result:

ok 1 number(s): "463658462826"

Test #4:

score: 20
Accepted
time: 1ms
memory: 3684kb

input:

496 435
975646956 814674762 933529180 904994688 992678370 946706784 839906774 902317711 845422273 972194139 813046404 976785034 926131373 974302545 966840750 924436144 999089868 920682206 984450286 892340175 836194192 986242403 984116213 957559067 968849870 990168285 992136115 901729940 991291097 92...

output:

463114056080

result:

ok 1 number(s): "463114056080"

Test #5:

score: 20
Accepted
time: 1ms
memory: 3624kb

input:

497 489
898057732 989350547 954829689 790197266 859303628 983031071 956944099 939660671 949124411 946421616 976130798 981356584 915782576 979122086 904840012 980931407 999980689 967703811 841746659 908116108 923941319 940951715 845271665 973944748 977355661 979677029 882851568 989147339 892312893 99...

output:

468369265315

result:

ok 1 number(s): "468369265315"

Test #6:

score: 20
Accepted
time: 1ms
memory: 3900kb

input:

496 272
726660517 988027147 641363792 893562116 549283098 782136280 899598073 596901908 739451367 873639418 552800606 703209382 900348150 994027130 724992439 912230131 973506276 724878823 952223459 873259274 972970499 404285830 905899171 820178381 955212498 445875007 700057246 902325804 639224576 63...

output:

458091940524

result:

ok 1 number(s): "458091940524"

Test #7:

score: 20
Accepted
time: 1ms
memory: 3912kb

input:

490 223
439120519 836751136 983682873 964431861 636949330 689735411 385164421 987116695 938125692 722862070 205619236 867761402 842681679 767751623 964270927 770725068 517405838 856820462 951312608 819473134 992226812 643047101 967409521 941853731 632454709 695808935 911367302 981984788 916120947 76...

output:

426229223625

result:

ok 1 number(s): "426229223625"

Test #8:

score: 20
Accepted
time: 1ms
memory: 3908kb

input:

481 132
835595156 681662205 991389219 964689424 984331285 622719180 643002953 861572373 452059382 959871719 526907681 510233909 996061844 915035116 861927997 960409110 972413672 820764693 891367410 980338714 887679775 696912724 145341355 863681485 857026243 928884034 571306267 893026670 821828400 72...

output:

407092001521

result:

ok 1 number(s): "407092001521"

Test #9:

score: 20
Accepted
time: 1ms
memory: 3628kb

input:

495 396
792108807 988116882 993430688 646570027 744353493 939746552 764749385 850820381 912542822 905528475 602526359 792011347 719629521 970537265 857896451 731783358 813613412 592113897 916099093 996240514 834276312 845805166 951874573 658126641 851091218 872259565 870073547 776430057 425576801 95...

output:

408031495738

result:

ok 1 number(s): "408031495738"

Test #10:

score: 20
Accepted
time: 1ms
memory: 3616kb

input:

461 247
391372183 695346715 991402090 902646167 775594916 896725173 757297041 646856690 994028068 828803678 910322516 965710977 941604590 886440221 957935863 761236333 669009487 995655163 871361848 977615683 796633010 976776285 816265478 864414212 819773056 388783099 780222345 887743482 857535582 95...

output:

368869407315

result:

ok 1 number(s): "368869407315"

Test #11:

score: 20
Accepted
time: 1ms
memory: 3672kb

input:

487 334
996281271 862464604 622744320 814499773 754628021 851460680 918694626 39285382 650964328 831886931 929713122 578688377 924893457 842180700 748582354 941122642 550959196 750369461 865176891 531329055 557571901 812575496 658603095 337458635 820011582 824870862 586941807 472406148 820075350 864...

output:

453838728864

result:

ok 1 number(s): "453838728864"

Test #12:

score: 20
Accepted
time: 1ms
memory: 3660kb

input:

493 72
907831353 571218453 435958224 943107973 557600940 927246770 880201908 101455028 740762214 814956609 468651801 630674133 575848868 -116604518 628657047 915488065 831931284 787078668 983078731 300536627 721552796 952014617 432770864 165812699 998937307 966960444 915191314 941801284 719412168 77...

output:

355272500499

result:

ok 1 number(s): "355272500499"

Test #13:

score: 20
Accepted
time: 1ms
memory: 3672kb

input:

496 255
998713362 180066866 934188786 786211914 887099152 768935168 928203690 589812295 426156018 292836387 -467893109 447047134 316891941 18356045 -45277721 473671229 987123183 946497643 106990737 -75033507 519450404 928327604 658416390 887127703 -296029611 126420130 946877185 230361952 681073211 1...

output:

312356286990

result:

ok 1 number(s): "312356286990"

Test #14:

score: 20
Accepted
time: 1ms
memory: 3708kb

input:

479 236
-313122148 -426574095 674458385 604324937 591256414 560462865 -621113053 516353462 828266938 -582302937 907236038 954900038 962966676 -215448454 85560851 376227000 -192784574 942773596 -516410153 44326228 237427256 81122647 611042704 986071460 748795250 858284392 716087257 564632850 99167608...

output:

180319805621

result:

ok 1 number(s): "180319805621"

Test #15:

score: 20
Accepted
time: 1ms
memory: 3868kb

input:

457 231
306159981 697396736 877656289 776668303 -240030450 624990360 142298458 764210618 820932501 853942279 626019848 961200573 517128714 394862481 207231691 998003063 487733250 571427117 831892676 655665372 850639673 346775450 411747592 643104720 127294795 934342584 -58923091 402324981 987575927 9...

output:

276008599754

result:

ok 1 number(s): "276008599754"

Test #16:

score: 0
Wrong Answer
time: 1ms
memory: 3612kb

input:

496 6
-933688337 38619567 118597697 125121684 -708544757 -663304796 -889641463 320428847 315063502 -999749701 -988894490 -673635545 -831159616 -654935670 222099837 173112793 180560458 389171870 -281457718 -919789933 -632124252 443134587 -798537127 -586929942 -922568428 -803390902 -159804784 -5091063...

output:

7408605773

result:

wrong answer 1st numbers differ - expected: '8262243011', found: '7408605773'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%