Submission #64871

# Submission time Handle Problem Language Result Execution time Memory
64871 2018-08-06T00:54:27 Z qkxwsm Duathlon (APIO18_duathlon) C++17
100 / 100
692 ms 66360 KB
/*
PROG: source
LANG: C++11
_____
.'     '.
/  0   0  \
|     ^     |
|  \     /  |
\  '---'  /
'._____.'
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

struct chash
{
        int operator()(int x) const
        {
                x ^= (x >> 20) ^ (x >> 12);
                return x ^ (x >> 7) ^ (x >> 4);
        }
        int operator()(long long x) const
        {
                return x ^ (x >> 32);
        }
};

template<typename T> using orderedset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using hashtable = gp_hash_table<T, T, chash>;

template<class T>
void readi(T &x)
{
        T input = 0;
        bool negative = false;
        char c = ' ';
        while (c < '-')
        {
                c = getchar();
        }
        if (c == '-')
        {
                negative = true;
                c = getchar();
        }
        while (c >= '0')
        {
                input = input * 10 + (c - '0');
                c = getchar();
        }
        if (negative)
        {
                input = -input;
        }
        x = input;
}
template<class T>
void printi(T output)
{
        if (output == 0)
        {
                putchar('0');
                return;
        }
        if (output < 0)
        {
                putchar('-');
                output = -output;
        }
        int aout[20];
        int ilen = 0;
        while(output)
        {
                aout[ilen] = ((output % 10));
                output /= 10;
                ilen++;
        }
        for (int i = ilen - 1; i >= 0; i--)
        {
                putchar(aout[i] + '0');
        }
        return;
}
template<class T>
void ckmin(T &a, T b)
{
        a = min(a, b);
}
template<class T>
void ckmax(T &a, T b)
{
        a = max(a, b);
}
template<class T>
T normalize(T x, T mod = 1000000007)
{
        return (((x % mod) + mod) % mod);
}
long long randomizell(long long mod)
{
        return ((1ll << 45) * rand() + (1ll << 30) * rand() + (1ll << 15) * rand() + rand()) % mod;
}
int randomize(int mod)
{
        return ((1ll << 15) * rand() + rand()) % mod;
}

#define y0 ___y0
#define y1 ___y1
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define debug(x) cerr << #x << " = " << x << endl;

const long double PI = 4.0 * atan(1.0);
const long double EPS = 1e-10;

#define MAGIC 347
#define SINF 10007
#define CO 1000007
#define INF 1000000007
#define BIG 1000000931
#define LARGE 1696969696967ll
#define GIANT 2564008813937411ll
#define LLINF 2696969696969696969ll
#define MAXN 200013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

int N, M, T, K;
vector<int> edge[MAXN], edge1[MAXN];
int sz[MAXN];
vector<pii> bridge;
vector<pii> edges;
bool ap[MAXN];
vector<int> bcc[MAXN];
int id[MAXN], aid[MAXN];
int parent[MAXN];
int subtree[MAXN];
int disc[MAXN], low[MAXN];
int dsu[MAXN], dsz[MAXN];
vector<int> nodes[MAXN];
bool seen[MAXN];
ll ans = 0, tot = 0;

int find_parent(int u)
{
        return (u == dsu[u] ? u : dsu[u] = find_parent(dsu[u]));
}
void merge(int u, int v)
{
        u = find_parent(u);
        v = find_parent(v);
        if (u == v) return;
        if (dsz[u] > dsz[v])
        {
                swap(u, v);
        }
        dsz[v] += dsz[u];
        dsz[u] = 0;
        dsu[u] = v;
        return;
}
void dfs(int u, bool head = false)
{
        disc[u] = T;
        low[u] = T;
        seen[u] = true;
        T++;
        int children = 0;
        for (int v : edge[u])
        {
                if (v == parent[u])
                {
                        continue;
                }
                if (seen[v])
                {
                        ckmin(low[u], disc[v]);
                        continue;
                }
                // cerr << u << " to " << v << endl;
                children++;
                parent[v] = u;
                edges.PB({u, v});
                dfs(v);
                ckmin(low[u], low[v]);
                // if (u == 5) cerr << low[v] << '&' << disc[u] << endl;
                if (low[v] >= disc[u])
                {
                        if (low[v] != disc[u])
                        {
                                bridge.PB({u, v});
                        }
                        if (!head)
                        {
                                ap[u] = true;
                                while(edges.back() != MP(u, v))
                                {
                                        bcc[K].PB(edges.back().fi);
                                        bcc[K].PB(edges.back().se);
                                        edges.pop_back();
                                }
                                bcc[K].PB(edges.back().fi);
                                bcc[K].PB(edges.back().se);
                                edges.pop_back();
                                K++;
                        }
                }
                if (head)
                {
                        if (children > 1)
                        {
                                ap[u] = true;
                        }
                        while(edges.back() != MP(u, v))
                        {
                                bcc[K].PB(edges.back().fi);
                                bcc[K].PB(edges.back().se);
                                edges.pop_back();
                        }
                        bcc[K].PB(edges.back().fi);
                        bcc[K].PB(edges.back().se);
                        edges.pop_back();
                        K++;
                }
        }
}
void dfs1(int u)
{
        subtree[u] = sz[u];
        for (int v : edge1[u])
        {
                if (v == parent[u])
                {
                        continue;
                }
                parent[v] = u;
                dfs1(v);
                subtree[u] += subtree[v];
        }
        return;
}

int32_t main()
{
        ios_base::sync_with_stdio(0);
        srand(time(0));
        //	cout << fixed << setprecision(10);
        //	cerr << fixed << setprecision(10);
        if (fopen("input.in", "r"))
        {
                freopen ("input.in", "r", stdin);
                freopen ("output.out", "w", stdout);
        }
        cin >> N >> M;
        for (int i = 0; i < N; i++)
        {
                dsu[i] = i;
                dsz[i] = i;
        }
        for (int i = 0; i < M; i++)
        {
                int u, v;
                cin >> u >> v;
                u--; v--;
                edge[u].PB(v);
                edge[v].PB(u);
                merge(u, v);
        }
        for (int i = 0; i < N; i++)
        {
                parent[i] = INF;
        }
        for (int i = 0; i < N; i++)
        {
                nodes[find_parent(i)].PB(i);
        }
        for (int cc = 0; cc < N; cc++)
        {
                if (find_parent(cc) != cc)
                {
                        continue;
                }
                int n = nodes[cc].size();
                dfs(cc, 1);
                for (int i = 0; i < K; i++)
                {
                        sort(bcc[i].begin(), bcc[i].end());
                        bcc[i].erase(unique(bcc[i].begin(), bcc[i].end()), bcc[i].end());
                        // cerr << "bcc # " << i << ":";
                        for (int u : bcc[i])
                        {
                                // cerr << ' ' << u;
                                id[u] = i;
                                if (!ap[u])
                                {
                                        sz[i]++;
                                }
                        }
                        // cerr << endl;
                }
                for (int i = 0; i < n; i++)
                {
                        int u = nodes[cc][i];
                        if (ap[u])
                        {
                                aid[u] = K;
                                sz[K] = 1;
                                K++;
                                // cerr << "ap " << u << " id " << K - 1 << endl;
                        }
                }
                for (int i = 0; i < K; i++)
                {
                        // cerr << "bcc " << i << ":";
                        for (int u : bcc[i])
                        {
                                // cerr << ' ' << u;
                                if (ap[u])
                                {
                                        edge1[i].PB(aid[u]);
                                        edge1[aid[u]].PB(i);
                                }
                        }
                        // cerr << endl;
                }
                // for (int i = 0; i < K; i++)
                // {
                //         for (int u : edge1[i])
                //         {
                //                 if (i <= u) cerr << i << " -> " << u << endl;
                //         }
                // }
                // for (int i = 0; i < K; i++)
                // {
                //         cerr << sz[i] << ' ';
                // }
                // cerr << endl;
                for (int i = 0; i < K; i++)
                {
                        parent[i] = INF;
                }
                dfs1(0);
                //all 3 distinct blocks
                //the only violations allowed are: guy -> ap in u -> u
                for (int i = 0; i < K; i++)
                {
                        tot += 1ll * (n - sz[i]) * sz[i] * (n - sz[i] - 1);
                        if (bcc[i].empty())
                        {
                                for (int v : edge1[i])
                                {
                                        for (int w : edge1[v])
                                        {
                                                if (w == i) continue;
                                                if (w == parent[v]) continue;
                                                // if (i == 4) cerr << w << 'X' << v << endl;
                                                tot -= 1ll * subtree[w] * (subtree[w] - 1);
                                        }
                                        // tot -= 1ll * (n - subtree[parent[v]]) * (n - subtree[parent[v]] - 1);
                                }
                                tot -= 1ll * (n - subtree[parent[i]]) * (n - subtree[parent[i]] - 1);
                        }
                        else
                        {
                                for (int v : edge1[i])
                                {
                                        if (v == parent[i]) continue;
                                        tot -= 1ll * sz[i] * (subtree[v]) * (subtree[v] - 1);
                                }
                                tot -= 1ll * sz[i] * (n - subtree[i]) * (n - subtree[i] - 1);
                        }
                        // cerr << "after center " << i << " get " << tot << endl;
                        // tot += 2ll * sz[i] * (n - subtree[i]) * (subtree[i] - sz[i]);
                }
                // debug(tot);
                //three equal guys
                for (int i = 0; i < K; i++)
                {
                        tot += 1ll * sz[i] * (sz[i] - 1) * (sz[i] - 2);
                }
                // debug(tot);
                //a=b or b=c BUT NOT BOTH!
                for (int i = 0; i < K; i++)
                {
                        tot += 2ll * sz[i] * (sz[i] - 1) * (n - sz[i]);
                }
                // debug(tot);
                if (sz[0] == n)
                {
                        ans += 1ll * n * (n - 1) * (n - 2);
                }
                else
                {
                        ans += tot;
                }
                for (int i = 0; i < K; i++)
                {
                        bcc[i].clear();
                        sz[i] = 0;
                        edge1[i].clear();
                        subtree[i] = 0;
                        parent[i] = INF;
                }
                K = 0; T = 0; tot = 0;
        }
        // for (int i = 0; i < K; i++)
        // {
        //     for (int v : edge1[i])
        //     {
        //         cerr << i << "->" << v << endl;
        //     }
        //     cerr << "size " << i << " = " << sz[i] << endl;
        // }
        // for (int i = 0; i < K; i++)
        // {
        //         cerr << "subtree " << i << "=" << subtree[i] << endl;
        // }
        //if a -> b must pass through c, then: a -> b -> c is bad; c -> b -> a is bad, c -> a -> b is bad, b -> a -> c
        //three separate components
        cout << ans << '\n';
        //	cerr << "time elapsed = " << (clock() / (CLOCKS_PER_SEC / 1000)) << " ms" << endl;
        return 0;
}

Compilation message

count_triplets.cpp: In function 'int32_t main()':
count_triplets.cpp:266:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
                 freopen ("input.in", "r", stdin);
                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:267:25: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
                 freopen ("output.out", "w", stdout);
                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 21 ms 19192 KB Output is correct
2 Correct 20 ms 19316 KB Output is correct
3 Correct 23 ms 19316 KB Output is correct
4 Correct 25 ms 19316 KB Output is correct
5 Correct 23 ms 19316 KB Output is correct
6 Correct 21 ms 19316 KB Output is correct
7 Correct 22 ms 19316 KB Output is correct
8 Correct 21 ms 19368 KB Output is correct
9 Correct 22 ms 19452 KB Output is correct
10 Correct 22 ms 19452 KB Output is correct
11 Correct 22 ms 19584 KB Output is correct
12 Correct 18 ms 19584 KB Output is correct
13 Correct 22 ms 19584 KB Output is correct
14 Correct 22 ms 19584 KB Output is correct
15 Correct 23 ms 19584 KB Output is correct
16 Correct 23 ms 19652 KB Output is correct
17 Correct 23 ms 19652 KB Output is correct
18 Correct 19 ms 19652 KB Output is correct
19 Correct 22 ms 19652 KB Output is correct
20 Correct 19 ms 19652 KB Output is correct
21 Correct 20 ms 19652 KB Output is correct
22 Correct 19 ms 19652 KB Output is correct
23 Correct 19 ms 19652 KB Output is correct
24 Correct 19 ms 19652 KB Output is correct
25 Correct 19 ms 19652 KB Output is correct
26 Correct 19 ms 19652 KB Output is correct
27 Correct 25 ms 19652 KB Output is correct
28 Correct 28 ms 19652 KB Output is correct
29 Correct 30 ms 19652 KB Output is correct
30 Correct 20 ms 19652 KB Output is correct
31 Correct 20 ms 19652 KB Output is correct
32 Correct 20 ms 19656 KB Output is correct
33 Correct 23 ms 19660 KB Output is correct
34 Correct 21 ms 19664 KB Output is correct
35 Correct 20 ms 19664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 19192 KB Output is correct
2 Correct 20 ms 19316 KB Output is correct
3 Correct 23 ms 19316 KB Output is correct
4 Correct 25 ms 19316 KB Output is correct
5 Correct 23 ms 19316 KB Output is correct
6 Correct 21 ms 19316 KB Output is correct
7 Correct 22 ms 19316 KB Output is correct
8 Correct 21 ms 19368 KB Output is correct
9 Correct 22 ms 19452 KB Output is correct
10 Correct 22 ms 19452 KB Output is correct
11 Correct 22 ms 19584 KB Output is correct
12 Correct 18 ms 19584 KB Output is correct
13 Correct 22 ms 19584 KB Output is correct
14 Correct 22 ms 19584 KB Output is correct
15 Correct 23 ms 19584 KB Output is correct
16 Correct 23 ms 19652 KB Output is correct
17 Correct 23 ms 19652 KB Output is correct
18 Correct 19 ms 19652 KB Output is correct
19 Correct 22 ms 19652 KB Output is correct
20 Correct 19 ms 19652 KB Output is correct
21 Correct 20 ms 19652 KB Output is correct
22 Correct 19 ms 19652 KB Output is correct
23 Correct 19 ms 19652 KB Output is correct
24 Correct 19 ms 19652 KB Output is correct
25 Correct 19 ms 19652 KB Output is correct
26 Correct 19 ms 19652 KB Output is correct
27 Correct 25 ms 19652 KB Output is correct
28 Correct 28 ms 19652 KB Output is correct
29 Correct 30 ms 19652 KB Output is correct
30 Correct 20 ms 19652 KB Output is correct
31 Correct 20 ms 19652 KB Output is correct
32 Correct 20 ms 19656 KB Output is correct
33 Correct 23 ms 19660 KB Output is correct
34 Correct 21 ms 19664 KB Output is correct
35 Correct 20 ms 19664 KB Output is correct
36 Correct 20 ms 19672 KB Output is correct
37 Correct 23 ms 19676 KB Output is correct
38 Correct 21 ms 19680 KB Output is correct
39 Correct 22 ms 19684 KB Output is correct
40 Correct 22 ms 19688 KB Output is correct
41 Correct 22 ms 19696 KB Output is correct
42 Correct 20 ms 19696 KB Output is correct
43 Correct 30 ms 19700 KB Output is correct
44 Correct 19 ms 19776 KB Output is correct
45 Correct 18 ms 19776 KB Output is correct
46 Correct 23 ms 19776 KB Output is correct
47 Correct 18 ms 19776 KB Output is correct
48 Correct 23 ms 19776 KB Output is correct
49 Correct 22 ms 19776 KB Output is correct
50 Correct 22 ms 19776 KB Output is correct
51 Correct 21 ms 19776 KB Output is correct
52 Correct 20 ms 19776 KB Output is correct
53 Correct 23 ms 19872 KB Output is correct
54 Correct 22 ms 19872 KB Output is correct
55 Correct 22 ms 19872 KB Output is correct
56 Correct 22 ms 19872 KB Output is correct
57 Correct 20 ms 19872 KB Output is correct
58 Correct 23 ms 19896 KB Output is correct
59 Correct 23 ms 19896 KB Output is correct
60 Correct 23 ms 19896 KB Output is correct
61 Correct 22 ms 19896 KB Output is correct
62 Correct 21 ms 19896 KB Output is correct
63 Correct 24 ms 19896 KB Output is correct
64 Correct 23 ms 19896 KB Output is correct
65 Correct 24 ms 19896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 171 ms 37340 KB Output is correct
2 Correct 145 ms 37340 KB Output is correct
3 Correct 214 ms 38344 KB Output is correct
4 Correct 171 ms 38524 KB Output is correct
5 Correct 255 ms 38524 KB Output is correct
6 Correct 220 ms 38892 KB Output is correct
7 Correct 195 ms 38892 KB Output is correct
8 Correct 189 ms 38892 KB Output is correct
9 Correct 206 ms 38892 KB Output is correct
10 Correct 237 ms 38892 KB Output is correct
11 Correct 195 ms 38892 KB Output is correct
12 Correct 180 ms 38892 KB Output is correct
13 Correct 212 ms 38892 KB Output is correct
14 Correct 157 ms 38892 KB Output is correct
15 Correct 121 ms 38892 KB Output is correct
16 Correct 139 ms 38892 KB Output is correct
17 Correct 37 ms 38892 KB Output is correct
18 Correct 37 ms 38892 KB Output is correct
19 Correct 44 ms 38892 KB Output is correct
20 Correct 46 ms 38892 KB Output is correct
21 Correct 36 ms 38892 KB Output is correct
22 Correct 36 ms 38892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 38892 KB Output is correct
2 Correct 24 ms 38892 KB Output is correct
3 Correct 24 ms 38892 KB Output is correct
4 Correct 24 ms 38892 KB Output is correct
5 Correct 24 ms 38892 KB Output is correct
6 Correct 23 ms 38892 KB Output is correct
7 Correct 24 ms 38892 KB Output is correct
8 Correct 26 ms 38892 KB Output is correct
9 Correct 25 ms 38892 KB Output is correct
10 Correct 24 ms 38892 KB Output is correct
11 Correct 24 ms 38892 KB Output is correct
12 Correct 25 ms 38892 KB Output is correct
13 Correct 23 ms 38892 KB Output is correct
14 Correct 21 ms 38892 KB Output is correct
15 Correct 23 ms 38892 KB Output is correct
16 Correct 25 ms 38892 KB Output is correct
17 Correct 25 ms 38892 KB Output is correct
18 Correct 22 ms 38892 KB Output is correct
19 Correct 23 ms 38892 KB Output is correct
20 Correct 21 ms 38892 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 196 ms 38892 KB Output is correct
2 Correct 308 ms 38892 KB Output is correct
3 Correct 304 ms 38892 KB Output is correct
4 Correct 291 ms 38892 KB Output is correct
5 Correct 197 ms 38892 KB Output is correct
6 Correct 261 ms 49356 KB Output is correct
7 Correct 264 ms 49356 KB Output is correct
8 Correct 317 ms 49356 KB Output is correct
9 Correct 315 ms 49356 KB Output is correct
10 Correct 232 ms 49356 KB Output is correct
11 Correct 252 ms 49356 KB Output is correct
12 Correct 190 ms 49356 KB Output is correct
13 Correct 158 ms 49356 KB Output is correct
14 Correct 158 ms 49356 KB Output is correct
15 Correct 133 ms 49356 KB Output is correct
16 Correct 106 ms 49356 KB Output is correct
17 Correct 156 ms 49356 KB Output is correct
18 Correct 157 ms 49356 KB Output is correct
19 Correct 143 ms 49356 KB Output is correct
20 Correct 180 ms 49356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 49356 KB Output is correct
2 Correct 22 ms 49356 KB Output is correct
3 Correct 23 ms 49356 KB Output is correct
4 Correct 23 ms 49356 KB Output is correct
5 Correct 25 ms 49356 KB Output is correct
6 Correct 23 ms 49356 KB Output is correct
7 Correct 26 ms 49356 KB Output is correct
8 Correct 24 ms 49356 KB Output is correct
9 Correct 25 ms 49356 KB Output is correct
10 Correct 20 ms 49356 KB Output is correct
11 Correct 19 ms 49356 KB Output is correct
12 Correct 21 ms 49356 KB Output is correct
13 Correct 20 ms 49356 KB Output is correct
14 Correct 20 ms 49356 KB Output is correct
15 Correct 22 ms 49356 KB Output is correct
16 Correct 29 ms 49356 KB Output is correct
17 Correct 21 ms 49356 KB Output is correct
18 Correct 23 ms 49356 KB Output is correct
19 Correct 22 ms 49356 KB Output is correct
20 Correct 19 ms 49356 KB Output is correct
21 Correct 19 ms 49356 KB Output is correct
22 Correct 20 ms 49356 KB Output is correct
23 Correct 24 ms 49356 KB Output is correct
24 Correct 21 ms 49356 KB Output is correct
25 Correct 23 ms 49356 KB Output is correct
26 Correct 22 ms 49356 KB Output is correct
27 Correct 21 ms 49356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 223 ms 49356 KB Output is correct
2 Correct 210 ms 49356 KB Output is correct
3 Correct 208 ms 49356 KB Output is correct
4 Correct 197 ms 49356 KB Output is correct
5 Correct 176 ms 49356 KB Output is correct
6 Correct 260 ms 49356 KB Output is correct
7 Correct 190 ms 49356 KB Output is correct
8 Correct 195 ms 49356 KB Output is correct
9 Correct 193 ms 49356 KB Output is correct
10 Correct 205 ms 49356 KB Output is correct
11 Correct 187 ms 49356 KB Output is correct
12 Correct 177 ms 49356 KB Output is correct
13 Correct 154 ms 49356 KB Output is correct
14 Correct 168 ms 49356 KB Output is correct
15 Correct 302 ms 49356 KB Output is correct
16 Correct 227 ms 49356 KB Output is correct
17 Correct 278 ms 49356 KB Output is correct
18 Correct 227 ms 49356 KB Output is correct
19 Correct 194 ms 49356 KB Output is correct
20 Correct 243 ms 49356 KB Output is correct
21 Correct 224 ms 49356 KB Output is correct
22 Correct 215 ms 49356 KB Output is correct
23 Correct 163 ms 49356 KB Output is correct
24 Correct 193 ms 49356 KB Output is correct
25 Correct 230 ms 49356 KB Output is correct
26 Correct 195 ms 49356 KB Output is correct
27 Correct 240 ms 49356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 19192 KB Output is correct
2 Correct 20 ms 19316 KB Output is correct
3 Correct 23 ms 19316 KB Output is correct
4 Correct 25 ms 19316 KB Output is correct
5 Correct 23 ms 19316 KB Output is correct
6 Correct 21 ms 19316 KB Output is correct
7 Correct 22 ms 19316 KB Output is correct
8 Correct 21 ms 19368 KB Output is correct
9 Correct 22 ms 19452 KB Output is correct
10 Correct 22 ms 19452 KB Output is correct
11 Correct 22 ms 19584 KB Output is correct
12 Correct 18 ms 19584 KB Output is correct
13 Correct 22 ms 19584 KB Output is correct
14 Correct 22 ms 19584 KB Output is correct
15 Correct 23 ms 19584 KB Output is correct
16 Correct 23 ms 19652 KB Output is correct
17 Correct 23 ms 19652 KB Output is correct
18 Correct 19 ms 19652 KB Output is correct
19 Correct 22 ms 19652 KB Output is correct
20 Correct 19 ms 19652 KB Output is correct
21 Correct 20 ms 19652 KB Output is correct
22 Correct 19 ms 19652 KB Output is correct
23 Correct 19 ms 19652 KB Output is correct
24 Correct 19 ms 19652 KB Output is correct
25 Correct 19 ms 19652 KB Output is correct
26 Correct 19 ms 19652 KB Output is correct
27 Correct 25 ms 19652 KB Output is correct
28 Correct 28 ms 19652 KB Output is correct
29 Correct 30 ms 19652 KB Output is correct
30 Correct 20 ms 19652 KB Output is correct
31 Correct 20 ms 19652 KB Output is correct
32 Correct 20 ms 19656 KB Output is correct
33 Correct 23 ms 19660 KB Output is correct
34 Correct 21 ms 19664 KB Output is correct
35 Correct 20 ms 19664 KB Output is correct
36 Correct 20 ms 19672 KB Output is correct
37 Correct 23 ms 19676 KB Output is correct
38 Correct 21 ms 19680 KB Output is correct
39 Correct 22 ms 19684 KB Output is correct
40 Correct 22 ms 19688 KB Output is correct
41 Correct 22 ms 19696 KB Output is correct
42 Correct 20 ms 19696 KB Output is correct
43 Correct 30 ms 19700 KB Output is correct
44 Correct 19 ms 19776 KB Output is correct
45 Correct 18 ms 19776 KB Output is correct
46 Correct 23 ms 19776 KB Output is correct
47 Correct 18 ms 19776 KB Output is correct
48 Correct 23 ms 19776 KB Output is correct
49 Correct 22 ms 19776 KB Output is correct
50 Correct 22 ms 19776 KB Output is correct
51 Correct 21 ms 19776 KB Output is correct
52 Correct 20 ms 19776 KB Output is correct
53 Correct 23 ms 19872 KB Output is correct
54 Correct 22 ms 19872 KB Output is correct
55 Correct 22 ms 19872 KB Output is correct
56 Correct 22 ms 19872 KB Output is correct
57 Correct 20 ms 19872 KB Output is correct
58 Correct 23 ms 19896 KB Output is correct
59 Correct 23 ms 19896 KB Output is correct
60 Correct 23 ms 19896 KB Output is correct
61 Correct 22 ms 19896 KB Output is correct
62 Correct 21 ms 19896 KB Output is correct
63 Correct 24 ms 19896 KB Output is correct
64 Correct 23 ms 19896 KB Output is correct
65 Correct 24 ms 19896 KB Output is correct
66 Correct 22 ms 49356 KB Output is correct
67 Correct 25 ms 49356 KB Output is correct
68 Correct 23 ms 49356 KB Output is correct
69 Correct 21 ms 49356 KB Output is correct
70 Correct 22 ms 49356 KB Output is correct
71 Correct 21 ms 49356 KB Output is correct
72 Correct 22 ms 49356 KB Output is correct
73 Correct 22 ms 49356 KB Output is correct
74 Correct 23 ms 49356 KB Output is correct
75 Correct 21 ms 49356 KB Output is correct
76 Correct 21 ms 49356 KB Output is correct
77 Correct 25 ms 49356 KB Output is correct
78 Correct 22 ms 49356 KB Output is correct
79 Correct 20 ms 49356 KB Output is correct
80 Correct 23 ms 49356 KB Output is correct
81 Correct 23 ms 49356 KB Output is correct
82 Correct 23 ms 49356 KB Output is correct
83 Correct 24 ms 49356 KB Output is correct
84 Correct 28 ms 49356 KB Output is correct
85 Correct 24 ms 49356 KB Output is correct
86 Correct 25 ms 49356 KB Output is correct
87 Correct 25 ms 49356 KB Output is correct
88 Correct 24 ms 49356 KB Output is correct
89 Correct 21 ms 49356 KB Output is correct
90 Correct 21 ms 49356 KB Output is correct
91 Correct 20 ms 49356 KB Output is correct
92 Correct 21 ms 49356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 19192 KB Output is correct
2 Correct 20 ms 19316 KB Output is correct
3 Correct 23 ms 19316 KB Output is correct
4 Correct 25 ms 19316 KB Output is correct
5 Correct 23 ms 19316 KB Output is correct
6 Correct 21 ms 19316 KB Output is correct
7 Correct 22 ms 19316 KB Output is correct
8 Correct 21 ms 19368 KB Output is correct
9 Correct 22 ms 19452 KB Output is correct
10 Correct 22 ms 19452 KB Output is correct
11 Correct 22 ms 19584 KB Output is correct
12 Correct 18 ms 19584 KB Output is correct
13 Correct 22 ms 19584 KB Output is correct
14 Correct 22 ms 19584 KB Output is correct
15 Correct 23 ms 19584 KB Output is correct
16 Correct 23 ms 19652 KB Output is correct
17 Correct 23 ms 19652 KB Output is correct
18 Correct 19 ms 19652 KB Output is correct
19 Correct 22 ms 19652 KB Output is correct
20 Correct 19 ms 19652 KB Output is correct
21 Correct 20 ms 19652 KB Output is correct
22 Correct 19 ms 19652 KB Output is correct
23 Correct 19 ms 19652 KB Output is correct
24 Correct 19 ms 19652 KB Output is correct
25 Correct 19 ms 19652 KB Output is correct
26 Correct 19 ms 19652 KB Output is correct
27 Correct 25 ms 19652 KB Output is correct
28 Correct 28 ms 19652 KB Output is correct
29 Correct 30 ms 19652 KB Output is correct
30 Correct 20 ms 19652 KB Output is correct
31 Correct 20 ms 19652 KB Output is correct
32 Correct 20 ms 19656 KB Output is correct
33 Correct 23 ms 19660 KB Output is correct
34 Correct 21 ms 19664 KB Output is correct
35 Correct 20 ms 19664 KB Output is correct
36 Correct 20 ms 19672 KB Output is correct
37 Correct 23 ms 19676 KB Output is correct
38 Correct 21 ms 19680 KB Output is correct
39 Correct 22 ms 19684 KB Output is correct
40 Correct 22 ms 19688 KB Output is correct
41 Correct 22 ms 19696 KB Output is correct
42 Correct 20 ms 19696 KB Output is correct
43 Correct 30 ms 19700 KB Output is correct
44 Correct 19 ms 19776 KB Output is correct
45 Correct 18 ms 19776 KB Output is correct
46 Correct 23 ms 19776 KB Output is correct
47 Correct 18 ms 19776 KB Output is correct
48 Correct 23 ms 19776 KB Output is correct
49 Correct 22 ms 19776 KB Output is correct
50 Correct 22 ms 19776 KB Output is correct
51 Correct 21 ms 19776 KB Output is correct
52 Correct 20 ms 19776 KB Output is correct
53 Correct 23 ms 19872 KB Output is correct
54 Correct 22 ms 19872 KB Output is correct
55 Correct 22 ms 19872 KB Output is correct
56 Correct 22 ms 19872 KB Output is correct
57 Correct 20 ms 19872 KB Output is correct
58 Correct 23 ms 19896 KB Output is correct
59 Correct 23 ms 19896 KB Output is correct
60 Correct 23 ms 19896 KB Output is correct
61 Correct 22 ms 19896 KB Output is correct
62 Correct 21 ms 19896 KB Output is correct
63 Correct 24 ms 19896 KB Output is correct
64 Correct 23 ms 19896 KB Output is correct
65 Correct 24 ms 19896 KB Output is correct
66 Correct 171 ms 37340 KB Output is correct
67 Correct 145 ms 37340 KB Output is correct
68 Correct 214 ms 38344 KB Output is correct
69 Correct 171 ms 38524 KB Output is correct
70 Correct 255 ms 38524 KB Output is correct
71 Correct 220 ms 38892 KB Output is correct
72 Correct 195 ms 38892 KB Output is correct
73 Correct 189 ms 38892 KB Output is correct
74 Correct 206 ms 38892 KB Output is correct
75 Correct 237 ms 38892 KB Output is correct
76 Correct 195 ms 38892 KB Output is correct
77 Correct 180 ms 38892 KB Output is correct
78 Correct 212 ms 38892 KB Output is correct
79 Correct 157 ms 38892 KB Output is correct
80 Correct 121 ms 38892 KB Output is correct
81 Correct 139 ms 38892 KB Output is correct
82 Correct 37 ms 38892 KB Output is correct
83 Correct 37 ms 38892 KB Output is correct
84 Correct 44 ms 38892 KB Output is correct
85 Correct 46 ms 38892 KB Output is correct
86 Correct 36 ms 38892 KB Output is correct
87 Correct 36 ms 38892 KB Output is correct
88 Correct 23 ms 38892 KB Output is correct
89 Correct 24 ms 38892 KB Output is correct
90 Correct 24 ms 38892 KB Output is correct
91 Correct 24 ms 38892 KB Output is correct
92 Correct 24 ms 38892 KB Output is correct
93 Correct 23 ms 38892 KB Output is correct
94 Correct 24 ms 38892 KB Output is correct
95 Correct 26 ms 38892 KB Output is correct
96 Correct 25 ms 38892 KB Output is correct
97 Correct 24 ms 38892 KB Output is correct
98 Correct 24 ms 38892 KB Output is correct
99 Correct 25 ms 38892 KB Output is correct
100 Correct 23 ms 38892 KB Output is correct
101 Correct 21 ms 38892 KB Output is correct
102 Correct 23 ms 38892 KB Output is correct
103 Correct 25 ms 38892 KB Output is correct
104 Correct 25 ms 38892 KB Output is correct
105 Correct 22 ms 38892 KB Output is correct
106 Correct 23 ms 38892 KB Output is correct
107 Correct 21 ms 38892 KB Output is correct
108 Correct 196 ms 38892 KB Output is correct
109 Correct 308 ms 38892 KB Output is correct
110 Correct 304 ms 38892 KB Output is correct
111 Correct 291 ms 38892 KB Output is correct
112 Correct 197 ms 38892 KB Output is correct
113 Correct 261 ms 49356 KB Output is correct
114 Correct 264 ms 49356 KB Output is correct
115 Correct 317 ms 49356 KB Output is correct
116 Correct 315 ms 49356 KB Output is correct
117 Correct 232 ms 49356 KB Output is correct
118 Correct 252 ms 49356 KB Output is correct
119 Correct 190 ms 49356 KB Output is correct
120 Correct 158 ms 49356 KB Output is correct
121 Correct 158 ms 49356 KB Output is correct
122 Correct 133 ms 49356 KB Output is correct
123 Correct 106 ms 49356 KB Output is correct
124 Correct 156 ms 49356 KB Output is correct
125 Correct 157 ms 49356 KB Output is correct
126 Correct 143 ms 49356 KB Output is correct
127 Correct 180 ms 49356 KB Output is correct
128 Correct 22 ms 49356 KB Output is correct
129 Correct 22 ms 49356 KB Output is correct
130 Correct 23 ms 49356 KB Output is correct
131 Correct 23 ms 49356 KB Output is correct
132 Correct 25 ms 49356 KB Output is correct
133 Correct 23 ms 49356 KB Output is correct
134 Correct 26 ms 49356 KB Output is correct
135 Correct 24 ms 49356 KB Output is correct
136 Correct 25 ms 49356 KB Output is correct
137 Correct 20 ms 49356 KB Output is correct
138 Correct 19 ms 49356 KB Output is correct
139 Correct 21 ms 49356 KB Output is correct
140 Correct 20 ms 49356 KB Output is correct
141 Correct 20 ms 49356 KB Output is correct
142 Correct 22 ms 49356 KB Output is correct
143 Correct 29 ms 49356 KB Output is correct
144 Correct 21 ms 49356 KB Output is correct
145 Correct 23 ms 49356 KB Output is correct
146 Correct 22 ms 49356 KB Output is correct
147 Correct 19 ms 49356 KB Output is correct
148 Correct 19 ms 49356 KB Output is correct
149 Correct 20 ms 49356 KB Output is correct
150 Correct 24 ms 49356 KB Output is correct
151 Correct 21 ms 49356 KB Output is correct
152 Correct 23 ms 49356 KB Output is correct
153 Correct 22 ms 49356 KB Output is correct
154 Correct 21 ms 49356 KB Output is correct
155 Correct 223 ms 49356 KB Output is correct
156 Correct 210 ms 49356 KB Output is correct
157 Correct 208 ms 49356 KB Output is correct
158 Correct 197 ms 49356 KB Output is correct
159 Correct 176 ms 49356 KB Output is correct
160 Correct 260 ms 49356 KB Output is correct
161 Correct 190 ms 49356 KB Output is correct
162 Correct 195 ms 49356 KB Output is correct
163 Correct 193 ms 49356 KB Output is correct
164 Correct 205 ms 49356 KB Output is correct
165 Correct 187 ms 49356 KB Output is correct
166 Correct 177 ms 49356 KB Output is correct
167 Correct 154 ms 49356 KB Output is correct
168 Correct 168 ms 49356 KB Output is correct
169 Correct 302 ms 49356 KB Output is correct
170 Correct 227 ms 49356 KB Output is correct
171 Correct 278 ms 49356 KB Output is correct
172 Correct 227 ms 49356 KB Output is correct
173 Correct 194 ms 49356 KB Output is correct
174 Correct 243 ms 49356 KB Output is correct
175 Correct 224 ms 49356 KB Output is correct
176 Correct 215 ms 49356 KB Output is correct
177 Correct 163 ms 49356 KB Output is correct
178 Correct 193 ms 49356 KB Output is correct
179 Correct 230 ms 49356 KB Output is correct
180 Correct 195 ms 49356 KB Output is correct
181 Correct 240 ms 49356 KB Output is correct
182 Correct 22 ms 49356 KB Output is correct
183 Correct 25 ms 49356 KB Output is correct
184 Correct 23 ms 49356 KB Output is correct
185 Correct 21 ms 49356 KB Output is correct
186 Correct 22 ms 49356 KB Output is correct
187 Correct 21 ms 49356 KB Output is correct
188 Correct 22 ms 49356 KB Output is correct
189 Correct 22 ms 49356 KB Output is correct
190 Correct 23 ms 49356 KB Output is correct
191 Correct 21 ms 49356 KB Output is correct
192 Correct 21 ms 49356 KB Output is correct
193 Correct 25 ms 49356 KB Output is correct
194 Correct 22 ms 49356 KB Output is correct
195 Correct 20 ms 49356 KB Output is correct
196 Correct 23 ms 49356 KB Output is correct
197 Correct 23 ms 49356 KB Output is correct
198 Correct 23 ms 49356 KB Output is correct
199 Correct 24 ms 49356 KB Output is correct
200 Correct 28 ms 49356 KB Output is correct
201 Correct 24 ms 49356 KB Output is correct
202 Correct 25 ms 49356 KB Output is correct
203 Correct 25 ms 49356 KB Output is correct
204 Correct 24 ms 49356 KB Output is correct
205 Correct 21 ms 49356 KB Output is correct
206 Correct 21 ms 49356 KB Output is correct
207 Correct 20 ms 49356 KB Output is correct
208 Correct 21 ms 49356 KB Output is correct
209 Correct 29 ms 49356 KB Output is correct
210 Correct 109 ms 49356 KB Output is correct
211 Correct 692 ms 49356 KB Output is correct
212 Correct 449 ms 49356 KB Output is correct
213 Correct 412 ms 49356 KB Output is correct
214 Correct 80 ms 49356 KB Output is correct
215 Correct 90 ms 49356 KB Output is correct
216 Correct 205 ms 49356 KB Output is correct
217 Correct 242 ms 49356 KB Output is correct
218 Correct 168 ms 49356 KB Output is correct
219 Correct 205 ms 49356 KB Output is correct
220 Correct 170 ms 49356 KB Output is correct
221 Correct 144 ms 49356 KB Output is correct
222 Correct 173 ms 50916 KB Output is correct
223 Correct 327 ms 58416 KB Output is correct
224 Correct 212 ms 58676 KB Output is correct
225 Correct 188 ms 58676 KB Output is correct
226 Correct 222 ms 58676 KB Output is correct
227 Correct 210 ms 58676 KB Output is correct
228 Correct 156 ms 58676 KB Output is correct
229 Correct 152 ms 60040 KB Output is correct
230 Correct 176 ms 64384 KB Output is correct
231 Correct 160 ms 66360 KB Output is correct