Submission #393486

# Submission time Handle Problem Language Result Execution time Memory
393486 2021-04-23T15:17:40 Z usachevd0 Aliens (IOI16_aliens) C++17
60 / 100
2000 ms 358912 KB
#include <bits/stdc++.h>
#ifndef DEBUG
  #include "aliens.h"
#endif

using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(), (a).end()
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
using ld = long double;
template<typename T1, typename T2> bool chkmin(T1& x, T2 y) {
  return y < x ? (x = y, true) : false;
}
template<typename T1, typename T2> bool chkmax(T1& x, T2 y) {
  return y > x ? (x = y, true) : false;
}
void debug_out() {
  cerr << endl;
}
template<typename T1, typename... T2> void debug_out(T1 A, T2... B) {
  cerr << ' ' << A;
  debug_out(B...);
}
template<typename T> void mdebug_out(T* a, int n) {
  for (int i = 0; i < n; ++i) cerr << a[i];
  cerr << endl;
}
template<typename T> ostream& operator << (ostream& stream, const vector<T>& v) {
  for (auto& x : v) {
    stream << x << ' ';
  }
  return stream;
}
template<typename T1, typename T2> ostream& operator << (ostream& stream, const pair<T1, T2>& p) {
  return stream << p.first << ' ' << p.second;
}

#ifdef DEBUG
  #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
  #define mdebug(a, n) cerr << #a << ": ", mdebug_out(a, n)
#else
  #define debug(...) 1337
  #define mdebug(a, n) 1337
#endif


const ll INF64 = 1e18;
const int maxN = 100005;

ll squared(ll a) {
  return a * a;
}

struct pt {
  int x, y;

  pt(int _x = 0, int _y = 0): x(_x), y(_y) {}

  pt operator + (const pt& p) const { return pt(x + p.x, y + p.y); }
  pt operator - (const pt& p) const { return pt(x - p.x, y - p.y); }
};
ostream& operator << (ostream& stream, const pt& p) {
  return stream << p.x << ' ' << p.y;
}

struct line {
  ll k, b;
  
  line() {}
  line(ll _k, ll _b): k(_k), b(_b) {}
  
  ll y(ll x) {
    return k * x + b;
  }
};
double intersect_x(const line& a, const line& b) {
  return -(a.b - b.b) / (double)(a.k - b.k);
}

namespace cht {
  vector<line> ln;
  vector<double> xl;
  int ptr;

  void init() {
    ln.clear();
    xl.clear();
    ptr = 0;
  }

  void add_line(ll k, ll b) {
    line L(k, b);
    while (!ln.empty()) {
      double x = intersect_x(ln.back(), L);
      if (x <= xl.back()) {
        ln.pop_back();
        xl.pop_back();
      } else {
        break;
      }
    }
    xl.push_back(ln.empty() ? -INF64 : intersect_x(ln.back(), L));
    ln.push_back(L);
  }

  ll gt(ll x) {
    while (ptr + 1 < ln.size() && xl[ptr + 1] <= x) {
      ++ptr;
    }
    return ln[ptr].y(x);
  }
};

