Submission #203040

# Submission time Handle Problem Language Result Execution time Memory
203040 2020-02-19T04:29:46 Z galen_colin Dreaming (IOI13_dreaming) C++14
100 / 100
317 ms 39200 KB
#include <bits/stdc++.h>
#include <chrono> 
 
using namespace std;
using namespace std::chrono; 
 
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
// #pragma optimization_level 3
// #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define f0r(a, b) for (long long a = 0; a < (b); a++)
#define f1r(a, b, c) for (long long a = (b); a < (c); a++)
#define f0rd(a, b) for (long long a = (b); a >= 0; a--)
#define f1rd(a, b, c) for (long long a = (b); a >= (c); a--)
#define ms(arr, v) memset(arr, v, sizeof(arr))
#define pb push_back
#define io {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
#define mp make_pair
#define f first
#define s second
#define presum(p, a, n) {p[0] = a[0]; for (int i = 1; i < (n); i++) p[i] = a[i] + p[i-1];}
#define all(v) v.begin(), v.end()
#define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());}
#define readgraph(list, edges) for (int i = 0; i < edges; i++) {int a, b; cin >> a >> b; a--; b--; list[a].pb(b); list[b].pb(a);}
#define ai(a, n) for (int ele = 0; ele < n; ele++) cin >> a[ele];
#define ain(a, lb, rb) for (int ele = lb; ele <= rb; ele++) cin >> a[ele];
#define ao(a, n) {for (int ele = 0; ele < n; ele++) { if (ele) cout << " "; cout << a[ele]; } cout << '\n';}
#define aout(a, lb, rb) {for (int ele = lb; ele <= rb; ele++) { if (ele > lb) cout << " "; cout << a[ele]; } cout << '\n';}
typedef long long ll;
typedef double ld;
typedef long double lld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
 
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v);
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.f << ", " << p.s << ")"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) {
  cout << "["; for(int i = 0; i < v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";
}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) {
  cin >> p.first;
  return cin >> p.second;
}
 
// template<typename A, typename B> ll max(A x, B y) {
//   return x > y ? x : y;
// }
// template<typename A, typename B> ll min(A x, B y) {
//   return x < y ? x : y;
// }
 
mt19937 rng(steady_clock::now().time_since_epoch().count());
/* usage - just do rng() */
 
void usaco(string filename) {
  // #pragma message("be careful, freopen may be wrong")
	freopen((filename + ".in").c_str(), "r", stdin);
	freopen((filename + ".out").c_str(), "w", stdout);
}
 
const lld pi = 3.14159265358979323846;
const ll mod = 1000000007;
// const ll mod = 998244353;

template <typename num_t> 
struct segtree {
  int n, depth;
  vector<num_t> tree, lazy;

  void init(int s, long long* arr) {
    n = s;
    tree = vector<num_t>(4 * s, 0);
    lazy = vector<num_t>(4 * s, 0);
    init(0, 0, n - 1, arr);
  }

  num_t init(int i, int l, int r, long long* arr) {
    if (l == r) return tree[i] = arr[l];

    int mid = (l + r) / 2;
    num_t a = init(2 * i + 1, l, mid, arr),
          b = init(2 * i + 2, mid + 1, r, arr);
    return tree[i] = a.op(b);
  }

  void update(int l, int r, num_t v) {
	if (l > r) return;
    update(0, 0, n - 1, l, r, v);
  }

  num_t update(int i, int tl, int tr, int ql, int qr, num_t v) {
    eval_lazy(i, tl, tr);
	
	if (tl > tr || tr < ql || qr < tl) return tree[i];
    if (ql <= tl && tr <= qr) {
      lazy[i] = lazy[i].val + v.val;
      eval_lazy(i, tl, tr);
      return tree[i];
    }
    
    if (tl == tr) return tree[i];

    int mid = (tl + tr) / 2;
    num_t a = update(2 * i + 1, tl, mid, ql, qr, v),
          b = update(2 * i + 2, mid + 1, tr, ql, qr, v);
    return tree[i] = a.op(b);
  }

  num_t query(int l, int r) {
	if (l > r) return num_t::null_v;
    return query(0, 0, n-1, l, r);
  }

  num_t query(int i, int tl, int tr, int ql, int qr) {
    eval_lazy(i, tl, tr);
    
    if (ql <= tl && tr <= qr) return tree[i];
    if (tl > tr || tr < ql || qr < tl) return num_t::null_v;

    int mid = (tl + tr) / 2;
    num_t a = query(2 * i + 1, tl, mid, ql, qr),
          b = query(2 * i + 2, mid + 1, tr, ql, qr);
    return a.op(b);
  }

  void eval_lazy(int i, int l, int r) {
    tree[i] = tree[i].lazy_op(lazy[i], (r - l + 1));
    if (l != r) {
      lazy[i * 2 + 1] = lazy[i].val + lazy[i * 2 + 1].val;
      lazy[i * 2 + 2] = lazy[i].val + lazy[i * 2 + 2].val;
    }

    lazy[i] = num_t();
  }
};

struct max_t {
  long long val;
  static const long long null_v = -9223372036854775807LL;

  max_t(): val(0) {}
  max_t(long long v): val(v) {}

  max_t op(max_t& other) {
    return max_t(max(val, other.val));
  }
  
  max_t lazy_op(max_t v, int size) {
    return max_t(val + v.val);
  }
};

// int travelTime(int n, int m, int l, int a[], int b[], int t[]);

// int main() {
//   usaco("file");
//   int n, m, l;
//   cin >> n >> m >> l;
//   int a[m], b[m], t[m];
//   f0r(i, m) cin >> a[i] >> b[i] >> t[i];
//   int x = travelTime(n,m,l,a,b,t);
//   cout << x << endl;
//   // int n = 3;
//   // int m = 2;
//   // int l = 5;
//   // int a[2] = {0, 1};
//   // int b[2] = {1, 2};
//   // int t[2] = {3, 3};
//   // int x = travelTime(n, m, l, a, b, t);
//   // cout << x << endl;
// }

