Submission #842687

# Submission time Handle Problem Language Result Execution time Memory
842687 2023-09-03T08:46:28 Z normankr07 Dreaming (IOI13_dreaming) C++17
100 / 100
74 ms 45500 KB
/*
Templete by norman/KNN-07
Who tf even love CP :sob:
*/

#ifndef LOCAL
#pragma GCC optimize("Ofast,unroll-loops,inline")
// Bitwise pragma fuck
// #pragma GCC target("avx,avx2,bmi")

// Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_supports("avx2"));
// #pragma GCC target("arch=skylake")
// Atcoder
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma")
#endif

#ifndef LOCAL
#include "dreaming.h"
#endif
#include <bits/stdc++.h>
using namespace std;

// Wish you can debug? YesYes
#ifndef LOCAL
#define cerr \
    if (0)   \
    cerr
#endif

// Policy based DS?
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// Who tf deal with overflow
// #define int long long

/*
pbds blog :
https://codeforces.com/blog/entry/11080
https://codeforces.com/blog/entry/13279
*/
// Useful pbds
// template <typename T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// template <typename T>
// using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// typedef trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update> pref_trie;

#define el '\n'
#define mpp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define emp emplace_back
#define fi first
#define nd second
#define forinc(i, a, b) for (int i = (a); i <= (b); i++)
#define fordec(i, a, b) for (int i = (a); i >= (b); i--)
#define alle(x) (x).begin(), (x).end()
#define ralle(x) (x).rbegin(), (x).rend()
#define mms(a, v) memset(a, v, sizeof(a))
#define lwb(a, v) lower_bound((a).begin(), (a).end(), v)
#define upb(a, v) upper_bound((a).begin(), (a).end(), v)
#define bit(i, a) (((a) >> (i)) & 1)

#define BIT_SET(a, b) ((a) |= (1ULL << (b)))
#define BIT_CLEAR(a, b) ((a) &= ~(1ULL << (b)))
#define BIT_FLIP(a, b) ((a) ^= (1ULL << (b)))
#define BIT_CHECK(a, b) (!!((a) & (1ULL << (b))))
#define BITMASK_SET(x, mask) ((x) |= (mask))
#define BITMASK_CLEAR(x, mask) ((x) &= (~(mask)))
#define BITMASK_FLIP(x, mask) ((x) ^= (mask))
#define BITMASK_CHECK_ALL(x, mask) (!(~(x) & (mask)))
#define BITMASK_CHECK_ANY(x, mask) ((x) & (mask))
#define POPCNT(mask) __builtin_popcount(mask)
#define POPCNTLL(mask) __builtin_popcountll(mask)
#define CTZ(mask) __builtin_ctz(mask)
#define CTZLL(mask) __builtin_ctzll(mask)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<int, int> mii;
typedef map<ll, ll> mll;
typedef vector<bool> vb;

template <typename T, typename U>
inline void maximize(T &x, U y)
{
    if (y < x)
        x = y;
}
template <typename T, typename U>
inline void minimize(T &x, U y)
{
    if (x < y)
        x = y;
}
inline int add_m(int a, int b, int mod)
{
    int res = a + b;
    return (res >= mod ? res - mod : res);
}
inline int mod_neg(int a, int b, int mod)
{
    int res;
    if (abs(a - b) < mod)
        res = a - b;
    else
        res = (a - b) % mod;
    return (res < 0 ? res + mod : res);
}
inline int mul_wmod(int a, int b, int c)
{
    ll res = (ll)a * b;
    return (res >= c ? res % c : res);
}
inline int mul_wnmod(int a, int b, int c)
{
    ll res = (ll)a * b;
    return ((res % c) + c) % c;
}

// Debugger Utils
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

template <size_t i, class T>
ostream &print_tuple_utils(ostream &out, const T &tup)
{
    if constexpr (i == tuple_size<T>::value)
        return out << ")";
    else
        return print_tuple_utils<i + 1, T>(out << (i ? ", " : "(") << get<i>(tup), tup);
}
template <class... U>
ostream &operator<<(ostream &out, const tuple<U...> &t)
{
    return print_tuple_utils<0, tuple<U...>>(out, t);
}
#define db(val) "[" #val " = " << (val) << "] "
// End if debugger utils

namespace Hasher
{
    struct custom_hash
    {
        static uint32_t splitmix64(uint32_t x)
        {
            x += 0x9e3779b97f4a7c15;
            x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
            x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
            return x ^ (x >> 31);
        }
        size_t operator()(uint64_t x) const
        {
            static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
            return splitmix64(x + FIXED_RANDOM);
        }
    };
    struct hash_pair
    {
        template <class T1, class T2>
        size_t operator()(const pair<T1, T2> &p) const
        {
            auto hash1 = custom_hash{}(p.first);
            auto hash2 = custom_hash{}(p.second);
            if (hash1 != hash2)
                return hash1 ^ hash2;
            return hash1;
        }
    };
    struct hash_pair_pair
    {
        template <class T1, class T2>
        size_t operator()(const pair<T1, T2> &p) const
        {
            auto hash1 = custom_hash{}(p.first);
            auto hash2 = hash_pair{}(p.second);
            if (hash1 != hash2)
                return hash1 ^ hash2;
            return hash1;
        }
    };
}
using namespace Hasher;

const string taskname = "";
const bool tc = false;

const int oo = 1e9, mod = 1e9 + 7;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll ool = 1e18;
const ldb eps = 1e-6;
const int MAXN = 1e6;

/*
Author: normankr07
Problem:
    - IOI 2013 - Dreaming
Submission links:
    - https://oj.uz/problem/view/IOI13_dreaming
Editorial links:
    - https://www.quora.com/What-is-the-solution-for-Dreaming-on-IOI-2013
    - http://blog.brucemerry.org.za/2013/07/ioi-2013-day-1-analysis.html
    - http://math.fau.edu/locke/Center.htm
Algorithm:
    - Find the center with maxmimum eccentricity, connect all of the center with that center

*/