ll take_photos(int n, int _m, int K, vector<int> _r, vector<int> _c) {
  vector<pt> points(n);
  for (int i = 0; i < n; ++i) {
    points[i] = {_r[i], _c[i]};
    if (points[i].x > points[i].y) {
      swap(points[i].x, points[i].y);
    }
  }
  sort(all(points), [&](const pt& P, const pt& Q) -> bool {
    if (P.x != Q.x) return P.x < Q.x;
    return P.y > Q.y;
  });
  vector<pt> a;
  for (auto P : points) {
    if (!a.empty() && P.y <= a.back().y) continue;
    while (!a.empty() && P.x == a.back().x) {
      a.pop_back();
    }
    a.push_back(P);
  }
  n = a.size();
  vector<ll> x(n), y(n);
  for (int i = 0; i < n; ++i) {
    x[i] = a[i].x;
    y[i] = a[i].y;
  }

  vector<ll> I(n, 0);
  for (int i = 1; i < n; ++i) {
    if (x[i] > y[i - 1]) {
      I[i] = 0;
    } else {
      I[i] = squared(y[i - 1] - x[i] + 1);
    }
  }

  vector<vector<ll>> dp(n + 1, vector<ll>(K + 1, INF64));
  fill(all(dp[0]), 0);

  for (int k = 1; k <= K; ++k) {
    cht::init();
    for (int i = 1; i <= n; ++i) {
      cht::add_line(-2 * x[i - 1], dp[i - 1][k - 1] + x[i - 1] * x[i - 1] - 2 * x[i - 1] - I[i - 1]);
      dp[i][k] = cht::gt(y[i - 1]) + y[i - 1] * y[i - 1] + 2 * y[i - 1] + 1;
    }
  }
  /*for (int i = 1; i <= n; ++i) {
    for (int k = 1; k <= K; ++k) {
      for (int j = 0; j < i; ++j) {
        chkmin(dp[i][k], dp[j][k - 1] + squared(y[i - 1] - x[j] + 1) - I[j]);
      }
    }
  }*/
  return dp[n][K];
}

#ifdef DEBUG
int32_t main() {
#ifdef DEBUG
  freopen("in", "r", stdin);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);

  int n, m, k;
  cin >> n >> m >> k;
  vector<int> r(n), c(n);
  for (int i = 0; i < n; ++i) cin >> r[i] >> c[i];
  cout << take_photos(n, m, k, r, c) << '\n';

  return 0;
}
#endif

Compilation message