#include "dreaming.h"
 
ll n, m, k, q, Q, T, l, r, x, y, z;
ll a[1000005];
ll b[1000005];
ll c[1000005];
string s, t;
ll ans = 0;

vl tdists;
vpi edges[100005];
bool vis[100005];
int mk[100005];
int ngroup = 0;
ll mx[100005];
vi cont[100005];

void mark(int x) {
  if (vis[x]) return;
  vis[x] = 1;
  mk[x] = ngroup;
  cont[ngroup].pb(x);

  for (pii y: edges[x]) mark(y.f);
}

ll mn;

segtree<max_t> sm;

int st[100005], en[100005];
int tim = 0;
void pre(int x, int p) {
  st[x] = tim++;
  for (pii y: edges[x]) if (y.f != p) pre(y.f, x);
  en[x] = tim - 1;
}

void dfs(int x, int p, int d) {
  sm.update(st[x], st[x], d);

  for (pii y: edges[x]) if (y.f != p) dfs(y.f, x, d + y.s);
}

void comp(int x, int p) {
  ll v = sm.query(0, tim - 1).val;
  ans = max(ans, v);
  mn = min(mn, v);

  // cout << x << " " << st[x] << " " << en[x] << endl;
  // f0r(i, tim) cout << sm.query(i, i).val << " ";
  // cout << endl;

  for (pii y: edges[x]) if (y.f != p) {
    sm.update(0, tim - 1, y.s);
    sm.update(st[y.f], en[y.f], -2 * y.s);
    comp(y.f, x);
    sm.update(st[y.f], en[y.f], 2 * y.s);
    sm.update(0, tim - 1, -y.s);
  }
}

void gdist(int x) {
  vis[mk[x]] = 1;

  mn = mod;

  tim = 0;
  pre(x, -1);

  sm.init(tim, c);

  dfs(x, -1, 0);

  comp(x, -1);

  mx[mk[x]] = mn;
}

int travelTime(int n, int m, int l, int a[], int b[], int t[]) {
  ms(c, 0);
  f0r(i, m) {
    edges[a[i]].pb(mp(b[i], t[i]));
    edges[b[i]].pb(mp(a[i], t[i]));
  }
  
  f0r(i, n) mk[i] = -1;
  ms(vis, 0);
  f0r(i, n) {
    if (!vis[i]) {
      mark(i);
      ++ngroup;
    }
  }

  ms(vis, 0);
  f0r(i, ngroup) mx[i] = mod;
  f0r(i, n) if (!vis[mk[i]]) {
    gdist(i);
  }

  f0r(i, ngroup) tdists.pb(mx[i]);
  sort(all(tdists));
  reverse(all(tdists));
  if (tdists.size() == 2) ans = max(ans, tdists[0] + tdists[1] + l);
  else if (tdists.size() > 2) {
    ans = max(ans, tdists[0] + tdists[1] + l);
    ans = max(ans, tdists[1] + tdists[2] + 2 * l);
  }

  return ans;
}

// int main() {
//   io;
//   // freopen("case", "r", stdin);
//   // freopen("test.txt", "r", stdin);
//   // freopen("case", "w", stdout);
//   // freopen("file.in", "r", stdin);
 
//   // usaco("file");
 
  
// } 

Compilation message

dreaming.cpp: In function 'void usaco(std::__cxx11::string)':
dreaming.cpp:65:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen((filename + ".in").c_str(), "r", stdin);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dreaming.cpp:66:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen((filename + ".out").c_str(), "w", stdout);
  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 246 ms 30712 KB Output is correct