vector<pii> adj[MAXN];
bool vis[MAXN];
pii max1[MAXN];
int max2[MAXN], dep[MAXN];
void DFS_maxcen(int u, int p)
{
    vis[u] = 1;
    max1[u] = {0, u};
    for (auto &[v, w] : adj[u])
    {
        if (v == p)
            continue;
        DFS_maxcen(v, u);
        max1[u] = max(max1[u], {max1[v].fi + w, max1[v].nd});
    }
}

int reDFS(int u, int p)
{
    max2[u] = max(max2[u], dep[u]);
    int ans = max2[u];
    for (auto &[v, w] : adj[u])
    {
        if (v == p)
            continue;
        dep[v] = dep[u] + w;
        ans = min(ans, reDFS(v, u));
    }
    return ans;
}

int travelTime(int N, int M, int L, int A[], int B[], int T[])
{
    for (int i = 0; i < M; i++)
    {
        adj[A[i]].pb({B[i], T[i]});
        adj[B[i]].pb({A[i], T[i]});
    }
    int ans = 0;
    vi dia;
    forinc(i, 0, N - 1)
    {
        if (vis[i])
            continue;
        DFS_maxcen(i, i);
        // Center with max ecc of subtree r[i];
        int x = max1[i].second;
        cerr << "Current root: " << i << el;
        cerr << db(max1[i]) << el;
        DFS_maxcen(x, x);
        // Check root x;
        int y = max1[x].second;
        cerr << db(max1[x]) << el;
        cerr << db(x) << db(y) << el;
        ans = max(ans, max1[x].first);
        dep[x] = 0;
        reDFS(x, x);
        dep[y] = 0;
        int die = reDFS(y, y);
        cerr << db(dep[x]) << db(dep[y]) << el;
        dia.pb(die);
    }
    sort(ralle(dia));
    if (dia.size() >= 2)
        ans = max(dia[0] + dia[1] + L, ans);
    if (dia.size() >= 3)
        ans = max(dia[1] + dia[2] + L * 2, ans);
    return ans;
}

#ifdef LOCAL
#define MAX_N 100000

static int A[MAX_N];
static int B[MAX_N];
static int T[MAX_N];

void solve()
{
    int N, M, L, i;
    int res;
    cin >> N >> M >> L;
    for (i = 0; i < M; i++)
        cin >> A[i] >> B[i] >> T[i];
    int answer = travelTime(N, M, L, A, B, T);
    cout << answer;
}