aliens.cpp: In function 'll cht::gt(ll)':
aliens.cpp:116:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<line>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  116 |     while (ptr + 1 < ln.size() && xl[ptr + 1] <= x) {
      |            ~~~~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 208 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 1
2 Correct 0 ms 204 KB Correct answer: answer = 4
3 Correct 1 ms 204 KB Correct answer: answer = 1
4 Correct 0 ms 204 KB Correct answer: answer = 5
5 Correct 1 ms 204 KB Correct answer: answer = 41
6 Correct 1 ms 204 KB Correct answer: answer = 71923
7 Correct 1 ms 332 KB Correct answer: answer = 77137
8 Correct 3 ms 1100 KB Correct answer: answer = 764
9 Correct 1 ms 332 KB Correct answer: answer = 250000
10 Correct 6 ms 2252 KB Correct answer: answer = 500
11 Correct 1 ms 204 KB Correct answer: answer = 32
12 Correct 1 ms 332 KB Correct answer: answer = 130050
13 Correct 1 ms 460 KB Correct answer: answer = 5110
14 Correct 1 ms 332 KB Correct answer: answer = 2626
15 Correct 1 ms 460 KB Correct answer: answer = 796
16 Correct 1 ms 460 KB Correct answer: answer = 7580
17 Correct 2 ms 844 KB Correct answer: answer = 1904
18 Correct 1 ms 332 KB Correct answer: answer = 996004
19 Correct 1 ms 332 KB Correct answer: answer = 38817
20 Correct 2 ms 592 KB Correct answer: answer = 4096
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 1 ms 204 KB Correct answer: answer = 1
23 Correct 2 ms 792 KB Correct answer: answer = 2040
24 Correct 1 ms 204 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 208 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 332 KB Correct answer: answer = 77137
28 Correct 3 ms 1100 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 6 ms 2252 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 460 KB Correct answer: answer = 5110
34 Correct 1 ms 332 KB Correct answer: answer = 2626
35 Correct 1 ms 460 KB Correct answer: answer = 796
36 Correct 1 ms 460 KB Correct answer: answer = 7580
37 Correct 2 ms 844 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 592 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 792 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 208 KB Correct answer: answer = 77
51 Correct 1 ms 204 KB Correct answer: answer = 400
52 Correct 1 ms 208 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 2 ms 716 KB Correct answer: answer = 752500
61 Correct 1 ms 332 KB Correct answer: answer = 761480
62 Correct 2 ms 588 KB Correct answer: answer = 758932
63 Correct 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 6 ms 2324 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 208 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 332 KB Correct answer: answer = 59315
71 Correct 1 ms 460 KB Correct answer: answer = 25454
72 Correct 2 ms 588 KB Correct answer: answer = 1504
73 Correct 1 ms 208 KB Correct answer: answer = 37486
74 Correct 1 ms 460 KB Correct answer: answer = 4284
75 Correct 1 ms 440 KB Correct answer: answer = 158008
76 Correct 1 ms 332 KB Correct answer: answer = 51860
77 Correct 1 ms 332 KB Correct answer: answer = 12985
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 208 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 332 KB Correct answer: answer = 77137
28 Correct 3 ms 1100 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 6 ms 2252 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 460 KB Correct answer: answer = 5110
34 Correct 1 ms 332 KB Correct answer: answer = 2626
35 Correct 1 ms 460 KB Correct answer: answer = 796
36 Correct 1 ms 460 KB Correct answer: answer = 7580
37 Correct 2 ms 844 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 592 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 792 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 208 KB Correct answer: answer = 77
51 Correct 1 ms 204 KB Correct answer: answer = 400
52 Correct 1 ms 208 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 2 ms 716 KB Correct answer: answer = 752500
61 Correct 1 ms 332 KB Correct answer: answer = 761480
62 Correct 2 ms 588 KB Correct answer: answer = 758932
63 Correct 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 6 ms 2324 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 208 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 332 KB Correct answer: answer = 59315
71 Correct 1 ms 460 KB Correct answer: answer = 25454
72 Correct 2 ms 588 KB Correct answer: answer = 1504
73 Correct 1 ms 208 KB Correct answer: answer = 37486
74 Correct 1 ms 460 KB Correct answer: answer = 4284
75 Correct 1 ms 440 KB Correct answer: answer = 158008
76 Correct 1 ms 332 KB Correct answer: answer = 51860
77 Correct 1 ms 332 KB Correct answer: answer = 12985
78 Correct 2 ms 332 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 3 ms 716 KB Correct answer: answer = 995265560477
81 Correct 2 ms 844 KB Correct answer: answer = 10125000
82 Correct 3 ms 972 KB Correct answer: answer = 2291668
83 Correct 6 ms 2124 KB Correct answer: answer = 42388
84 Correct 20 ms 6988 KB Correct answer: answer = 10318
85 Correct 136 ms 22348 KB Correct answer: answer = 3416
86 Correct 3 ms 844 KB Correct answer: answer = 331708193881
87 Correct 40 ms 8080 KB Correct answer: answer = 2861193756
88 Correct 293 ms 42488 KB Correct answer: answer = 114646930
89 Correct 7 ms 2508 KB Correct answer: answer = 9280921
90 Correct 29 ms 10188 KB Correct answer: answer = 999984053400
91 Correct 140 ms 31884 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 464 KB Correct answer: answer = 998762383161
94 Correct 8 ms 1868 KB Correct answer: answer = 23017412908
95 Correct 4 ms 972 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 3 ms 1100 KB Correct answer: answer = 1824916
98 Correct 56 ms 16836 KB Correct answer: answer = 10680029
99 Correct 29 ms 8868 KB Correct answer: answer = 18351700
100 Correct 2 ms 844 KB Correct answer: answer = 16040026
101 Correct 2 ms 368 KB Correct answer: answer = 253968628325
102 Correct 62 ms 16208 KB Correct answer: answer = 10267
103 Correct 377 ms 55944 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 432 KB Correct answer: answer = 9866346457
106 Correct 3 ms 852 KB Correct answer: answer = 3327720949
107 Correct 12 ms 4140 KB Correct answer: answer = 86064128360
108 Correct 55 ms 17684 KB Correct answer: answer = 12698259150
109 Correct 437 ms 63080 KB Correct answer: answer = 1185259288
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 208 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 332 KB Correct answer: answer = 77137
28 Correct 3 ms 1100 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 6 ms 2252 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 460 KB Correct answer: answer = 5110
34 Correct 1 ms 332 KB Correct answer: answer = 2626
35 Correct 1 ms 460 KB Correct answer: answer = 796
36 Correct 1 ms 460 KB Correct answer: answer = 7580
37 Correct 2 ms 844 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 592 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 792 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 208 KB Correct answer: answer = 77
51 Correct 1 ms 204 KB Correct answer: answer = 400
52 Correct 1 ms 208 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 2 ms 716 KB Correct answer: answer = 752500
61 Correct 1 ms 332 KB Correct answer: answer = 761480
62 Correct 2 ms 588 KB Correct answer: answer = 758932
63 Correct 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 6 ms 2324 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 208 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 332 KB Correct answer: answer = 59315
71 Correct 1 ms 460 KB Correct answer: answer = 25454
72 Correct 2 ms 588 KB Correct answer: answer = 1504
73 Correct 1 ms 208 KB Correct answer: answer = 37486
74 Correct 1 ms 460 KB Correct answer: answer = 4284
75 Correct 1 ms 440 KB Correct answer: answer = 158008
76 Correct 1 ms 332 KB Correct answer: answer = 51860
77 Correct 1 ms 332 KB Correct answer: answer = 12985
78 Correct 2 ms 332 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 3 ms 716 KB Correct answer: answer = 995265560477
81 Correct 2 ms 844 KB Correct answer: answer = 10125000
82 Correct 3 ms 972 KB Correct answer: answer = 2291668
83 Correct 6 ms 2124 KB Correct answer: answer = 42388
84 Correct 20 ms 6988 KB Correct answer: answer = 10318
85 Correct 136 ms 22348 KB Correct answer: answer = 3416
86 Correct 3 ms 844 KB Correct answer: answer = 331708193881
87 Correct 40 ms 8080 KB Correct answer: answer = 2861193756
88 Correct 293 ms 42488 KB Correct answer: answer = 114646930
89 Correct 7 ms 2508 KB Correct answer: answer = 9280921
90 Correct 29 ms 10188 KB Correct answer: answer = 999984053400
91 Correct 140 ms 31884 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 464 KB Correct answer: answer = 998762383161
94 Correct 8 ms 1868 KB Correct answer: answer = 23017412908
95 Correct 4 ms 972 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 3 ms 1100 KB Correct answer: answer = 1824916
98 Correct 56 ms 16836 KB Correct answer: answer = 10680029
99 Correct 29 ms 8868 KB Correct answer: answer = 18351700
100 Correct 2 ms 844 KB Correct answer: answer = 16040026
101 Correct 2 ms 368 KB Correct answer: answer = 253968628325
102 Correct 62 ms 16208 KB Correct answer: answer = 10267
103 Correct 377 ms 55944 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 432 KB Correct answer: answer = 9866346457
106 Correct 3 ms 852 KB Correct answer: answer = 3327720949
107 Correct 12 ms 4140 KB Correct answer: answer = 86064128360
108 Correct 55 ms 17684 KB Correct answer: answer = 12698259150
109 Correct 437 ms 63080 KB Correct answer: answer = 1185259288
110 Correct 22 ms 2080 KB Correct answer: answer = 999889968863
111 Correct 17 ms 2084 KB Correct answer: answer = 999861384931
112 Correct 17 ms 2076 KB Correct answer: answer = 999811809929
113 Correct 17 ms 2160 KB Correct answer: answer = 999869756441
114 Correct 25 ms 8124 KB Correct answer: answer = 1700000000
115 Correct 46 ms 15276 KB Correct answer: answer = 131666670
116 Correct 8 ms 2936 KB Correct answer: answer = 89478486
117 Correct 27 ms 9420 KB Correct answer: answer = 4971040
118 Correct 41 ms 15352 KB Correct answer: answer = 2711494
119 Correct 169 ms 46580 KB Correct answer: answer = 25252530
120 Correct 83 ms 23032 KB Correct answer: answer = 62500000
121 Correct 27 ms 7128 KB Correct answer: answer = 333175097780
122 Correct 84 ms 17132 KB Correct answer: answer = 33121180179
123 Correct 192 ms 43912 KB Correct answer: answer = 9802314015
124 Correct 140 ms 37980 KB Correct answer: answer = 32567551
125 Correct 157 ms 46588 KB Correct answer: answer = 997525000000
126 Correct 179 ms 41020 KB Correct answer: answer = 752723538884
127 Correct 14 ms 2068 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 2124 KB Correct answer: answer = 999978000121
129 Correct 18 ms 2336 KB Correct answer: answer = 745986144735
130 Correct 11 ms 1676 KB Correct answer: answer = 2
131 Correct 35 ms 11288 KB Correct answer: answer = 277966670
132 Correct 25 ms 8188 KB Correct answer: answer = 2500900082
133 Correct 18 ms 2616 KB Correct answer: answer = 301248349636
134 Correct 96 ms 22956 KB Correct answer: answer = 14118891
135 Correct 18 ms 2124 KB Correct answer: answer = 14384977265
136 Correct 19 ms 2212 KB Correct answer: answer = 3681368330
137 Correct 20 ms 2724 KB Correct answer: answer = 2720316816
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Correct answer: answer = 4
2 Correct 1 ms 204 KB Correct answer: answer = 4
3 Correct 0 ms 204 KB Correct answer: answer = 4
4 Correct 1 ms 204 KB Correct answer: answer = 12
5 Correct 1 ms 204 KB Correct answer: answer = 52
6 Correct 1 ms 204 KB Correct answer: answer = 210
7 Correct 1 ms 204 KB Correct answer: answer = 88
8 Correct 1 ms 208 KB Correct answer: answer = 7696
9 Correct 1 ms 204 KB Correct answer: answer = 1
10 Correct 1 ms 204 KB Correct answer: answer = 2374
11 Correct 1 ms 204 KB Correct answer: answer = 9502
12 Correct 1 ms 204 KB Correct answer: answer = 49
13 Correct 1 ms 204 KB Correct answer: answer = 151
14 Correct 1 ms 204 KB Correct answer: answer = 7550
15 Correct 1 ms 204 KB Correct answer: answer = 7220
16 Correct 1 ms 204 KB Correct answer: answer = 7550
17 Correct 1 ms 204 KB Correct answer: answer = 10000
18 Correct 1 ms 204 KB Correct answer: answer = 10000
19 Correct 1 ms 204 KB Correct answer: answer = 624
20 Correct 1 ms 204 KB Correct answer: answer = 10000
21 Correct 1 ms 204 KB Correct answer: answer = 1
22 Correct 0 ms 204 KB Correct answer: answer = 4
23 Correct 1 ms 204 KB Correct answer: answer = 1
24 Correct 0 ms 204 KB Correct answer: answer = 5
25 Correct 1 ms 204 KB Correct answer: answer = 41
26 Correct 1 ms 204 KB Correct answer: answer = 71923
27 Correct 1 ms 332 KB Correct answer: answer = 77137
28 Correct 3 ms 1100 KB Correct answer: answer = 764
29 Correct 1 ms 332 KB Correct answer: answer = 250000
30 Correct 6 ms 2252 KB Correct answer: answer = 500
31 Correct 1 ms 204 KB Correct answer: answer = 32
32 Correct 1 ms 332 KB Correct answer: answer = 130050
33 Correct 1 ms 460 KB Correct answer: answer = 5110
34 Correct 1 ms 332 KB Correct answer: answer = 2626
35 Correct 1 ms 460 KB Correct answer: answer = 796
36 Correct 1 ms 460 KB Correct answer: answer = 7580
37 Correct 2 ms 844 KB Correct answer: answer = 1904
38 Correct 1 ms 332 KB Correct answer: answer = 996004
39 Correct 1 ms 332 KB Correct answer: answer = 38817
40 Correct 2 ms 592 KB Correct answer: answer = 4096
41 Correct 1 ms 204 KB Correct answer: answer = 1
42 Correct 1 ms 204 KB Correct answer: answer = 1
43 Correct 2 ms 792 KB Correct answer: answer = 2040
44 Correct 1 ms 204 KB Correct answer: answer = 2
45 Correct 1 ms 204 KB Correct answer: answer = 4
46 Correct 1 ms 204 KB Correct answer: answer = 9
47 Correct 1 ms 204 KB Correct answer: answer = 9
48 Correct 1 ms 204 KB Correct answer: answer = 21
49 Correct 1 ms 204 KB Correct answer: answer = 71
50 Correct 1 ms 208 KB Correct answer: answer = 77
51 Correct 1 ms 204 KB Correct answer: answer = 400
52 Correct 1 ms 208 KB Correct answer: answer = 996004
53 Correct 1 ms 204 KB Correct answer: answer = 997310
54 Correct 1 ms 204 KB Correct answer: answer = 990781
55 Correct 1 ms 204 KB Correct answer: answer = 996545
56 Correct 1 ms 204 KB Correct answer: answer = 484
57 Correct 1 ms 204 KB Correct answer: answer = 484
58 Correct 1 ms 332 KB Correct answer: answer = 63501
59 Correct 1 ms 332 KB Correct answer: answer = 323501
60 Correct 2 ms 716 KB Correct answer: answer = 752500
61 Correct 1 ms 332 KB Correct answer: answer = 761480
62 Correct 2 ms 588 KB Correct answer: answer = 758932
63 Correct 1 ms 204 KB Correct answer: answer = 1000000
64 Correct 6 ms 2324 KB Correct answer: answer = 750500
65 Correct 1 ms 204 KB Correct answer: answer = 1000000
66 Correct 1 ms 208 KB Correct answer: answer = 250000
67 Correct 1 ms 204 KB Correct answer: answer = 250000
68 Correct 1 ms 204 KB Correct answer: answer = 1000000
69 Correct 1 ms 204 KB Correct answer: answer = 994009
70 Correct 1 ms 332 KB Correct answer: answer = 59315
71 Correct 1 ms 460 KB Correct answer: answer = 25454
72 Correct 2 ms 588 KB Correct answer: answer = 1504
73 Correct 1 ms 208 KB Correct answer: answer = 37486
74 Correct 1 ms 460 KB Correct answer: answer = 4284
75 Correct 1 ms 440 KB Correct answer: answer = 158008
76 Correct 1 ms 332 KB Correct answer: answer = 51860
77 Correct 1 ms 332 KB Correct answer: answer = 12985
78 Correct 2 ms 332 KB Correct answer: answer = 997864126212
79 Correct 2 ms 332 KB Correct answer: answer = 998608411647
80 Correct 3 ms 716 KB Correct answer: answer = 995265560477
81 Correct 2 ms 844 KB Correct answer: answer = 10125000
82 Correct 3 ms 972 KB Correct answer: answer = 2291668
83 Correct 6 ms 2124 KB Correct answer: answer = 42388
84 Correct 20 ms 6988 KB Correct answer: answer = 10318
85 Correct 136 ms 22348 KB Correct answer: answer = 3416
86 Correct 3 ms 844 KB Correct answer: answer = 331708193881
87 Correct 40 ms 8080 KB Correct answer: answer = 2861193756
88 Correct 293 ms 42488 KB Correct answer: answer = 114646930
89 Correct 7 ms 2508 KB Correct answer: answer = 9280921
90 Correct 29 ms 10188 KB Correct answer: answer = 999984053400
91 Correct 140 ms 31884 KB Correct answer: answer = 750935949134
92 Correct 2 ms 332 KB Correct answer: answer = 1000000000000
93 Correct 2 ms 464 KB Correct answer: answer = 998762383161
94 Correct 8 ms 1868 KB Correct answer: answer = 23017412908
95 Correct 4 ms 972 KB Correct answer: answer = 728143410622
96 Correct 1 ms 332 KB Correct answer: answer = 2
97 Correct 3 ms 1100 KB Correct answer: answer = 1824916
98 Correct 56 ms 16836 KB Correct answer: answer = 10680029
99 Correct 29 ms 8868 KB Correct answer: answer = 18351700
100 Correct 2 ms 844 KB Correct answer: answer = 16040026
101 Correct 2 ms 368 KB Correct answer: answer = 253968628325
102 Correct 62 ms 16208 KB Correct answer: answer = 10267
103 Correct 377 ms 55944 KB Correct answer: answer = 2582408
104 Correct 3 ms 332 KB Correct answer: answer = 78024964781
105 Correct 2 ms 432 KB Correct answer: answer = 9866346457
106 Correct 3 ms 852 KB Correct answer: answer = 3327720949
107 Correct 12 ms 4140 KB Correct answer: answer = 86064128360
108 Correct 55 ms 17684 KB Correct answer: answer = 12698259150
109 Correct 437 ms 63080 KB Correct answer: answer = 1185259288
110 Correct 22 ms 2080 KB Correct answer: answer = 999889968863
111 Correct 17 ms 2084 KB Correct answer: answer = 999861384931
112 Correct 17 ms 2076 KB Correct answer: answer = 999811809929
113 Correct 17 ms 2160 KB Correct answer: answer = 999869756441
114 Correct 25 ms 8124 KB Correct answer: answer = 1700000000
115 Correct 46 ms 15276 KB Correct answer: answer = 131666670
116 Correct 8 ms 2936 KB Correct answer: answer = 89478486
117 Correct 27 ms 9420 KB Correct answer: answer = 4971040
118 Correct 41 ms 15352 KB Correct answer: answer = 2711494
119 Correct 169 ms 46580 KB Correct answer: answer = 25252530
120 Correct 83 ms 23032 KB Correct answer: answer = 62500000
121 Correct 27 ms 7128 KB Correct answer: answer = 333175097780
122 Correct 84 ms 17132 KB Correct answer: answer = 33121180179
123 Correct 192 ms 43912 KB Correct answer: answer = 9802314015
124 Correct 140 ms 37980 KB Correct answer: answer = 32567551
125 Correct 157 ms 46588 KB Correct answer: answer = 997525000000
126 Correct 179 ms 41020 KB Correct answer: answer = 752723538884
127 Correct 14 ms 2068 KB Correct answer: answer = 1000000000000
128 Correct 17 ms 2124 KB Correct answer: answer = 999978000121
129 Correct 18 ms 2336 KB Correct answer: answer = 745986144735
130 Correct 11 ms 1676 KB Correct answer: answer = 2
131 Correct 35 ms 11288 KB Correct answer: answer = 277966670
132 Correct 25 ms 8188 KB Correct answer: answer = 2500900082
133 Correct 18 ms 2616 KB Correct answer: answer = 301248349636
134 Correct 96 ms 22956 KB Correct answer: answer = 14118891
135 Correct 18 ms 2124 KB Correct answer: answer = 14384977265
136 Correct 19 ms 2212 KB Correct answer: answer = 3681368330
137 Correct 20 ms 2724 KB Correct answer: answer = 2720316816
138 Correct 35 ms 3632 KB Correct answer: answer = 999976000144
139 Correct 34 ms 3620 KB Correct answer: answer = 999856102410
140 Correct 34 ms 3644 KB Correct answer: answer = 999958401531
141 Correct 36 ms 4288 KB Correct answer: answer = 999769649944
142 Correct 53 ms 10280 KB Correct answer: answer = 999874525918
143 Correct 50 ms 15176 KB Correct answer: answer = 6050000000
144 Correct 67 ms 21432 KB Correct answer: answer = 1112500000
145 Correct 25 ms 8224 KB Correct answer: answer = 4294967296
146 Correct 125 ms 34772 KB Correct answer: answer = 87652406
147 Execution timed out 2095 ms 358912 KB Time limit exceeded
148 Halted 0 ms 0 KB -