2 Correct 214 ms 31220 KB Output is correct
3 Correct 164 ms 27764 KB Output is correct
4 Correct 36 ms 15736 KB Output is correct
5 Correct 28 ms 14584 KB Output is correct
6 Correct 55 ms 17272 KB Output is correct
7 Correct 13 ms 13048 KB Output is correct
8 Correct 98 ms 19996 KB Output is correct
9 Correct 115 ms 24444 KB Output is correct
10 Correct 13 ms 13176 KB Output is correct
11 Correct 193 ms 26232 KB Output is correct
12 Correct 217 ms 28780 KB Output is correct
13 Correct 13 ms 13136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 30712 KB Output is correct
2 Correct 214 ms 31220 KB Output is correct
3 Correct 164 ms 27764 KB Output is correct
4 Correct 36 ms 15736 KB Output is correct
5 Correct 28 ms 14584 KB Output is correct
6 Correct 55 ms 17272 KB Output is correct
7 Correct 13 ms 13048 KB Output is correct
8 Correct 98 ms 19996 KB Output is correct
9 Correct 115 ms 24444 KB Output is correct
10 Correct 13 ms 13176 KB Output is correct
11 Correct 193 ms 26232 KB Output is correct
12 Correct 217 ms 28780 KB Output is correct
13 Correct 13 ms 13136 KB Output is correct
14 Correct 13 ms 12920 KB Output is correct
15 Correct 12 ms 13052 KB Output is correct
16 Correct 12 ms 12920 KB Output is correct
17 Correct 13 ms 13024 KB Output is correct
18 Correct 12 ms 12920 KB Output is correct
19 Correct 13 ms 13048 KB Output is correct
20 Correct 13 ms 13048 KB Output is correct
21 Correct 12 ms 13048 KB Output is correct
22 Correct 13 ms 12920 KB Output is correct
23 Correct 13 ms 12920 KB Output is correct
24 Correct 13 ms 12920 KB Output is correct
25 Correct 12 ms 12920 KB Output is correct
26 Correct 14 ms 13048 KB Output is correct
27 Correct 13 ms 12920 KB Output is correct
28 Correct 13 ms 12920 KB Output is correct
29 Correct 13 ms 13048 KB Output is correct
30 Correct 12 ms 12920 KB Output is correct
31 Correct 13 ms 12920 KB Output is correct
32 Correct 12 ms 12920 KB Output is correct
33 Correct 14 ms 12920 KB Output is correct
34 Correct 14 ms 13180 KB Output is correct
35 Correct 12 ms 13048 KB Output is correct
36 Correct 13 ms 12920 KB Output is correct
37 Correct 13 ms 12920 KB Output is correct
38 Correct 13 ms 13048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 30712 KB Output is correct
2 Correct 214 ms 31220 KB Output is correct
3 Correct 164 ms 27764 KB Output is correct
4 Correct 36 ms 15736 KB Output is correct
5 Correct 28 ms 14584 KB Output is correct
6 Correct 55 ms 17272 KB Output is correct
7 Correct 13 ms 13048 KB Output is correct
8 Correct 98 ms 19996 KB Output is correct
9 Correct 115 ms 24444 KB Output is correct
10 Correct 13 ms 13176 KB Output is correct
11 Correct 193 ms 26232 KB Output is correct
12 Correct 217 ms 28780 KB Output is correct
13 Correct 13 ms 13136 KB Output is correct
14 Correct 13 ms 12920 KB Output is correct
15 Correct 12 ms 13052 KB Output is correct
16 Correct 12 ms 12920 KB Output is correct
17 Correct 13 ms 13024 KB Output is correct
18 Correct 12 ms 12920 KB Output is correct
19 Correct 13 ms 13048 KB Output is correct
20 Correct 13 ms 13048 KB Output is correct
21 Correct 12 ms 13048 KB Output is correct
22 Correct 13 ms 12920 KB Output is correct
23 Correct 13 ms 12920 KB Output is correct
24 Correct 13 ms 12920 KB Output is correct
25 Correct 12 ms 12920 KB Output is correct
26 Correct 14 ms 13048 KB Output is correct
27 Correct 13 ms 12920 KB Output is correct
28 Correct 13 ms 12920 KB Output is correct
29 Correct 13 ms 13048 KB Output is correct
30 Correct 12 ms 12920 KB Output is correct
31 Correct 13 ms 12920 KB Output is correct
32 Correct 12 ms 12920 KB Output is correct
33 Correct 14 ms 12920 KB Output is correct
34 Correct 14 ms 13180 KB Output is correct
35 Correct 12 ms 13048 KB Output is correct
36 Correct 13 ms 12920 KB Output is correct
37 Correct 13 ms 12920 KB Output is correct
38 Correct 13 ms 13048 KB Output is correct
39 Correct 227 ms 31708 KB Output is correct
40 Correct 238 ms 31372 KB Output is correct
41 Correct 160 ms 27764 KB Output is correct
42 Correct 37 ms 15736 KB Output is correct
43 Correct 13 ms 12920 KB Output is correct
44 Correct 14 ms 13048 KB Output is correct
45 Correct 13 ms 13048 KB Output is correct
46 Correct 13 ms 12920 KB Output is correct
47 Correct 12 ms 13048 KB Output is correct
48 Correct 13 ms 12920 KB Output is correct
49 Correct 13 ms 12920 KB Output is correct
50 Correct 13 ms 12920 KB Output is correct
51 Correct 12 ms 13048 KB Output is correct
52 Correct 13 ms 13048 KB Output is correct
53 Correct 12 ms 13048 KB Output is correct
54 Correct 13 ms 12920 KB Output is correct
55 Correct 12 ms 13048 KB Output is correct
56 Correct 13 ms 12920 KB Output is correct
57 Correct 270 ms 27200 KB Output is correct
58 Correct 259 ms 25984 KB Output is correct
59 Correct 267 ms 26992 KB Output is correct
60 Correct 247 ms 25972 KB Output is correct
61 Correct 239 ms 26992 KB Output is correct
62 Correct 254 ms 26404 KB Output is correct
63 Correct 242 ms 27124 KB Output is correct
64 Correct 246 ms 27124 KB Output is correct
65 Correct 252 ms 27380 KB Output is correct
66 Correct 264 ms 27384 KB Output is correct
67 Correct 265 ms 27244 KB Output is correct
68 Correct 262 ms 26988 KB Output is correct
69 Correct 276 ms 26456 KB Output is correct
70 Correct 248 ms 26356 KB Output is correct
71 Correct 13 ms 12920 KB Output is correct
72 Correct 17 ms 13432 KB Output is correct
73 Correct 16 ms 13432 KB Output is correct
74 Correct 16 ms 13452 KB Output is correct
75 Correct 16 ms 13432 KB Output is correct
76 Correct 16 ms 13432 KB Output is correct
77 Correct 16 ms 13432 KB Output is correct
78 Correct 16 ms 13432 KB Output is correct
79 Correct 16 ms 13432 KB Output is correct
80 Correct 255 ms 26392 KB Output is correct
81 Correct 249 ms 26476 KB Output is correct
82 Correct 259 ms 26992 KB Output is correct
83 Correct 255 ms 27380 KB Output is correct
84 Correct 15 ms 13304 KB Output is correct
85 Correct 14 ms 13304 KB Output is correct
86 Correct 15 ms 13304 KB Output is correct
87 Correct 15 ms 13304 KB Output is correct
88 Correct 15 ms 13304 KB Output is correct
89 Correct 15 ms 13304 KB Output is correct
90 Correct 18 ms 13380 KB Output is correct
91 Correct 21 ms 13436 KB Output is correct
92 Correct 16 ms 13304 KB Output is correct
93 Correct 16 ms 13304 KB Output is correct
94 Correct 12 ms 13048 KB Output is correct
95 Correct 13 ms 13048 KB Output is correct
96 Correct 12 ms 12920 KB Output is correct
97 Correct 13 ms 12920 KB Output is correct
98 Correct 12 ms 12920 KB Output is correct
99 Correct 12 ms 13048 KB Output is correct
100 Correct 12 ms 13048 KB Output is correct
101 Correct 12 ms 13048 KB Output is correct
102 Correct 11 ms 13048 KB Output is correct
103 Correct 13 ms 13048 KB Output is correct
104 Correct 29 ms 14584 KB Output is correct
105 Correct 54 ms 17272 KB Output is correct
106 Correct 12 ms 13048 KB Output is correct
107 Correct 97 ms 19992 KB Output is correct
108 Correct 111 ms 24440 KB Output is correct
109 Correct 13 ms 13176 KB Output is correct
110 Correct 184 ms 26232 KB Output is correct
111 Correct 225 ms 28784 KB Output is correct
112 Correct 13 ms 13176 KB Output is correct
113 Correct 275 ms 39156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 19576 KB Output is correct
2 Correct 53 ms 19448 KB Output is correct
3 Correct 56 ms 19444 KB Output is correct
4 Correct 54 ms 19448 KB Output is correct
5 Correct 54 ms 19448 KB Output is correct
6 Correct 59 ms 20460 KB Output is correct
7 Correct 65 ms 19828 KB Output is correct
8 Correct 53 ms 19444 KB Output is correct
9 Correct 54 ms 19324 KB Output is correct
10 Correct 55 ms 19704 KB Output is correct
11 Correct 11 ms 12920 KB Output is correct
12 Correct 36 ms 19188 KB Output is correct
13 Correct 37 ms 19316 KB Output is correct
14 Correct 33 ms 19180 KB Output is correct
15 Correct 32 ms 19188 KB Output is correct
16 Correct 32 ms 19188 KB Output is correct
17 Correct 31 ms 19188 KB Output is correct
18 Correct 35 ms 19188 KB Output is correct
19 Correct 32 ms 19188 KB Output is correct
20 Correct 12 ms 13048 KB Output is correct
21 Correct 12 ms 12920 KB Output is correct
22 Correct 12 ms 13176 KB Output is correct
23 Correct 33 ms 19184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 30712 KB Output is correct
2 Correct 214 ms 31220 KB Output is correct
3 Correct 164 ms 27764 KB Output is correct
4 Correct 36 ms 15736 KB Output is correct
5 Correct 28 ms 14584 KB Output is correct
6 Correct 55 ms 17272 KB Output is correct
7 Correct 13 ms 13048 KB Output is correct
8 Correct 98 ms 19996 KB Output is correct
9 Correct 115 ms 24444 KB Output is correct
10 Correct 13 ms 13176 KB Output is correct
11 Correct 193 ms 26232 KB Output is correct
12 Correct 217 ms 28780 KB Output is correct
13 Correct 13 ms 13136 KB Output is correct
14 Correct 13 ms 13176 KB Output is correct
15 Correct 13 ms 13176 KB Output is correct
16 Correct 14 ms 13176 KB Output is correct
17 Correct 13 ms 13048 KB Output is correct
18 Correct 14 ms 13304 KB Output is correct
19 Correct 14 ms 13304 KB Output is correct
20 Correct 13 ms 13052 KB Output is correct
21 Correct 14 ms 13176 KB Output is correct
22 Correct 14 ms 13176 KB Output is correct
23 Correct 12 ms 12920 KB Output is correct
24 Correct 12 ms 12920 KB Output is correct
25 Correct 12 ms 13048 KB Output is correct
26 Correct 13 ms 13048 KB Output is correct
27 Correct 12 ms 12920 KB Output is correct
28 Correct 13 ms 12920 KB Output is correct
29 Correct 12 ms 12920 KB Output is correct
30 Correct 12 ms 13048 KB Output is correct
31 Correct 12 ms 12920 KB Output is correct
32 Correct 12 ms 12920 KB Output is correct
33 Correct 12 ms 12924 KB Output is correct
34 Correct 12 ms 12924 KB Output is correct
35 Correct 12 ms 12920 KB Output is correct
36 Correct 12 ms 12920 KB Output is correct
37 Correct 12 ms 13048 KB Output is correct
38 Correct 12 ms 13048 KB Output is correct
39 Correct 12 ms 12920 KB Output is correct
40 Correct 12 ms 12924 KB Output is correct
41 Correct 12 ms 12920 KB Output is correct
42 Correct 16 ms 13560 KB Output is correct
43 Correct 16 ms 13688 KB Output is correct
44 Correct 14 ms 13176 KB Output is correct
45 Correct 13 ms 13176 KB Output is correct
46 Correct 16 ms 13432 KB Output is correct
47 Correct 16 ms 13436 KB Output is correct
48 Correct 14 ms 13176 KB Output is correct
49 Correct 13 ms 13176 KB Output is correct
50 Correct 16 ms 13432 KB Output is correct
51 Correct 16 ms 13432 KB Output is correct
52 Correct 13 ms 13176 KB Output is correct
53 Correct 14 ms 13304 KB Output is correct
54 Correct 16 ms 13432 KB Output is correct
55 Correct 16 ms 13304 KB Output is correct
56 Correct 14 ms 13176 KB Output is correct
57 Correct 16 ms 13176 KB Output is correct
58 Correct 13 ms 13176 KB Output is correct
59 Correct 13 ms 13176 KB Output is correct
60 Correct 16 ms 13432 KB Output is correct
61 Correct 16 ms 13432 KB Output is correct
62 Correct 14 ms 13176 KB Output is correct
63 Correct 15 ms 13304 KB Output is correct
64 Correct 16 ms 13432 KB Output is correct
65 Correct 17 ms 13432 KB Output is correct
66 Correct 13 ms 13180 KB Output is correct
67 Correct 13 ms 13176 KB Output is correct
68 Correct 13 ms 13176 KB Output is correct
69 Correct 12 ms 13176 KB Output is correct
70 Correct 15 ms 13180 KB Output is correct
71 Correct 14 ms 13176 KB Output is correct
72 Correct 13 ms 13180 KB Output is correct
73 Correct 13 ms 13176 KB Output is correct
74 Correct 14 ms 13304 KB Output is correct
75 Correct 16 ms 13380 KB Output is correct
76 Correct 14 ms 13176 KB Output is correct
77 Correct 13 ms 13176 KB Output is correct
78 Correct 14 ms 13176 KB Output is correct
79 Correct 13 ms 13176 KB Output is correct
80 Correct 15 ms 13304 KB Output is correct
81 Correct 15 ms 13436 KB Output is correct
82 Correct 18 ms 13304 KB Output is correct
83 Correct 15 ms 13304 KB Output is correct
84 Correct 15 ms 13432 KB Output is correct
85 Correct 15 ms 13288 KB Output is correct
86 Correct 16 ms 13304 KB Output is correct
87 Correct 16 ms 13432 KB Output is correct
88 Correct 16 ms 13304 KB Output is correct
89 Correct 15 ms 13304 KB Output is correct
90 Correct 12 ms 13048 KB Output is correct
91 Correct 12 ms 13048 KB Output is correct
92 Correct 12 ms 12920 KB Output is correct
93 Correct 12 ms 12920 KB Output is correct
94 Correct 13 ms 12920 KB Output is correct
95 Correct 12 ms 12920 KB Output is correct
96 Correct 12 ms 13048 KB Output is correct
97 Correct 12 ms 13048 KB Output is correct
98 Correct 13 ms 12920 KB Output is correct
99 Correct 13 ms 13048 KB Output is correct
100 Correct 12 ms 13048 KB Output is correct
101 Correct 12 ms 13176 KB Output is correct
102 Correct 13 ms 13176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 30712 KB Output is correct
2 Correct 214 ms 31220 KB Output is correct
3 Correct 164 ms 27764 KB Output is correct
4 Correct 36 ms 15736 KB Output is correct
5 Correct 28 ms 14584 KB Output is correct
6 Correct 55 ms 17272 KB Output is correct
7 Correct 13 ms 13048 KB Output is correct
8 Correct 98 ms 19996 KB Output is correct
9 Correct 115 ms 24444 KB Output is correct
10 Correct 13 ms 13176 KB Output is correct
11 Correct 193 ms 26232 KB Output is correct
12 Correct 217 ms 28780 KB Output is correct
13 Correct 13 ms 13136 KB Output is correct
14 Correct 13 ms 12920 KB Output is correct
15 Correct 12 ms 13052 KB Output is correct
16 Correct 12 ms 12920 KB Output is correct
17 Correct 13 ms 13024 KB Output is correct
18 Correct 12 ms 12920 KB Output is correct
19 Correct 13 ms 13048 KB Output is correct
20 Correct 13 ms 13048 KB Output is correct
21 Correct 12 ms 13048 KB Output is correct
22 Correct 13 ms 12920 KB Output is correct
23 Correct 13 ms 12920 KB Output is correct
24 Correct 13 ms 12920 KB Output is correct
25 Correct 12 ms 12920 KB Output is correct
26 Correct 14 ms 13048 KB Output is correct
27 Correct 13 ms 12920 KB Output is correct
28 Correct 13 ms 12920 KB Output is correct
29 Correct 13 ms 13048 KB Output is correct
30 Correct 12 ms 12920 KB Output is correct
31 Correct 13 ms 12920 KB Output is correct
32 Correct 12 ms 12920 KB Output is correct
33 Correct 14 ms 12920 KB Output is correct
34 Correct 14 ms 13180 KB Output is correct
35 Correct 12 ms 13048 KB Output is correct
36 Correct 13 ms 12920 KB Output is correct
37 Correct 13 ms 12920 KB Output is correct
38 Correct 13 ms 13048 KB Output is correct
39 Correct 227 ms 31708 KB Output is correct
40 Correct 238 ms 31372 KB Output is correct
41 Correct 160 ms 27764 KB Output is correct
42 Correct 37 ms 15736 KB Output is correct
43 Correct 13 ms 12920 KB Output is correct
44 Correct 14 ms 13048 KB Output is correct
45 Correct 13 ms 13048 KB Output is correct
46 Correct 13 ms 12920 KB Output is correct
47 Correct 12 ms 13048 KB Output is correct
48 Correct 13 ms 12920 KB Output is correct
49 Correct 13 ms 12920 KB Output is correct
50 Correct 13 ms 12920 KB Output is correct
51 Correct 12 ms 13048 KB Output is correct
52 Correct 13 ms 13048 KB Output is correct
53 Correct 12 ms 13048 KB Output is correct
54 Correct 13 ms 12920 KB Output is correct
55 Correct 12 ms 13048 KB Output is correct
56 Correct 13 ms 12920 KB Output is correct
57 Correct 270 ms 27200 KB Output is correct
58 Correct 259 ms 25984 KB Output is correct
59 Correct 267 ms 26992 KB Output is correct
60 Correct 247 ms 25972 KB Output is correct
61 Correct 239 ms 26992 KB Output is correct
62 Correct 254 ms 26404 KB Output is correct
63 Correct 242 ms 27124 KB Output is correct
64 Correct 246 ms 27124 KB Output is correct
65 Correct 252 ms 27380 KB Output is correct
66 Correct 264 ms 27384 KB Output is correct
67 Correct 265 ms 27244 KB Output is correct
68 Correct 262 ms 26988 KB Output is correct
69 Correct 276 ms 26456 KB Output is correct
70 Correct 248 ms 26356 KB Output is correct
71 Correct 13 ms 12920 KB Output is correct
72 Correct 17 ms 13432 KB Output is correct
73 Correct 16 ms 13432 KB Output is correct
74 Correct 16 ms 13452 KB Output is correct
75 Correct 16 ms 13432 KB Output is correct
76 Correct 16 ms 13432 KB Output is correct
77 Correct 16 ms 13432 KB Output is correct
78 Correct 16 ms 13432 KB Output is correct
79 Correct 16 ms 13432 KB Output is correct
80 Correct 255 ms 26392 KB Output is correct
81 Correct 249 ms 26476 KB Output is correct
82 Correct 259 ms 26992 KB Output is correct
83 Correct 255 ms 27380 KB Output is correct
84 Correct 15 ms 13304 KB Output is correct
85 Correct 14 ms 13304 KB Output is correct
86 Correct 15 ms 13304 KB Output is correct
87 Correct 15 ms 13304 KB Output is correct
88 Correct 15 ms 13304 KB Output is correct
89 Correct 15 ms 13304 KB Output is correct
90 Correct 18 ms 13380 KB Output is correct
91 Correct 21 ms 13436 KB Output is correct
92 Correct 16 ms 13304 KB Output is correct
93 Correct 16 ms 13304 KB Output is correct
94 Correct 12 ms 13048 KB Output is correct
95 Correct 13 ms 13048 KB Output is correct
96 Correct 12 ms 12920 KB Output is correct
97 Correct 13 ms 12920 KB Output is correct
98 Correct 12 ms 12920 KB Output is correct
99 Correct 12 ms 13048 KB Output is correct
100 Correct 12 ms 13048 KB Output is correct
101 Correct 12 ms 13048 KB Output is correct
102 Correct 11 ms 13048 KB Output is correct
103 Correct 13 ms 13048 KB Output is correct
104 Correct 29 ms 14584 KB Output is correct
105 Correct 54 ms 17272 KB Output is correct
106 Correct 12 ms 13048 KB Output is correct
107 Correct 97 ms 19992 KB Output is correct
108 Correct 111 ms 24440 KB Output is correct
109 Correct 13 ms 13176 KB Output is correct
110 Correct 184 ms 26232 KB Output is correct
111 Correct 225 ms 28784 KB Output is correct
112 Correct 13 ms 13176 KB Output is correct
113 Correct 275 ms 39156 KB Output is correct
114 Correct 60 ms 19576 KB Output is correct
115 Correct 53 ms 19448 KB Output is correct
116 Correct 56 ms 19444 KB Output is correct
117 Correct 54 ms 19448 KB Output is correct
118 Correct 54 ms 19448 KB Output is correct
119 Correct 59 ms 20460 KB Output is correct
120 Correct 65 ms 19828 KB Output is correct
121 Correct 53 ms 19444 KB Output is correct
122 Correct 54 ms 19324 KB Output is correct
123 Correct 55 ms 19704 KB Output is correct
124 Correct 11 ms 12920 KB Output is correct
125 Correct 36 ms 19188 KB Output is correct
126 Correct 37 ms 19316 KB Output is correct
127 Correct 33 ms 19180 KB Output is correct
128 Correct 32 ms 19188 KB Output is correct
129 Correct 32 ms 19188 KB Output is correct
130 Correct 31 ms 19188 KB Output is correct
131 Correct 35 ms 19188 KB Output is correct
132 Correct 32 ms 19188 KB Output is correct
133 Correct 12 ms 13048 KB Output is correct
134 Correct 12 ms 12920 KB Output is correct
135 Correct 12 ms 13176 KB Output is correct
136 Correct 33 ms 19184 KB Output is correct
137 Correct 13 ms 13176 KB Output is correct
138 Correct 13 ms 13176 KB Output is correct
139 Correct 14 ms 13176 KB Output is correct
140 Correct 13 ms 13048 KB Output is correct
141 Correct 14 ms 13304 KB Output is correct
142 Correct 14 ms 13304 KB Output is correct
143 Correct 13 ms 13052 KB Output is correct
144 Correct 14 ms 13176 KB Output is correct
145 Correct 14 ms 13176 KB Output is correct
146 Correct 12 ms 12920 KB Output is correct
147 Correct 12 ms 12920 KB Output is correct
148 Correct 12 ms 13048 KB Output is correct
149 Correct 13 ms 13048 KB Output is correct
150 Correct 12 ms 12920 KB Output is correct
151 Correct 13 ms 12920 KB Output is correct
152 Correct 12 ms 12920 KB Output is correct
153 Correct 12 ms 13048 KB Output is correct
154 Correct 12 ms 12920 KB Output is correct
155 Correct 12 ms 12920 KB Output is correct
156 Correct 12 ms 12924 KB Output is correct
157 Correct 12 ms 12924 KB Output is correct
158 Correct 12 ms 12920 KB Output is correct
159 Correct 12 ms 12920 KB Output is correct
160 Correct 12 ms 13048 KB Output is correct
161 Correct 12 ms 13048 KB Output is correct
162 Correct 12 ms 12920 KB Output is correct
163 Correct 12 ms 12924 KB Output is correct
164 Correct 12 ms 12920 KB Output is correct
165 Correct 16 ms 13560 KB Output is correct
166 Correct 16 ms 13688 KB Output is correct
167 Correct 14 ms 13176 KB Output is correct
168 Correct 13 ms 13176 KB Output is correct
169 Correct 16 ms 13432 KB Output is correct
170 Correct 16 ms 13436 KB Output is correct
171 Correct 14 ms 13176 KB Output is correct
172 Correct 13 ms 13176 KB Output is correct
173 Correct 16 ms 13432 KB Output is correct
174 Correct 16 ms 13432 KB Output is correct
175 Correct 13 ms 13176 KB Output is correct
176 Correct 14 ms 13304 KB Output is correct
177 Correct 16 ms 13432 KB Output is correct
178 Correct 16 ms 13304 KB Output is correct
179 Correct 14 ms 13176 KB Output is correct
180 Correct 16 ms 13176 KB Output is correct
181 Correct 13 ms 13176 KB Output is correct
182 Correct 13 ms 13176 KB Output is correct
183 Correct 16 ms 13432 KB Output is correct
184 Correct 16 ms 13432 KB Output is correct
185 Correct 14 ms 13176 KB Output is correct
186 Correct 15 ms 13304 KB Output is correct
187 Correct 16 ms 13432 KB Output is correct
188 Correct 17 ms 13432 KB Output is correct
189 Correct 13 ms 13180 KB Output is correct
190 Correct 13 ms 13176 KB Output is correct
191 Correct 13 ms 13176 KB Output is correct
192 Correct 12 ms 13176 KB Output is correct
193 Correct 15 ms 13180 KB Output is correct
194 Correct 14 ms 13176 KB Output is correct
195 Correct 13 ms 13180 KB Output is correct
196 Correct 13 ms 13176 KB Output is correct
197 Correct 14 ms 13304 KB Output is correct
198 Correct 16 ms 13380 KB Output is correct
199 Correct 14 ms 13176 KB Output is correct
200 Correct 13 ms 13176 KB Output is correct
201 Correct 14 ms 13176 KB Output is correct
202 Correct 13 ms 13176 KB Output is correct
203 Correct 15 ms 13304 KB Output is correct
204 Correct 15 ms 13436 KB Output is correct
205 Correct 18 ms 13304 KB Output is correct
206 Correct 15 ms 13304 KB Output is correct
207 Correct 15 ms 13432 KB Output is correct
208 Correct 15 ms 13288 KB Output is correct
209 Correct 16 ms 13304 KB Output is correct
210 Correct 16 ms 13432 KB Output is correct
211 Correct 16 ms 13304 KB Output is correct
212 Correct 15 ms 13304 KB Output is correct
213 Correct 12 ms 13048 KB Output is correct
214 Correct 12 ms 13048 KB Output is correct
215 Correct 12 ms 12920 KB Output is correct
216 Correct 12 ms 12920 KB Output is correct
217 Correct 13 ms 12920 KB Output is correct
218 Correct 12 ms 12920 KB Output is correct
219 Correct 12 ms 13048 KB Output is correct
220 Correct 12 ms 13048 KB Output is correct
221 Correct 13 ms 12920 KB Output is correct
222 Correct 13 ms 13048 KB Output is correct
223 Correct 12 ms 13048 KB Output is correct
224 Correct 12 ms 13176 KB Output is correct
225 Correct 13 ms 13176 KB Output is correct
226 Correct 13 ms 13052 KB Output is correct
227 Correct 14 ms 13176 KB Output is correct
228 Correct 15 ms 13180 KB Output is correct
229 Correct 98 ms 19616 KB Output is correct
230 Correct 116 ms 21240 KB Output is correct
231 Correct 13 ms 13052 KB Output is correct
232 Correct 13 ms 13176 KB Output is correct
233 Correct 15 ms 13304 KB Output is correct
234 Correct 100 ms 19704 KB Output is correct
235 Correct 125 ms 21376 KB Output is correct
236 Correct 13 ms 13048 KB Output is correct
237 Correct 14 ms 13176 KB Output is correct
238 Correct 14 ms 13176 KB Output is correct
239 Correct 98 ms 19712 KB Output is correct
240 Correct 132 ms 21504 KB Output is correct
241 Correct 54 ms 19836 KB Output is correct
242 Correct 60 ms 19960 KB Output is correct
243 Correct 55 ms 19960 KB Output is correct
244 Correct 54 ms 19960 KB Output is correct
245 Correct 56 ms 19832 KB Output is correct
246 Correct 63 ms 20848 KB Output is correct
247 Correct 56 ms 20212 KB Output is correct
248 Correct 52 ms 19828 KB Output is correct
249 Correct 53 ms 19704 KB Output is correct
250 Correct 55 ms 20216 KB Output is correct
251 Correct 12 ms 12920 KB Output is correct
252 Correct 225 ms 31732 KB Output is correct
253 Correct 217 ms 31220 KB Output is correct
254 Correct 164 ms 27892 KB Output is correct
255 Correct 36 ms 15736 KB Output is correct
256 Correct 12 ms 12920 KB Output is correct
257 Correct 12 ms 12924 KB Output is correct
258 Correct 12 ms 12920 KB Output is correct
259 Correct 12 ms 12920 KB Output is correct
260 Correct 12 ms 12920 KB Output is correct
261 Correct 12 ms 13048 KB Output is correct
262 Correct 12 ms 13048 KB Output is correct
263 Correct 12 ms 12920 KB Output is correct
264 Correct 12 ms 12920 KB Output is correct
265 Correct 12 ms 12920 KB Output is correct
266 Correct 13 ms 13052 KB Output is correct
267 Correct 12 ms 13048 KB Output is correct
268 Correct 12 ms 13048 KB Output is correct
269 Correct 12 ms 13048 KB Output is correct
270 Correct 13 ms 13048 KB Output is correct
271 Correct 12 ms 13048 KB Output is correct
272 Correct 258 ms 27248 KB Output is correct
273 Correct 239 ms 25972 KB Output is correct
274 Correct 265 ms 26988 KB Output is correct
275 Correct 257 ms 25844 KB Output is correct
276 Correct 32 ms 19188 KB Output is correct
277 Correct 36 ms 19316 KB Output is correct
278 Correct 253 ms 26992 KB Output is correct
279 Correct 246 ms 26404 KB Output is correct
280 Correct 259 ms 27124 KB Output is correct
281 Correct 256 ms 27120 KB Output is correct
282 Correct 263 ms 27504 KB Output is correct
283 Correct 270 ms 27376 KB Output is correct
284 Correct 259 ms 27120 KB Output is correct
285 Correct 268 ms 27092 KB Output is correct
286 Correct 275 ms 26328 KB Output is correct
287 Correct 280 ms 26408 KB Output is correct
288 Correct 33 ms 19184 KB Output is correct
289 Correct 35 ms 19184 KB Output is correct
290 Correct 31 ms 19188 KB Output is correct
291 Correct 32 ms 19188 KB Output is correct
292 Correct 34 ms 19316 KB Output is correct
293 Correct 33 ms 19188 KB Output is correct
294 Correct 13 ms 13048 KB Output is correct
295 Correct 12 ms 12924 KB Output is correct
296 Correct 16 ms 13560 KB Output is correct
297 Correct 15 ms 13688 KB Output is correct
298 Correct 261 ms 26736 KB Output is correct
299 Correct 233 ms 26352 KB Output is correct
300 Correct 14 ms 13176 KB Output is correct
301 Correct 13 ms 13176 KB Output is correct
302 Correct 18 ms 13432 KB Output is correct
303 Correct 16 ms 13432 KB Output is correct
304 Correct 14 ms 13176 KB Output is correct
305 Correct 15 ms 13176 KB Output is correct
306 Correct 17 ms 13304 KB Output is correct
307 Correct 17 ms 13432 KB Output is correct
308 Correct 12 ms 13176 KB Output is correct
309 Correct 14 ms 13176 KB Output is correct
310 Correct 16 ms 13432 KB Output is correct
311 Correct 16 ms 13432 KB Output is correct
312 Correct 14 ms 13176 KB Output is correct
313 Correct 15 ms 13176 KB Output is correct
314 Correct 13 ms 13176 KB Output is correct
315 Correct 13 ms 13176 KB Output is correct
316 Correct 16 ms 13432 KB Output is correct
317 Correct 17 ms 13432 KB Output is correct
318 Correct 14 ms 13176 KB Output is correct
319 Correct 15 ms 13176 KB Output is correct
320 Correct 17 ms 13432 KB Output is correct
321 Correct 17 ms 13560 KB Output is correct
322 Correct 14 ms 13176 KB Output is correct
323 Correct 13 ms 13176 KB Output is correct
324 Correct 13 ms 13176 KB Output is correct
325 Correct 13 ms 13176 KB Output is correct
326 Correct 14 ms 13176 KB Output is correct
327 Correct 14 ms 13180 KB Output is correct
328 Correct 13 ms 13176 KB Output is correct
329 Correct 13 ms 13180 KB Output is correct
330 Correct 14 ms 13304 KB Output is correct
331 Correct 17 ms 13304 KB Output is correct
332 Correct 13 ms 13176 KB Output is correct
333 Correct 14 ms 13176 KB Output is correct
334 Correct 13 ms 13180 KB Output is correct
335 Correct 13 ms 13176 KB Output is correct
336 Correct 266 ms 31732 KB Output is correct
337 Correct 317 ms 35700 KB Output is correct
338 Correct 270 ms 26480 KB Output is correct
339 Correct 245 ms 26868 KB Output is correct
340 Correct 47 ms 20080 KB Output is correct
341 Correct 63 ms 20216 KB Output is correct
342 Correct 268 ms 26392 KB Output is correct
343 Correct 248 ms 26480 KB Output is correct
344 Correct 91 ms 20600 KB Output is correct
345 Correct 57 ms 20460 KB Output is correct
346 Correct 248 ms 25204 KB Output is correct
347 Correct 261 ms 25852 KB Output is correct
348 Correct 141 ms 21008 KB Output is correct
349 Correct 117 ms 21112 KB Output is correct
350 Correct 271 ms 26996 KB Output is correct
351 Correct 269 ms 27316 KB Output is correct
352 Correct 36 ms 19440 KB Output is correct
353 Correct 120 ms 21112 KB Output is correct
354 Correct 61 ms 20592 KB Output is correct
355 Correct 67 ms 20592 KB Output is correct
356 Correct 104 ms 20856 KB Output is correct
357 Correct 46 ms 19824 KB Output is correct
358 Correct 64 ms 20592 KB Output is correct
359 Correct 59 ms 20584 KB Output is correct
360 Correct 34 ms 19316 KB Output is correct
361 Correct 34 ms 19188 KB Output is correct
362 Correct 165 ms 21240 KB Output is correct
363 Correct 169 ms 21240 KB Output is correct
364 Correct 156 ms 22724 KB Output is correct
365 Correct 101 ms 21108 KB Output is correct
366 Correct 144 ms 22648 KB Output is correct
367 Correct 171 ms 23648 KB Output is correct
368 Correct 108 ms 20856 KB Output is correct
369 Correct 99 ms 20732 KB Output is correct
370 Correct 77 ms 20344 KB Output is correct
371 Correct 118 ms 21048 KB Output is correct
372 Correct 15 ms 13304 KB Output is correct
373 Correct 15 ms 13304 KB Output is correct
374 Correct 16 ms 13304 KB Output is correct
375 Correct 16 ms 13320 KB Output is correct
376 Correct 17 ms 13304 KB Output is correct
377 Correct 16 ms 13304 KB Output is correct
378 Correct 16 ms 13304 KB Output is correct
379 Correct 16 ms 13432 KB Output is correct
380 Correct 18 ms 13304 KB Output is correct
381 Correct 16 ms 13304 KB Output is correct
382 Correct 14 ms 13048 KB Output is correct
383 Correct 13 ms 12920 KB Output is correct
384 Correct 14 ms 13048 KB Output is correct
385 Correct 13 ms 13048 KB Output is correct
386 Correct 12 ms 12920 KB Output is correct
387 Correct 13 ms 12924 KB Output is correct
388 Correct 12 ms 13048 KB Output is correct
389 Correct 13 ms 13176 KB Output is correct
390 Correct 14 ms 13048 KB Output is correct
391 Correct 13 ms 12920 KB Output is correct
392 Correct 30 ms 14584 KB Output is correct
393 Correct 59 ms 17272 KB Output is correct
394 Correct 13 ms 13048 KB Output is correct
395 Correct 110 ms 19992 KB Output is correct
396 Correct 124 ms 24440 KB Output is correct
397 Correct 14 ms 13176 KB Output is correct
398 Correct 203 ms 26208 KB Output is correct
399 Correct 251 ms 28784 KB Output is correct
400 Correct 14 ms 13176 KB Output is correct
401 Correct 305 ms 39200 KB Output is correct