int32_t main()
{
    if (fopen((taskname + ".inp").c_str(), "r"))
    {
        freopen((taskname + ".inp").c_str(), "r", stdin);
        freopen((taskname + ".out").c_str(), "w", stdout);
    }
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tsc = 1;
    if (tc)
    {
        cin >> tsc;
    }
    while (tsc--)
    {
        solve();
        cout << el;
    }

    cerr << "\n"
         << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
#endif
#undef int
# Verdict Execution time Memory Grader output
1 Correct 48 ms 43604 KB Output is correct
2 Correct 46 ms 43604 KB Output is correct
3 Correct 32 ms 39000 KB Output is correct
4 Correct 13 ms 31320 KB Output is correct
5 Correct 13 ms 30496 KB Output is correct
6 Correct 17 ms 32428 KB Output is correct
7 Correct 8 ms 29276 KB Output is correct
8 Correct 26 ms 33836 KB Output is correct
9 Correct 32 ms 36192 KB Output is correct
10 Correct 7 ms 29276 KB Output is correct
11 Correct 42 ms 37972 KB Output is correct
12 Correct 52 ms 40644 KB Output is correct
13 Correct 8 ms 29272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 29020 KB Output is correct
2 Correct 9 ms 29236 KB Output is correct
3 Correct 7 ms 29020 KB Output is correct
4 Correct 8 ms 29152 KB Output is correct
5 Correct 9 ms 29020 KB Output is correct
6 Correct 7 ms 29132 KB Output is correct
7 Correct 7 ms 29020 KB Output is correct
8 Correct 7 ms 29244 KB Output is correct
9 Correct 7 ms 29236 KB Output is correct
10 Correct 7 ms 29240 KB Output is correct
11 Correct 7 ms 29020 KB Output is correct
12 Correct 8 ms 29104 KB Output is correct
13 Correct 9 ms 29020 KB Output is correct
14 Correct 8 ms 29020 KB Output is correct
15 Correct 7 ms 29020 KB Output is correct
16 Correct 8 ms 29016 KB Output is correct
17 Correct 8 ms 29020 KB Output is correct
18 Correct 7 ms 29020 KB Output is correct
19 Correct 7 ms 29268 KB Output is correct
20 Correct 7 ms 29020 KB Output is correct
21 Correct 7 ms 29016 KB Output is correct
22 Correct 7 ms 29020 KB Output is correct
23 Correct 7 ms 29020 KB Output is correct
24 Correct 9 ms 29020 KB Output is correct
25 Correct 7 ms 29020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 43604 KB Output is correct
2 Correct 46 ms 43604 KB Output is correct
3 Correct 32 ms 39000 KB Output is correct
4 Correct 13 ms 31320 KB Output is correct
5 Correct 13 ms 30496 KB Output is correct
6 Correct 17 ms 32428 KB Output is correct
7 Correct 8 ms 29276 KB Output is correct
8 Correct 26 ms 33836 KB Output is correct
9 Correct 32 ms 36192 KB Output is correct
10 Correct 7 ms 29276 KB Output is correct
11 Correct 42 ms 37972 KB Output is correct
12 Correct 52 ms 40644 KB Output is correct
13 Correct 8 ms 29272 KB Output is correct
14 Correct 7 ms 29020 KB Output is correct
15 Correct 9 ms 29236 KB Output is correct
16 Correct 7 ms 29020 KB Output is correct
17 Correct 8 ms 29152 KB Output is correct
18 Correct 9 ms 29020 KB Output is correct
19 Correct 7 ms 29132 KB Output is correct
20 Correct 7 ms 29020 KB Output is correct
21 Correct 7 ms 29244 KB Output is correct
22 Correct 7 ms 29236 KB Output is correct
23 Correct 7 ms 29240 KB Output is correct
24 Correct 7 ms 29020 KB Output is correct
25 Correct 8 ms 29104 KB Output is correct
26 Correct 9 ms 29020 KB Output is correct
27 Correct 8 ms 29020 KB Output is correct
28 Correct 7 ms 29020 KB Output is correct
29 Correct 8 ms 29016 KB Output is correct
30 Correct 8 ms 29020 KB Output is correct
31 Correct 7 ms 29020 KB Output is correct
32 Correct 7 ms 29268 KB Output is correct
33 Correct 7 ms 29020 KB Output is correct
34 Correct 7 ms 29016 KB Output is correct
35 Correct 7 ms 29020 KB Output is correct
36 Correct 7 ms 29020 KB Output is correct
37 Correct 9 ms 29020 KB Output is correct
38 Correct 7 ms 29020 KB Output is correct
39 Correct 47 ms 43724 KB Output is correct
40 Correct 46 ms 43804 KB Output is correct
41 Correct 36 ms 39004 KB Output is correct
42 Correct 13 ms 31324 KB Output is correct
43 Correct 8 ms 29020 KB Output is correct
44 Correct 7 ms 29016 KB Output is correct
45 Correct 7 ms 29020 KB Output is correct
46 Correct 8 ms 29256 KB Output is correct
47 Correct 8 ms 29020 KB Output is correct
48 Correct 7 ms 29020 KB Output is correct
49 Correct 9 ms 29240 KB Output is correct
50 Correct 8 ms 29392 KB Output is correct
51 Correct 8 ms 29144 KB Output is correct
52 Correct 7 ms 29020 KB Output is correct
53 Correct 8 ms 29264 KB Output is correct
54 Correct 7 ms 29272 KB Output is correct
55 Correct 7 ms 29020 KB Output is correct
56 Correct 8 ms 29020 KB Output is correct
57 Correct 49 ms 34904 KB Output is correct
58 Correct 48 ms 34896 KB Output is correct
59 Correct 54 ms 35152 KB Output is correct
60 Correct 52 ms 35152 KB Output is correct
61 Correct 49 ms 35028 KB Output is correct
62 Correct 52 ms 35156 KB Output is correct
63 Correct 73 ms 34596 KB Output is correct
64 Correct 49 ms 34624 KB Output is correct
65 Correct 51 ms 35108 KB Output is correct
66 Correct 48 ms 34956 KB Output is correct
67 Correct 54 ms 34896 KB Output is correct
68 Correct 52 ms 35016 KB Output is correct
69 Correct 52 ms 35412 KB Output is correct
70 Correct 60 ms 35280 KB Output is correct
71 Correct 8 ms 29016 KB Output is correct
72 Correct 9 ms 29276 KB Output is correct
73 Correct 8 ms 29360 KB Output is correct
74 Correct 9 ms 29272 KB Output is correct
75 Correct 8 ms 29276 KB Output is correct
76 Correct 8 ms 29280 KB Output is correct
77 Correct 9 ms 29276 KB Output is correct
78 Correct 9 ms 29276 KB Output is correct
79 Correct 9 ms 29276 KB Output is correct
80 Correct 51 ms 35024 KB Output is correct
81 Correct 50 ms 34896 KB Output is correct
82 Correct 54 ms 35172 KB Output is correct
83 Correct 54 ms 34976 KB Output is correct
84 Correct 11 ms 29276 KB Output is correct
85 Correct 10 ms 29276 KB Output is correct
86 Correct 8 ms 29276 KB Output is correct
87 Correct 11 ms 29252 KB Output is correct
88 Correct 8 ms 29276 KB Output is correct
89 Correct 9 ms 29408 KB Output is correct
90 Correct 9 ms 29380 KB Output is correct
91 Correct 9 ms 29276 KB Output is correct
92 Correct 11 ms 29276 KB Output is correct
93 Correct 8 ms 29276 KB Output is correct
94 Correct 8 ms 29016 KB Output is correct
95 Correct 8 ms 29016 KB Output is correct
96 Correct 8 ms 29020 KB Output is correct
97 Correct 7 ms 29020 KB Output is correct
98 Correct 7 ms 29020 KB Output is correct
99 Correct 7 ms 29116 KB Output is correct
100 Correct 7 ms 29020 KB Output is correct
101 Correct 8 ms 29020 KB Output is correct
102 Correct 7 ms 29020 KB Output is correct
103 Correct 7 ms 29020 KB Output is correct
104 Correct 12 ms 30324 KB Output is correct
105 Correct 18 ms 32404 KB Output is correct
106 Correct 8 ms 29272 KB Output is correct
107 Correct 27 ms 33876 KB Output is correct
108 Correct 35 ms 36256 KB Output is correct
109 Correct 8 ms 29128 KB Output is correct
110 Correct 59 ms 38320 KB Output is correct
111 Correct 56 ms 40788 KB Output is correct
112 Correct 8 ms 29276 KB Output is correct
113 Correct 74 ms 45500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 32472 KB Output is correct
2 Correct 28 ms 32468 KB Output is correct
3 Correct 29 ms 32472 KB Output is correct
4 Correct 28 ms 32596 KB Output is correct
5 Correct 28 ms 32468 KB Output is correct
6 Correct 29 ms 32736 KB Output is correct
7 Correct 30 ms 32600 KB Output is correct
8 Correct 27 ms 32316 KB Output is correct
9 Correct 28 ms 32428 KB Output is correct
10 Correct 25 ms 32604 KB Output is correct
11 Correct 7 ms 29016 KB Output is correct
12 Correct 11 ms 30168 KB Output is correct
13 Correct 11 ms 30140 KB Output is correct
14 Correct 11 ms 30132 KB Output is correct
15 Correct 11 ms 30128 KB Output is correct
16 Correct 11 ms 30164 KB Output is correct
17 Correct 11 ms 30168 KB Output is correct
18 Correct 11 ms 30164 KB Output is correct
19 Correct 11 ms 30168 KB Output is correct
20 Correct 7 ms 29256 KB Output is correct
21 Correct 7 ms 29020 KB Output is correct
22 Correct 7 ms 29148 KB Output is correct
23 Correct 13 ms 30168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 29020 KB Output is correct
2 Correct 9 ms 29236 KB Output is correct
3 Correct 7 ms 29020 KB Output is correct
4 Correct 8 ms 29152 KB Output is correct
5 Correct 9 ms 29020 KB Output is correct
6 Correct 7 ms 29132 KB Output is correct
7 Correct 7 ms 29020 KB Output is correct
8 Correct 7 ms 29244 KB Output is correct
9 Correct 7 ms 29236 KB Output is correct
10 Correct 7 ms 29240 KB Output is correct
11 Correct 7 ms 29020 KB Output is correct
12 Correct 8 ms 29104 KB Output is correct
13 Correct 9 ms 29020 KB Output is correct
14 Correct 8 ms 29020 KB Output is correct
15 Correct 7 ms 29020 KB Output is correct
16 Correct 8 ms 29016 KB Output is correct
17 Correct 8 ms 29020 KB Output is correct
18 Correct 7 ms 29020 KB Output is correct
19 Correct 7 ms 29268 KB Output is correct
20 Correct 7 ms 29020 KB Output is correct
21 Correct 7 ms 29016 KB Output is correct
22 Correct 7 ms 29020 KB Output is correct
23 Correct 7 ms 29020 KB Output is correct
24 Correct 9 ms 29020 KB Output is correct
25 Correct 7 ms 29020 KB Output is correct
26 Correct 8 ms 29324 KB Output is correct
27 Correct 9 ms 29276 KB Output is correct
28 Correct 8 ms 29404 KB Output is correct
29 Correct 8 ms 29276 KB Output is correct
30 Correct 8 ms 29276 KB Output is correct
31 Correct 8 ms 29424 KB Output is correct
32 Correct 8 ms 29276 KB Output is correct
33 Correct 8 ms 29244 KB Output is correct
34 Correct 8 ms 29276 KB Output is correct
35 Correct 7 ms 29020 KB Output is correct
36 Correct 8 ms 29016 KB Output is correct
37 Correct 8 ms 29136 KB Output is correct
38 Correct 7 ms 29024 KB Output is correct
39 Correct 8 ms 29020 KB Output is correct
40 Correct 8 ms 29020 KB Output is correct
41 Correct 8 ms 29120 KB Output is correct
42 Correct 7 ms 29024 KB Output is correct
43 Correct 8 ms 29144 KB Output is correct
44 Correct 8 ms 29020 KB Output is correct
45 Correct 7 ms 29028 KB Output is correct
46 Correct 7 ms 29140 KB Output is correct
47 Correct 8 ms 29028 KB Output is correct
48 Correct 9 ms 29020 KB Output is correct
49 Correct 7 ms 29020 KB Output is correct
50 Correct 8 ms 29248 KB Output is correct
51 Correct 8 ms 29132 KB Output is correct
52 Correct 8 ms 29032 KB Output is correct
53 Correct 7 ms 29032 KB Output is correct
54 Correct 9 ms 29672 KB Output is correct
55 Correct 9 ms 29736 KB Output is correct
56 Correct 8 ms 29288 KB Output is correct
57 Correct 8 ms 29460 KB Output is correct
58 Correct 9 ms 29280 KB Output is correct
59 Correct 9 ms 29368 KB Output is correct
60 Correct 8 ms 29272 KB Output is correct
61 Correct 8 ms 29272 KB Output is correct
62 Correct 8 ms 29452 KB Output is correct
63 Correct 10 ms 29388 KB Output is correct
64 Correct 7 ms 29288 KB Output is correct
65 Correct 10 ms 29272 KB Output is correct
66 Correct 9 ms 29288 KB Output is correct
67 Correct 9 ms 29540 KB Output is correct
68 Correct 9 ms 29272 KB Output is correct
69 Correct 9 ms 29380 KB Output is correct
70 Correct 8 ms 29276 KB Output is correct
71 Correct 10 ms 29144 KB Output is correct
72 Correct 9 ms 29364 KB Output is correct
73 Correct 9 ms 29284 KB Output is correct
74 Correct 9 ms 29528 KB Output is correct
75 Correct 10 ms 29248 KB Output is correct
76 Correct 10 ms 29448 KB Output is correct
77 Correct 8 ms 29272 KB Output is correct
78 Correct 8 ms 29356 KB Output is correct
79 Correct 8 ms 29288 KB Output is correct
80 Correct 8 ms 29288 KB Output is correct
81 Correct 8 ms 29252 KB Output is correct
82 Correct 8 ms 29288 KB Output is correct
83 Correct 9 ms 29288 KB Output is correct
84 Correct 8 ms 29288 KB Output is correct
85 Correct 8 ms 29252 KB Output is correct
86 Correct 9 ms 29288 KB Output is correct
87 Correct 9 ms 29288 KB Output is correct
88 Correct 10 ms 29436 KB Output is correct
89 Correct 9 ms 29288 KB Output is correct
90 Correct 8 ms 29136 KB Output is correct
91 Correct 8 ms 29288 KB Output is correct
92 Correct 10 ms 29412 KB Output is correct
93 Correct 9 ms 29288 KB Output is correct
94 Correct 10 ms 29288 KB Output is correct
95 Correct 8 ms 29288 KB Output is correct
96 Correct 8 ms 29436 KB Output is correct
97 Correct 10 ms 29272 KB Output is correct
98 Correct 9 ms 29276 KB Output is correct
99 Correct 10 ms 29276 KB Output is correct
100 Correct 8 ms 29272 KB Output is correct
101 Correct 11 ms 29416 KB Output is correct
102 Correct 9 ms 29136 KB Output is correct
103 Correct 10 ms 29016 KB Output is correct
104 Correct 7 ms 29020 KB Output is correct
105 Correct 7 ms 29032 KB Output is correct
106 Correct 7 ms 29020 KB Output is correct
107 Correct 7 ms 29020 KB Output is correct
108 Correct 7 ms 29148 KB Output is correct
109 Correct 7 ms 29020 KB Output is correct
110 Correct 8 ms 29152 KB Output is correct
111 Correct 8 ms 29256 KB Output is correct
112 Correct 8 ms 29276 KB Output is correct
113 Correct 7 ms 29276 KB Output is correct
114 Correct 10 ms 29280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 48 ms 43604 KB Output is correct
2 Correct 46 ms 43604 KB Output is correct
3 Correct 32 ms 39000 KB Output is correct
4 Correct 13 ms 31320 KB Output is correct
5 Correct 13 ms 30496 KB Output is correct
6 Correct 17 ms 32428 KB Output is correct
7 Correct 8 ms 29276 KB Output is correct
8 Correct 26 ms 33836 KB Output is correct
9 Correct 32 ms 36192 KB Output is correct
10 Correct 7 ms 29276 KB Output is correct
11 Correct 42 ms 37972 KB Output is correct
12 Correct 52 ms 40644 KB Output is correct
13 Correct 8 ms 29272 KB Output is correct
14 Correct 7 ms 29020 KB Output is correct
15 Correct 9 ms 29236 KB Output is correct
16 Correct 7 ms 29020 KB Output is correct
17 Correct 8 ms 29152 KB Output is correct
18 Correct 9 ms 29020 KB Output is correct
19 Correct 7 ms 29132 KB Output is correct
20 Correct 7 ms 29020 KB Output is correct
21 Correct 7 ms 29244 KB Output is correct
22 Correct 7 ms 29236 KB Output is correct
23 Correct 7 ms 29240 KB Output is correct
24 Correct 7 ms 29020 KB Output is correct
25 Correct 8 ms 29104 KB Output is correct
26 Correct 9 ms 29020 KB Output is correct
27 Correct 8 ms 29020 KB Output is correct
28 Correct 7 ms 29020 KB Output is correct
29 Correct 8 ms 29016 KB Output is correct
30 Correct 8 ms 29020 KB Output is correct
31 Correct 7 ms 29020 KB Output is correct
32 Correct 7 ms 29268 KB Output is correct
33 Correct 7 ms 29020 KB Output is correct
34 Correct 7 ms 29016 KB Output is correct
35 Correct 7 ms 29020 KB Output is correct
36 Correct 7 ms 29020 KB Output is correct
37 Correct 9 ms 29020 KB Output is correct
38 Correct 7 ms 29020 KB Output is correct
39 Correct 47 ms 43724 KB Output is correct
40 Correct 46 ms 43804 KB Output is correct
41 Correct 36 ms 39004 KB Output is correct
42 Correct 13 ms 31324 KB Output is correct
43 Correct 8 ms 29020 KB Output is correct
44 Correct 7 ms 29016 KB Output is correct
45 Correct 7 ms 29020 KB Output is correct
46 Correct 8 ms 29256 KB Output is correct
47 Correct 8 ms 29020 KB Output is correct
48 Correct 7 ms 29020 KB Output is correct
49 Correct 9 ms 29240 KB Output is correct
50 Correct 8 ms 29392 KB Output is correct
51 Correct 8 ms 29144 KB Output is correct
52 Correct 7 ms 29020 KB Output is correct
53 Correct 8 ms 29264 KB Output is correct
54 Correct 7 ms 29272 KB Output is correct
55 Correct 7 ms 29020 KB Output is correct
56 Correct 8 ms 29020 KB Output is correct
57 Correct 49 ms 34904 KB Output is correct
58 Correct 48 ms 34896 KB Output is correct
59 Correct 54 ms 35152 KB Output is correct
60 Correct 52 ms 35152 KB Output is correct
61 Correct 49 ms 35028 KB Output is correct
62 Correct 52 ms 35156 KB Output is correct
63 Correct 73 ms 34596 KB Output is correct
64 Correct 49 ms 34624 KB Output is correct
65 Correct 51 ms 35108 KB Output is correct
66 Correct 48 ms 34956 KB Output is correct
67 Correct 54 ms 34896 KB Output is correct
68 Correct 52 ms 35016 KB Output is correct
69 Correct 52 ms 35412 KB Output is correct
70 Correct 60 ms 35280 KB Output is correct
71 Correct 8 ms 29016 KB Output is correct
72 Correct 9 ms 29276 KB Output is correct
73 Correct 8 ms 29360 KB Output is correct
74 Correct 9 ms 29272 KB Output is correct
75 Correct 8 ms 29276 KB Output is correct
76 Correct 8 ms 29280 KB Output is correct
77 Correct 9 ms 29276 KB Output is correct
78 Correct 9 ms 29276 KB Output is correct
79 Correct 9 ms 29276 KB Output is correct
80 Correct 51 ms 35024 KB Output is correct
81 Correct 50 ms 34896 KB Output is correct
82 Correct 54 ms 35172 KB Output is correct
83 Correct 54 ms 34976 KB Output is correct
84 Correct 11 ms 29276 KB Output is correct
85 Correct 10 ms 29276 KB Output is correct
86 Correct 8 ms 29276 KB Output is correct
87 Correct 11 ms 29252 KB Output is correct
88 Correct 8 ms 29276 KB Output is correct
89 Correct 9 ms 29408 KB Output is correct
90 Correct 9 ms 29380 KB Output is correct
91 Correct 9 ms 29276 KB Output is correct
92 Correct 11 ms 29276 KB Output is correct
93 Correct 8 ms 29276 KB Output is correct
94 Correct 8 ms 29016 KB Output is correct
95 Correct 8 ms 29016 KB Output is correct
96 Correct 8 ms 29020 KB Output is correct
97 Correct 7 ms 29020 KB Output is correct
98 Correct 7 ms 29020 KB Output is correct
99 Correct 7 ms 29116 KB Output is correct
100 Correct 7 ms 29020 KB Output is correct
101 Correct 8 ms 29020 KB Output is correct
102 Correct 7 ms 29020 KB Output is correct
103 Correct 7 ms 29020 KB Output is correct
104 Correct 12 ms 30324 KB Output is correct
105 Correct 18 ms 32404 KB Output is correct
106 Correct 8 ms 29272 KB Output is correct
107 Correct 27 ms 33876 KB Output is correct
108 Correct 35 ms 36256 KB Output is correct
109 Correct 8 ms 29128 KB Output is correct
110 Correct 59 ms 38320 KB Output is correct
111 Correct 56 ms 40788 KB Output is correct
112 Correct 8 ms 29276 KB Output is correct
113 Correct 74 ms 45500 KB Output is correct
114 Correct 30 ms 32472 KB Output is correct
115 Correct 28 ms 32468 KB Output is correct
116 Correct 29 ms 32472 KB Output is correct
117 Correct 28 ms 32596 KB Output is correct
118 Correct 28 ms 32468 KB Output is correct
119 Correct 29 ms 32736 KB Output is correct
120 Correct 30 ms 32600 KB Output is correct
121 Correct 27 ms 32316 KB Output is correct
122 Correct 28 ms 32428 KB Output is correct
123 Correct 25 ms 32604 KB Output is correct
124 Correct 7 ms 29016 KB Output is correct
125 Correct 11 ms 30168 KB Output is correct
126 Correct 11 ms 30140 KB Output is correct
127 Correct 11 ms 30132 KB Output is correct
128 Correct 11 ms 30128 KB Output is correct
129 Correct 11 ms 30164 KB Output is correct
130 Correct 11 ms 30168 KB Output is correct
131 Correct 11 ms 30164 KB Output is correct
132 Correct 11 ms 30168 KB Output is correct
133 Correct 7 ms 29256 KB Output is correct
134 Correct 7 ms 29020 KB Output is correct
135 Correct 7 ms 29148 KB Output is correct
136 Correct 13 ms 30168 KB Output is correct
137 Correct 8 ms 29324 KB Output is correct
138 Correct 9 ms 29276 KB Output is correct
139 Correct 8 ms 29404 KB Output is correct
140 Correct 8 ms 29276 KB Output is correct
141 Correct 8 ms 29276 KB Output is correct
142 Correct 8 ms 29424 KB Output is correct
143 Correct 8 ms 29276 KB Output is correct
144 Correct 8 ms 29244 KB Output is correct
145 Correct 8 ms 29276 KB Output is correct
146 Correct 7 ms 29020 KB Output is correct
147 Correct 8 ms 29016 KB Output is correct
148 Correct 8 ms 29136 KB Output is correct
149 Correct 7 ms 29024 KB Output is correct
150 Correct 8 ms 29020 KB Output is correct
151 Correct 8 ms 29020 KB Output is correct
152 Correct 8 ms 29120 KB Output is correct
153 Correct 7 ms 29024 KB Output is correct
154 Correct 8 ms 29144 KB Output is correct
155 Correct 8 ms 29020 KB Output is correct
156 Correct 7 ms 29028 KB Output is correct
157 Correct 7 ms 29140 KB Output is correct
158 Correct 8 ms 29028 KB Output is correct
159 Correct 9 ms 29020 KB Output is correct
160 Correct 7 ms 29020 KB Output is correct
161 Correct 8 ms 29248 KB Output is correct
162 Correct 8 ms 29132 KB Output is correct
163 Correct 8 ms 29032 KB Output is correct
164 Correct 7 ms 29032 KB Output is correct
165 Correct 9 ms 29672 KB Output is correct
166 Correct 9 ms 29736 KB Output is correct
167 Correct 8 ms 29288 KB Output is correct
168 Correct 8 ms 29460 KB Output is correct
169 Correct 9 ms 29280 KB Output is correct
170 Correct 9 ms 29368 KB Output is correct
171 Correct 8 ms 29272 KB Output is correct
172 Correct 8 ms 29272 KB Output is correct
173 Correct 8 ms 29452 KB Output is correct
174 Correct 10 ms 29388 KB Output is correct
175 Correct 7 ms 29288 KB Output is correct
176 Correct 10 ms 29272 KB Output is correct
177 Correct 9 ms 29288 KB Output is correct
178 Correct 9 ms 29540 KB Output is correct
179 Correct 9 ms 29272 KB Output is correct
180 Correct 9 ms 29380 KB Output is correct
181 Correct 8 ms 29276 KB Output is correct
182 Correct 10 ms 29144 KB Output is correct
183 Correct 9 ms 29364 KB Output is correct
184 Correct 9 ms 29284 KB Output is correct
185 Correct 9 ms 29528 KB Output is correct
186 Correct 10 ms 29248 KB Output is correct
187 Correct 10 ms 29448 KB Output is correct
188 Correct 8 ms 29272 KB Output is correct
189 Correct 8 ms 29356 KB Output is correct
190 Correct 8 ms 29288 KB Output is correct
191 Correct 8 ms 29288 KB Output is correct
192 Correct 8 ms 29252 KB Output is correct
193 Correct 8 ms 29288 KB Output is correct
194 Correct 9 ms 29288 KB Output is correct
195 Correct 8 ms 29288 KB Output is correct
196 Correct 8 ms 29252 KB Output is correct
197 Correct 9 ms 29288 KB Output is correct
198 Correct 9 ms 29288 KB Output is correct
199 Correct 10 ms 29436 KB Output is correct
200 Correct 9 ms 29288 KB Output is correct
201 Correct 8 ms 29136 KB Output is correct
202 Correct 8 ms 29288 KB Output is correct
203 Correct 10 ms 29412 KB Output is correct
204 Correct 9 ms 29288 KB Output is correct
205 Correct 10 ms 29288 KB Output is correct
206 Correct 8 ms 29288 KB Output is correct
207 Correct 8 ms 29436 KB Output is correct
208 Correct 10 ms 29272 KB Output is correct
209 Correct 9 ms 29276 KB Output is correct
210 Correct 10 ms 29276 KB Output is correct
211 Correct 8 ms 29272 KB Output is correct
212 Correct 11 ms 29416 KB Output is correct
213 Correct 9 ms 29136 KB Output is correct
214 Correct 10 ms 29016 KB Output is correct
215 Correct 7 ms 29020 KB Output is correct
216 Correct 7 ms 29032 KB Output is correct
217 Correct 7 ms 29020 KB Output is correct
218 Correct 7 ms 29020 KB Output is correct
219 Correct 7 ms 29148 KB Output is correct
220 Correct 7 ms 29020 KB Output is correct
221 Correct 8 ms 29152 KB Output is correct
222 Correct 8 ms 29256 KB Output is correct
223 Correct 8 ms 29276 KB Output is correct
224 Correct 7 ms 29276 KB Output is correct
225 Correct 10 ms 29280 KB Output is correct
226 Correct 8 ms 29276 KB Output is correct
227 Correct 8 ms 29276 KB Output is correct
228 Correct 9 ms 29276 KB Output is correct
229 Correct 41 ms 33500 KB Output is correct
230 Correct 47 ms 34388 KB Output is correct
231 Correct 8 ms 29276 KB Output is correct
232 Correct 8 ms 29360 KB Output is correct
233 Correct 8 ms 29276 KB Output is correct
234 Correct 40 ms 33736 KB Output is correct
235 Correct 44 ms 34384 KB Output is correct
236 Correct 8 ms 29288 KB Output is correct
237 Correct 8 ms 29288 KB Output is correct
238 Correct 10 ms 29288 KB Output is correct
239 Correct 37 ms 33632 KB Output is correct
240 Correct 41 ms 34656 KB Output is correct
241 Correct 28 ms 32472 KB Output is correct
242 Correct 31 ms 32564 KB Output is correct
243 Correct 24 ms 32472 KB Output is correct
244 Correct 23 ms 32468 KB Output is correct
245 Correct 25 ms 32476 KB Output is correct
246 Correct 25 ms 32732 KB Output is correct
247 Correct 25 ms 32588 KB Output is correct
248 Correct 31 ms 32348 KB Output is correct
249 Correct 23 ms 32348 KB Output is correct
250 Correct 26 ms 32604 KB Output is correct
251 Correct 8 ms 29020 KB Output is correct
252 Correct 49 ms 43728 KB Output is correct
253 Correct 48 ms 43688 KB Output is correct
254 Correct 36 ms 38916 KB Output is correct
255 Correct 13 ms 31404 KB Output is correct
256 Correct 7 ms 29020 KB Output is correct
257 Correct 7 ms 29260 KB Output is correct
258 Correct 8 ms 29016 KB Output is correct
259 Correct 8 ms 29020 KB Output is correct
260 Correct 7 ms 29236 KB Output is correct
261 Correct 9 ms 29016 KB Output is correct
262 Correct 9 ms 29020 KB Output is correct
263 Correct 8 ms 29028 KB Output is correct
264 Correct 7 ms 29016 KB Output is correct
265 Correct 7 ms 29132 KB Output is correct
266 Correct 8 ms 29020 KB Output is correct
267 Correct 7 ms 29020 KB Output is correct
268 Correct 8 ms 29488 KB Output is correct
269 Correct 7 ms 29020 KB Output is correct
270 Correct 8 ms 29116 KB Output is correct
271 Correct 8 ms 29020 KB Output is correct
272 Correct 55 ms 34912 KB Output is correct
273 Correct 55 ms 34900 KB Output is correct
274 Correct 52 ms 35156 KB Output is correct
275 Correct 54 ms 35156 KB Output is correct
276 Correct 11 ms 30168 KB Output is correct
277 Correct 11 ms 30168 KB Output is correct
278 Correct 48 ms 35112 KB Output is correct
279 Correct 49 ms 35164 KB Output is correct
280 Correct 48 ms 34604 KB Output is correct
281 Correct 50 ms 34652 KB Output is correct
282 Correct 53 ms 34868 KB Output is correct
283 Correct 50 ms 35008 KB Output is correct
284 Correct 51 ms 34896 KB Output is correct
285 Correct 50 ms 34900 KB Output is correct
286 Correct 53 ms 35408 KB Output is correct
287 Correct 53 ms 35408 KB Output is correct
288 Correct 11 ms 30164 KB Output is correct
289 Correct 11 ms 30168 KB Output is correct
290 Correct 11 ms 30164 KB Output is correct
291 Correct 10 ms 30164 KB Output is correct
292 Correct 11 ms 30164 KB Output is correct
293 Correct 14 ms 30164 KB Output is correct
294 Correct 8 ms 29020 KB Output is correct
295 Correct 7 ms 29020 KB Output is correct
296 Correct 9 ms 29528 KB Output is correct
297 Correct 9 ms 29532 KB Output is correct
298 Correct 50 ms 35156 KB Output is correct
299 Correct 50 ms 34660 KB Output is correct
300 Correct 8 ms 29276 KB Output is correct
301 Correct 8 ms 29336 KB Output is correct
302 Correct 10 ms 29248 KB Output is correct
303 Correct 9 ms 29404 KB Output is correct
304 Correct 8 ms 29124 KB Output is correct
305 Correct 8 ms 29272 KB Output is correct
306 Correct 9 ms 29272 KB Output is correct
307 Correct 8 ms 29276 KB Output is correct
308 Correct 7 ms 29276 KB Output is correct
309 Correct 8 ms 29276 KB Output is correct
310 Correct 8 ms 29272 KB Output is correct
311 Correct 9 ms 29276 KB Output is correct
312 Correct 8 ms 29272 KB Output is correct
313 Correct 9 ms 29528 KB Output is correct
314 Correct 8 ms 29276 KB Output is correct
315 Correct 8 ms 29276 KB Output is correct
316 Correct 8 ms 29284 KB Output is correct
317 Correct 9 ms 29284 KB Output is correct
318 Correct 8 ms 29428 KB Output is correct
319 Correct 8 ms 29276 KB Output is correct
320 Correct 8 ms 29380 KB Output is correct
321 Correct 8 ms 29276 KB Output is correct
322 Correct 8 ms 29276 KB Output is correct
323 Correct 8 ms 29276 KB Output is correct
324 Correct 7 ms 29276 KB Output is correct
325 Correct 7 ms 29276 KB Output is correct
326 Correct 8 ms 29368 KB Output is correct
327 Correct 8 ms 29416 KB Output is correct
328 Correct 9 ms 29144 KB Output is correct
329 Correct 8 ms 29276 KB Output is correct
330 Correct 8 ms 29276 KB Output is correct
331 Correct 9 ms 29280 KB Output is correct
332 Correct 8 ms 29288 KB Output is correct
333 Correct 8 ms 29288 KB Output is correct
334 Correct 8 ms 29288 KB Output is correct
335 Correct 9 ms 29124 KB Output is correct
336 Correct 60 ms 43872 KB Output is correct
337 Correct 64 ms 45236 KB Output is correct
338 Correct 49 ms 34812 KB Output is correct
339 Correct 50 ms 34912 KB Output is correct
340 Correct 19 ms 31704 KB Output is correct
341 Correct 26 ms 32616 KB Output is correct
342 Correct 51 ms 35100 KB Output is correct
343 Correct 52 ms 35128 KB Output is correct
344 Correct 31 ms 33360 KB Output is correct
345 Correct 24 ms 32464 KB Output is correct
346 Correct 51 ms 34900 KB Output is correct
347 Correct 50 ms 35156 KB Output is correct
348 Correct 47 ms 34868 KB Output is correct
349 Correct 39 ms 34368 KB Output is correct
350 Correct 50 ms 35176 KB Output is correct
351 Correct 51 ms 35152 KB Output is correct
352 Correct 12 ms 30424 KB Output is correct
353 Correct 42 ms 34388 KB Output is correct
354 Correct 26 ms 32468 KB Output is correct
355 Correct 25 ms 32460 KB Output is correct
356 Correct 39 ms 34136 KB Output is correct
357 Correct 16 ms 31192 KB Output is correct
358 Correct 26 ms 32472 KB Output is correct
359 Correct 26 ms 32512 KB Output is correct
360 Correct 11 ms 30168 KB Output is correct
361 Correct 11 ms 30420 KB Output is correct
362 Correct 46 ms 35116 KB Output is correct
363 Correct 46 ms 34896 KB Output is correct
364 Correct 32 ms 33184 KB Output is correct
365 Correct 25 ms 32092 KB Output is correct
366 Correct 32 ms 33372 KB Output is correct
367 Correct 36 ms 33620 KB Output is correct
368 Correct 38 ms 34128 KB Output is correct
369 Correct 33 ms 33620 KB Output is correct
370 Correct 27 ms 32756 KB Output is correct
371 Correct 40 ms 34228 KB Output is correct
372 Correct 9 ms 29272 KB Output is correct
373 Correct 8 ms 29276 KB Output is correct
374 Correct 9 ms 29272 KB Output is correct
375 Correct 8 ms 29276 KB Output is correct
376 Correct 10 ms 29420 KB Output is correct
377 Correct 8 ms 29272 KB Output is correct
378 Correct 9 ms 29420 KB Output is correct
379 Correct 8 ms 29356 KB Output is correct
380 Correct 9 ms 29388 KB Output is correct
381 Correct 8 ms 29276 KB Output is correct
382 Correct 7 ms 29024 KB Output is correct
383 Correct 8 ms 29020 KB Output is correct
384 Correct 7 ms 29020 KB Output is correct
385 Correct 8 ms 29020 KB Output is correct
386 Correct 7 ms 29020 KB Output is correct
387 Correct 7 ms 29240 KB Output is correct
388 Correct 8 ms 29016 KB Output is correct
389 Correct 7 ms 29020 KB Output is correct
390 Correct 7 ms 29020 KB Output is correct
391 Correct 7 ms 29016 KB Output is correct
392 Correct 12 ms 30300 KB Output is correct
393 Correct 18 ms 32460 KB Output is correct
394 Correct 8 ms 29276 KB Output is correct
395 Correct 26 ms 33872 KB Output is correct
396 Correct 33 ms 36228 KB Output is correct
397 Correct 8 ms 29272 KB Output is correct
398 Correct 47 ms 38268 KB Output is correct
399 Correct 53 ms 40752 KB Output is correct
400 Correct 8 ms 29276 KB Output is correct
401 Correct 67 ms 45500 KB Output is correct