Submission #886701

# Submission time Handle Problem Language Result Execution time Memory
886701 2023-12-12T17:04:39 Z Kutan Duathlon (APIO18_duathlon) C++14
100 / 100
81 ms 41496 KB
// Cao Quang Hung
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long , long long>
#define vi vector<int>
#define vpii vector<pii>
#define SZ(x) ((int)(x.size()))
#define fi first
#define se second
#define IN(x,y) ((y).find((x))!=(y).end())
#define ALL(t) t.begin(),t.end()
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
#define REPD(i,a,b) for(int (i)=(a); (i)>=(b);--i)
#define FOR(i, n) for (int (i) = 0; (i) < (n); ++(i))
#define dem(x) __builtin_popcount(x)
#define Mask(x) (1LL << (x))
#define BIT(x, i) ((x) >> (i) & 1)
#define ln '\n'
#define io_faster ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
///mt19937 rnd(time(0));

const int INF = 1e9 , mod = 1e9 + 7;

template <class T1, class T2>
inline T1 mul(T1& x, const T2 &k){ return x = (1LL * x * k) % mod; }

template <class T1 , class T2>
inline T1 pw(T1 x, T2 k){T1 res = 1; for (; k ; k >>= 1){ if (k & 1) mul(res, x); mul(x, x); } return res;}

template <class T>
inline bool minimize(T &x, const T &y){ if (x > y){x = y; return 1;} return 0; }

template <class T>
inline bool maximize(T &x, const T &y){ if (x < y){x = y; return 1;} return 0; }

template <class T>
inline void add(T &x , const T &y){ if ((x += y) >= mod) x -= mod; }

template <class T>
inline T product (const T &x , const T &y) { return 1LL * x * y % mod; }

#define PROB "a"
void file(){
    if(fopen(PROB".inp", "r")){
        freopen(PROB".inp","r",stdin);
        freopen(PROB".out","w",stdout);
    }
}
void sinh_(){
//    srand(time(0));
//    freopen(PROB".inp" , "w" , stdout);
//    int n;
}

typedef long long ll;
typedef double db;
const int N = 2e5 + 5;

int n, m;
vi adj[N], g[N * 2];
int num[N], low[N], timeDfs(0), numNode;
int f[N*2], sz[N*2], totsize;
stack<int> st;
ll res = 0;

void readip(){
    cin >> n >> m;
    REP(i, 1, m) {
        int u, v; cin >> u >> v;
        adj[u].eb(v);
        adj[v].eb(u);
    }
}

namespace sub3{
    bool check() {
        REP(i, 1, n) if (adj[i].size() > 2) return false;
        return true;
    }

    vector<bool> vis;
    int numNode = 0;

    void dfs(int u) {
        ++numNode;
        vis[u] = true;
        for (int v : adj[u]) if (!vis[v])
            dfs(v);
    }

    void solve() {
        ll res = 0;
        vis.assign(n + 2, 0);
        REP(i, 1, n) if (!vis[i] && adj[i].size() == 1) {
            numNode = 0;
            dfs(i);
            res += 1LL * numNode * (numNode - 1) * (numNode - 2) / 3;
        }
        REP(i, 1, n) if (!vis[i] && adj[i].size() == 2) {
            numNode = 0;
            dfs(i);
            res += 1LL * numNode * (numNode - 1) * (numNode - 2);
        }
        cout << res << ln;
    }   
};

namespace sub5{
    vector<bool> vis;
    bool oke = 1;
    void dfs(int u, int p) {
        if (!oke) return;
        vis[u] = 1;
        for (int v : adj[u]) if (v != p) {
            if (vis[v]) {
                oke = 0;
                return;
            }
            dfs(v, u);
        }
    }

    bool check() {
        vis.assign(n + 2, 0);
        REP(i, 1, n) if (!vis[i]) dfs(i, -1);
        return oke;
    }

    ll res = 0;
    int cnt = 0;
    vector<int> sz, mark, Size;
    void dfs_tree(int u, int p) {
        mark[u] = cnt;
        sz[u] = 0;
        for (int v : adj[u]) if (v != p) {
            dfs_tree(v, u);
            res += 2LL * sz[u] * sz[v];
            sz[u] += sz[v];
        }
        ++sz[u];
    }

    void solve() {
        sz.assign(n + 2, 0);
        mark.assign(n + 2, -1);
        REP(i, 1, n) if (mark[i] == -1) {
            dfs_tree(i, -1);
            Size.eb(sz[i]);
            ++cnt;
        }
        REP(i, 1, n) {
            res += 2LL * (sz[i] - 1) * (Size[mark[i]] - sz[i]);
        }
        cout << res << ln;
    }
};

namespace subfull {
    struct DSU{
        int par[N], sz[N];
        int root(int x) {
            if (x == par[x]) return x;
            return par[x] = root(par[x]);
        }

        void unite(int u, int v) {
            u = root(u) , v = root(v);
            if (u == v) return;
            if (sz[u] < sz[v]) swap(u, v);
            sz[u] += sz[v];
            par[v] = u;
        }

        void process() {
            REP(i, 1, n) par[i] = i, sz[i] = 1;
            REP(u, 1, n) for (int v : adj[u]) 
                unite(u, v);
        }
    } dsu;

    void add_edge(int u, int v) {
        g[u].eb(v);
        g[v].eb(u);
    }

    void dfs(int u) {
        num[u] = low[u] = ++timeDfs;
        st.push(u);
        for (int v : adj[u]) {
            if (num[v]) minimize(low[u], num[v]);
            else {
                dfs(v);
                minimize(low[u], low[v]);
                if (num[u] == low[v]) {
                    ++numNode;
                    add_edge(u, numNode);
                    int x = -1, cnt(0);  
                    do {
                        x = st.top();
                        st.pop();
                        add_edge(x, numNode);
                        ++cnt;
                    } while(x != v) ;

                    f[numNode] = cnt + 1;
                }
            }
        }
    }

    void dfs_tree(int u, int p) {
        sz[u] = (u <= n);
        for (int v : g[u]) if (v != p) {
            // dfs_tree(v, u);
            dfs_tree(v, u);
            res += 1LL * f[u] * sz[u] * sz[v];
            sz[u] += sz[v];
        }
        res += 1LL * sz[u] * (totsize - sz[u]) * f[u];
    }   

    void solve() {
        numNode = n;
        dsu.process();
        REP(i, 1, n) f[i] = -1;
        REP(i, 1, n) if (dsu.root(i) == i) {
            totsize = dsu.sz[i];
            dfs(i);
            dfs_tree(i, -1);
        }
        cout << res * 2LL << ln;
    }
};

void solve(){       
    // if (sub3::check()) {
    //     sub3::solve();
    //     return;
    // }
    // if (sub5::check()) {
    //     sub5::solve();
    //     return;
    // }

    subfull::solve();
}

int main(){
    sinh_();
    io_faster
    file();
    int t = 1;
//    cin >> t;
    while (t--){
        readip();
        solve();
    }
}

Compilation message

count_triplets.cpp: In function 'void readip()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:148:5: note: in expansion of macro 'REP'
  148 |     REP(i, 1, m) {
      |     ^~~
count_triplets.cpp: In function 'bool sub3::check()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:157:9: note: in expansion of macro 'REP'
  157 |         REP(i, 1, n) if (adj[i].size() > 2) return false;
      |         ^~~
count_triplets.cpp: In function 'void sub3::solve()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:174:9: note: in expansion of macro 'REP'
  174 |         REP(i, 1, n) if (!vis[i] && adj[i].size() == 1) {
      |         ^~~
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:179:9: note: in expansion of macro 'REP'
  179 |         REP(i, 1, n) if (!vis[i] && adj[i].size() == 2) {
      |         ^~~
count_triplets.cpp: In function 'bool sub5::check()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:205:9: note: in expansion of macro 'REP'
  205 |         REP(i, 1, n) if (!vis[i]) dfs(i, -1);
      |         ^~~
count_triplets.cpp: In function 'void sub5::solve()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:226:9: note: in expansion of macro 'REP'
  226 |         REP(i, 1, n) if (mark[i] == -1) {
      |         ^~~
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:231:9: note: in expansion of macro 'REP'
  231 |         REP(i, 1, n) {
      |         ^~~
count_triplets.cpp: In member function 'void subfull::DSU::process()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:255:13: note: in expansion of macro 'REP'
  255 |             REP(i, 1, n) par[i] = i, sz[i] = 1;
      |             ^~~
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'u' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:256:13: note: in expansion of macro 'REP'
  256 |             REP(u, 1, n) for (int v : adj[u])
      |             ^~~
count_triplets.cpp: In function 'void subfull::solve()':
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:305:9: note: in expansion of macro 'REP'
  305 |         REP(i, 1, n) f[i] = -1;
      |         ^~~
count_triplets.cpp:92:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   92 | #define REP(i,a,b) for(int (i)=(a);(i)<=(b);++i)
      |                            ^
count_triplets.cpp:306:9: note: in expansion of macro 'REP'
  306 |         REP(i, 1, n) if (dsu.root(i) == i) {
      |         ^~~
count_triplets.cpp: In function 'void file()':
count_triplets.cpp:125:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  125 |         freopen(PROB".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:126:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  126 |         freopen(PROB".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20616 KB Output is correct
5 Correct 4 ms 20568 KB Output is correct
6 Correct 4 ms 20572 KB Output is correct
7 Correct 5 ms 20568 KB Output is correct
8 Correct 5 ms 20572 KB Output is correct
9 Correct 4 ms 20648 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 4 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 4 ms 20572 KB Output is correct
14 Correct 4 ms 20572 KB Output is correct
15 Correct 4 ms 20824 KB Output is correct
16 Correct 4 ms 20568 KB Output is correct
17 Correct 4 ms 20572 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 5 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
21 Correct 4 ms 20572 KB Output is correct
22 Correct 4 ms 20572 KB Output is correct
23 Correct 4 ms 20572 KB Output is correct
24 Correct 6 ms 20568 KB Output is correct
25 Correct 4 ms 20572 KB Output is correct
26 Correct 4 ms 20568 KB Output is correct
27 Correct 4 ms 20584 KB Output is correct
28 Correct 4 ms 20572 KB Output is correct
29 Correct 6 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 5 ms 20828 KB Output is correct
32 Correct 4 ms 20572 KB Output is correct
33 Correct 4 ms 20572 KB Output is correct
34 Correct 4 ms 20572 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20616 KB Output is correct
5 Correct 4 ms 20568 KB Output is correct
6 Correct 4 ms 20572 KB Output is correct
7 Correct 5 ms 20568 KB Output is correct
8 Correct 5 ms 20572 KB Output is correct
9 Correct 4 ms 20648 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 4 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 4 ms 20572 KB Output is correct
14 Correct 4 ms 20572 KB Output is correct
15 Correct 4 ms 20824 KB Output is correct
16 Correct 4 ms 20568 KB Output is correct
17 Correct 4 ms 20572 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 5 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
21 Correct 4 ms 20572 KB Output is correct
22 Correct 4 ms 20572 KB Output is correct
23 Correct 4 ms 20572 KB Output is correct
24 Correct 6 ms 20568 KB Output is correct
25 Correct 4 ms 20572 KB Output is correct
26 Correct 4 ms 20568 KB Output is correct
27 Correct 4 ms 20584 KB Output is correct
28 Correct 4 ms 20572 KB Output is correct
29 Correct 6 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 5 ms 20828 KB Output is correct
32 Correct 4 ms 20572 KB Output is correct
33 Correct 4 ms 20572 KB Output is correct
34 Correct 4 ms 20572 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20636 KB Output is correct
37 Correct 4 ms 20572 KB Output is correct
38 Correct 4 ms 20572 KB Output is correct
39 Correct 5 ms 20572 KB Output is correct
40 Correct 5 ms 20572 KB Output is correct
41 Correct 4 ms 20636 KB Output is correct
42 Correct 5 ms 20596 KB Output is correct
43 Correct 5 ms 20572 KB Output is correct
44 Correct 5 ms 20820 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 4 ms 20640 KB Output is correct
47 Correct 4 ms 20612 KB Output is correct
48 Correct 6 ms 20572 KB Output is correct
49 Correct 4 ms 20572 KB Output is correct
50 Correct 4 ms 20572 KB Output is correct
51 Correct 4 ms 20572 KB Output is correct
52 Correct 4 ms 20568 KB Output is correct
53 Correct 5 ms 20572 KB Output is correct
54 Correct 6 ms 20640 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 4 ms 20572 KB Output is correct
57 Correct 5 ms 20568 KB Output is correct
58 Correct 5 ms 20584 KB Output is correct
59 Correct 5 ms 20568 KB Output is correct
60 Correct 4 ms 20824 KB Output is correct
61 Correct 4 ms 20572 KB Output is correct
62 Correct 4 ms 20636 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 5 ms 20572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 39380 KB Output is correct
2 Correct 53 ms 39372 KB Output is correct
3 Correct 59 ms 35196 KB Output is correct
4 Correct 73 ms 37360 KB Output is correct
5 Correct 63 ms 33908 KB Output is correct
6 Correct 77 ms 38348 KB Output is correct
7 Correct 58 ms 32596 KB Output is correct
8 Correct 68 ms 33360 KB Output is correct
9 Correct 68 ms 31392 KB Output is correct
10 Correct 56 ms 31916 KB Output is correct
11 Correct 46 ms 29460 KB Output is correct
12 Correct 45 ms 29264 KB Output is correct
13 Correct 42 ms 28972 KB Output is correct
14 Correct 43 ms 28756 KB Output is correct
15 Correct 40 ms 28056 KB Output is correct
16 Correct 35 ms 27732 KB Output is correct
17 Correct 6 ms 21080 KB Output is correct
18 Correct 6 ms 21084 KB Output is correct
19 Correct 6 ms 21080 KB Output is correct
20 Correct 7 ms 21096 KB Output is correct
21 Correct 6 ms 21088 KB Output is correct
22 Correct 6 ms 21164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 20644 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 5 ms 20572 KB Output is correct
4 Correct 5 ms 20848 KB Output is correct
5 Correct 5 ms 20828 KB Output is correct
6 Correct 5 ms 20568 KB Output is correct
7 Correct 5 ms 20828 KB Output is correct
8 Correct 5 ms 20824 KB Output is correct
9 Correct 5 ms 20572 KB Output is correct
10 Correct 5 ms 20588 KB Output is correct
11 Correct 5 ms 20644 KB Output is correct
12 Correct 5 ms 20568 KB Output is correct
13 Correct 5 ms 20572 KB Output is correct
14 Correct 5 ms 20572 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 5 ms 20568 KB Output is correct
17 Correct 5 ms 20572 KB Output is correct
18 Correct 6 ms 20572 KB Output is correct
19 Correct 5 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 31376 KB Output is correct
2 Correct 75 ms 31400 KB Output is correct
3 Correct 70 ms 31388 KB Output is correct
4 Correct 73 ms 31544 KB Output is correct
5 Correct 63 ms 31576 KB Output is correct
6 Correct 67 ms 38996 KB Output is correct
7 Correct 72 ms 37460 KB Output is correct
8 Correct 71 ms 35156 KB Output is correct
9 Correct 75 ms 33620 KB Output is correct
10 Correct 68 ms 31468 KB Output is correct
11 Correct 66 ms 31312 KB Output is correct
12 Correct 79 ms 31604 KB Output is correct
13 Correct 77 ms 31164 KB Output is correct
14 Correct 63 ms 30904 KB Output is correct
15 Correct 50 ms 30032 KB Output is correct
16 Correct 33 ms 27884 KB Output is correct
17 Correct 56 ms 31944 KB Output is correct
18 Correct 44 ms 31840 KB Output is correct
19 Correct 55 ms 31944 KB Output is correct
20 Correct 45 ms 31980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 5 ms 20644 KB Output is correct
4 Correct 5 ms 20572 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20568 KB Output is correct
7 Correct 5 ms 20824 KB Output is correct
8 Correct 5 ms 20568 KB Output is correct
9 Correct 5 ms 20568 KB Output is correct
10 Correct 6 ms 20572 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20648 KB Output is correct
13 Correct 5 ms 20572 KB Output is correct
14 Correct 5 ms 20572 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 5 ms 20572 KB Output is correct
17 Correct 5 ms 20572 KB Output is correct
18 Correct 5 ms 20572 KB Output is correct
19 Correct 5 ms 20568 KB Output is correct
20 Correct 5 ms 20572 KB Output is correct
21 Correct 5 ms 20572 KB Output is correct
22 Correct 5 ms 20572 KB Output is correct
23 Correct 5 ms 20644 KB Output is correct
24 Correct 5 ms 20572 KB Output is correct
25 Correct 4 ms 20632 KB Output is correct
26 Correct 5 ms 20572 KB Output is correct
27 Correct 5 ms 20404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 31384 KB Output is correct
2 Correct 68 ms 31196 KB Output is correct
3 Correct 66 ms 30772 KB Output is correct
4 Correct 63 ms 30544 KB Output is correct
5 Correct 61 ms 29748 KB Output is correct
6 Correct 53 ms 29524 KB Output is correct
7 Correct 59 ms 29268 KB Output is correct
8 Correct 49 ms 29092 KB Output is correct
9 Correct 53 ms 29008 KB Output is correct
10 Correct 48 ms 28960 KB Output is correct
11 Correct 61 ms 28920 KB Output is correct
12 Correct 51 ms 28960 KB Output is correct
13 Correct 46 ms 29260 KB Output is correct
14 Correct 61 ms 31648 KB Output is correct
15 Correct 77 ms 41496 KB Output is correct
16 Correct 71 ms 37716 KB Output is correct
17 Correct 76 ms 36824 KB Output is correct
18 Correct 69 ms 36372 KB Output is correct
19 Correct 61 ms 30548 KB Output is correct
20 Correct 61 ms 30544 KB Output is correct
21 Correct 61 ms 30364 KB Output is correct
22 Correct 56 ms 30032 KB Output is correct
23 Correct 50 ms 29388 KB Output is correct
24 Correct 67 ms 31548 KB Output is correct
25 Correct 73 ms 31704 KB Output is correct
26 Correct 60 ms 30936 KB Output is correct
27 Correct 58 ms 31056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20616 KB Output is correct
5 Correct 4 ms 20568 KB Output is correct
6 Correct 4 ms 20572 KB Output is correct
7 Correct 5 ms 20568 KB Output is correct
8 Correct 5 ms 20572 KB Output is correct
9 Correct 4 ms 20648 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 4 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 4 ms 20572 KB Output is correct
14 Correct 4 ms 20572 KB Output is correct
15 Correct 4 ms 20824 KB Output is correct
16 Correct 4 ms 20568 KB Output is correct
17 Correct 4 ms 20572 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 5 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
21 Correct 4 ms 20572 KB Output is correct
22 Correct 4 ms 20572 KB Output is correct
23 Correct 4 ms 20572 KB Output is correct
24 Correct 6 ms 20568 KB Output is correct
25 Correct 4 ms 20572 KB Output is correct
26 Correct 4 ms 20568 KB Output is correct
27 Correct 4 ms 20584 KB Output is correct
28 Correct 4 ms 20572 KB Output is correct
29 Correct 6 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 5 ms 20828 KB Output is correct
32 Correct 4 ms 20572 KB Output is correct
33 Correct 4 ms 20572 KB Output is correct
34 Correct 4 ms 20572 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20636 KB Output is correct
37 Correct 4 ms 20572 KB Output is correct
38 Correct 4 ms 20572 KB Output is correct
39 Correct 5 ms 20572 KB Output is correct
40 Correct 5 ms 20572 KB Output is correct
41 Correct 4 ms 20636 KB Output is correct
42 Correct 5 ms 20596 KB Output is correct
43 Correct 5 ms 20572 KB Output is correct
44 Correct 5 ms 20820 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 4 ms 20640 KB Output is correct
47 Correct 4 ms 20612 KB Output is correct
48 Correct 6 ms 20572 KB Output is correct
49 Correct 4 ms 20572 KB Output is correct
50 Correct 4 ms 20572 KB Output is correct
51 Correct 4 ms 20572 KB Output is correct
52 Correct 4 ms 20568 KB Output is correct
53 Correct 5 ms 20572 KB Output is correct
54 Correct 6 ms 20640 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 4 ms 20572 KB Output is correct
57 Correct 5 ms 20568 KB Output is correct
58 Correct 5 ms 20584 KB Output is correct
59 Correct 5 ms 20568 KB Output is correct
60 Correct 4 ms 20824 KB Output is correct
61 Correct 4 ms 20572 KB Output is correct
62 Correct 4 ms 20636 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 5 ms 20572 KB Output is correct
66 Correct 4 ms 20572 KB Output is correct
67 Correct 5 ms 20572 KB Output is correct
68 Correct 5 ms 20572 KB Output is correct
69 Correct 5 ms 20572 KB Output is correct
70 Correct 6 ms 20576 KB Output is correct
71 Correct 5 ms 20572 KB Output is correct
72 Correct 5 ms 20572 KB Output is correct
73 Correct 5 ms 20572 KB Output is correct
74 Correct 5 ms 20568 KB Output is correct
75 Correct 5 ms 20572 KB Output is correct
76 Correct 5 ms 20572 KB Output is correct
77 Correct 5 ms 20652 KB Output is correct
78 Correct 5 ms 20572 KB Output is correct
79 Correct 5 ms 20572 KB Output is correct
80 Correct 5 ms 20572 KB Output is correct
81 Correct 5 ms 20572 KB Output is correct
82 Correct 6 ms 20824 KB Output is correct
83 Correct 5 ms 20828 KB Output is correct
84 Correct 6 ms 20572 KB Output is correct
85 Correct 5 ms 20580 KB Output is correct
86 Correct 5 ms 20572 KB Output is correct
87 Correct 6 ms 20572 KB Output is correct
88 Correct 5 ms 20572 KB Output is correct
89 Correct 5 ms 20532 KB Output is correct
90 Correct 5 ms 20572 KB Output is correct
91 Correct 5 ms 20572 KB Output is correct
92 Correct 5 ms 20572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20616 KB Output is correct
5 Correct 4 ms 20568 KB Output is correct
6 Correct 4 ms 20572 KB Output is correct
7 Correct 5 ms 20568 KB Output is correct
8 Correct 5 ms 20572 KB Output is correct
9 Correct 4 ms 20648 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 4 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 4 ms 20572 KB Output is correct
14 Correct 4 ms 20572 KB Output is correct
15 Correct 4 ms 20824 KB Output is correct
16 Correct 4 ms 20568 KB Output is correct
17 Correct 4 ms 20572 KB Output is correct
18 Correct 7 ms 20828 KB Output is correct
19 Correct 5 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
21 Correct 4 ms 20572 KB Output is correct
22 Correct 4 ms 20572 KB Output is correct
23 Correct 4 ms 20572 KB Output is correct
24 Correct 6 ms 20568 KB Output is correct
25 Correct 4 ms 20572 KB Output is correct
26 Correct 4 ms 20568 KB Output is correct
27 Correct 4 ms 20584 KB Output is correct
28 Correct 4 ms 20572 KB Output is correct
29 Correct 6 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 5 ms 20828 KB Output is correct
32 Correct 4 ms 20572 KB Output is correct
33 Correct 4 ms 20572 KB Output is correct
34 Correct 4 ms 20572 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20636 KB Output is correct
37 Correct 4 ms 20572 KB Output is correct
38 Correct 4 ms 20572 KB Output is correct
39 Correct 5 ms 20572 KB Output is correct
40 Correct 5 ms 20572 KB Output is correct
41 Correct 4 ms 20636 KB Output is correct
42 Correct 5 ms 20596 KB Output is correct
43 Correct 5 ms 20572 KB Output is correct
44 Correct 5 ms 20820 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 4 ms 20640 KB Output is correct
47 Correct 4 ms 20612 KB Output is correct
48 Correct 6 ms 20572 KB Output is correct
49 Correct 4 ms 20572 KB Output is correct
50 Correct 4 ms 20572 KB Output is correct
51 Correct 4 ms 20572 KB Output is correct
52 Correct 4 ms 20568 KB Output is correct
53 Correct 5 ms 20572 KB Output is correct
54 Correct 6 ms 20640 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 4 ms 20572 KB Output is correct
57 Correct 5 ms 20568 KB Output is correct
58 Correct 5 ms 20584 KB Output is correct
59 Correct 5 ms 20568 KB Output is correct
60 Correct 4 ms 20824 KB Output is correct
61 Correct 4 ms 20572 KB Output is correct
62 Correct 4 ms 20636 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 5 ms 20572 KB Output is correct
66 Correct 54 ms 39380 KB Output is correct
67 Correct 53 ms 39372 KB Output is correct
68 Correct 59 ms 35196 KB Output is correct
69 Correct 73 ms 37360 KB Output is correct
70 Correct 63 ms 33908 KB Output is correct
71 Correct 77 ms 38348 KB Output is correct
72 Correct 58 ms 32596 KB Output is correct
73 Correct 68 ms 33360 KB Output is correct
74 Correct 68 ms 31392 KB Output is correct
75 Correct 56 ms 31916 KB Output is correct
76 Correct 46 ms 29460 KB Output is correct
77 Correct 45 ms 29264 KB Output is correct
78 Correct 42 ms 28972 KB Output is correct
79 Correct 43 ms 28756 KB Output is correct
80 Correct 40 ms 28056 KB Output is correct
81 Correct 35 ms 27732 KB Output is correct
82 Correct 6 ms 21080 KB Output is correct
83 Correct 6 ms 21084 KB Output is correct
84 Correct 6 ms 21080 KB Output is correct
85 Correct 7 ms 21096 KB Output is correct
86 Correct 6 ms 21088 KB Output is correct
87 Correct 6 ms 21164 KB Output is correct
88 Correct 5 ms 20644 KB Output is correct
89 Correct 5 ms 20572 KB Output is correct
90 Correct 5 ms 20572 KB Output is correct
91 Correct 5 ms 20848 KB Output is correct
92 Correct 5 ms 20828 KB Output is correct
93 Correct 5 ms 20568 KB Output is correct
94 Correct 5 ms 20828 KB Output is correct
95 Correct 5 ms 20824 KB Output is correct
96 Correct 5 ms 20572 KB Output is correct
97 Correct 5 ms 20588 KB Output is correct
98 Correct 5 ms 20644 KB Output is correct
99 Correct 5 ms 20568 KB Output is correct
100 Correct 5 ms 20572 KB Output is correct
101 Correct 5 ms 20572 KB Output is correct
102 Correct 5 ms 20572 KB Output is correct
103 Correct 5 ms 20568 KB Output is correct
104 Correct 5 ms 20572 KB Output is correct
105 Correct 6 ms 20572 KB Output is correct
106 Correct 5 ms 20572 KB Output is correct
107 Correct 4 ms 20572 KB Output is correct
108 Correct 76 ms 31376 KB Output is correct
109 Correct 75 ms 31400 KB Output is correct
110 Correct 70 ms 31388 KB Output is correct
111 Correct 73 ms 31544 KB Output is correct
112 Correct 63 ms 31576 KB Output is correct
113 Correct 67 ms 38996 KB Output is correct
114 Correct 72 ms 37460 KB Output is correct
115 Correct 71 ms 35156 KB Output is correct
116 Correct 75 ms 33620 KB Output is correct
117 Correct 68 ms 31468 KB Output is correct
118 Correct 66 ms 31312 KB Output is correct
119 Correct 79 ms 31604 KB Output is correct
120 Correct 77 ms 31164 KB Output is correct
121 Correct 63 ms 30904 KB Output is correct
122 Correct 50 ms 30032 KB Output is correct
123 Correct 33 ms 27884 KB Output is correct
124 Correct 56 ms 31944 KB Output is correct
125 Correct 44 ms 31840 KB Output is correct
126 Correct 55 ms 31944 KB Output is correct
127 Correct 45 ms 31980 KB Output is correct
128 Correct 5 ms 20568 KB Output is correct
129 Correct 5 ms 20572 KB Output is correct
130 Correct 5 ms 20644 KB Output is correct
131 Correct 5 ms 20572 KB Output is correct
132 Correct 5 ms 20572 KB Output is correct
133 Correct 5 ms 20568 KB Output is correct
134 Correct 5 ms 20824 KB Output is correct
135 Correct 5 ms 20568 KB Output is correct
136 Correct 5 ms 20568 KB Output is correct
137 Correct 6 ms 20572 KB Output is correct
138 Correct 5 ms 20572 KB Output is correct
139 Correct 5 ms 20648 KB Output is correct
140 Correct 5 ms 20572 KB Output is correct
141 Correct 5 ms 20572 KB Output is correct
142 Correct 5 ms 20572 KB Output is correct
143 Correct 5 ms 20572 KB Output is correct
144 Correct 5 ms 20572 KB Output is correct
145 Correct 5 ms 20572 KB Output is correct
146 Correct 5 ms 20568 KB Output is correct
147 Correct 5 ms 20572 KB Output is correct
148 Correct 5 ms 20572 KB Output is correct
149 Correct 5 ms 20572 KB Output is correct
150 Correct 5 ms 20644 KB Output is correct
151 Correct 5 ms 20572 KB Output is correct
152 Correct 4 ms 20632 KB Output is correct
153 Correct 5 ms 20572 KB Output is correct
154 Correct 5 ms 20404 KB Output is correct
155 Correct 71 ms 31384 KB Output is correct
156 Correct 68 ms 31196 KB Output is correct
157 Correct 66 ms 30772 KB Output is correct
158 Correct 63 ms 30544 KB Output is correct
159 Correct 61 ms 29748 KB Output is correct
160 Correct 53 ms 29524 KB Output is correct
161 Correct 59 ms 29268 KB Output is correct
162 Correct 49 ms 29092 KB Output is correct
163 Correct 53 ms 29008 KB Output is correct
164 Correct 48 ms 28960 KB Output is correct
165 Correct 61 ms 28920 KB Output is correct
166 Correct 51 ms 28960 KB Output is correct
167 Correct 46 ms 29260 KB Output is correct
168 Correct 61 ms 31648 KB Output is correct
169 Correct 77 ms 41496 KB Output is correct
170 Correct 71 ms 37716 KB Output is correct
171 Correct 76 ms 36824 KB Output is correct
172 Correct 69 ms 36372 KB Output is correct
173 Correct 61 ms 30548 KB Output is correct
174 Correct 61 ms 30544 KB Output is correct
175 Correct 61 ms 30364 KB Output is correct
176 Correct 56 ms 30032 KB Output is correct
177 Correct 50 ms 29388 KB Output is correct
178 Correct 67 ms 31548 KB Output is correct
179 Correct 73 ms 31704 KB Output is correct
180 Correct 60 ms 30936 KB Output is correct
181 Correct 58 ms 31056 KB Output is correct
182 Correct 4 ms 20572 KB Output is correct
183 Correct 5 ms 20572 KB Output is correct
184 Correct 5 ms 20572 KB Output is correct
185 Correct 5 ms 20572 KB Output is correct
186 Correct 6 ms 20576 KB Output is correct
187 Correct 5 ms 20572 KB Output is correct
188 Correct 5 ms 20572 KB Output is correct
189 Correct 5 ms 20572 KB Output is correct
190 Correct 5 ms 20568 KB Output is correct
191 Correct 5 ms 20572 KB Output is correct
192 Correct 5 ms 20572 KB Output is correct
193 Correct 5 ms 20652 KB Output is correct
194 Correct 5 ms 20572 KB Output is correct
195 Correct 5 ms 20572 KB Output is correct
196 Correct 5 ms 20572 KB Output is correct
197 Correct 5 ms 20572 KB Output is correct
198 Correct 6 ms 20824 KB Output is correct
199 Correct 5 ms 20828 KB Output is correct
200 Correct 6 ms 20572 KB Output is correct
201 Correct 5 ms 20580 KB Output is correct
202 Correct 5 ms 20572 KB Output is correct
203 Correct 6 ms 20572 KB Output is correct
204 Correct 5 ms 20572 KB Output is correct
205 Correct 5 ms 20532 KB Output is correct
206 Correct 5 ms 20572 KB Output is correct
207 Correct 5 ms 20572 KB Output is correct
208 Correct 5 ms 20572 KB Output is correct
209 Correct 6 ms 21084 KB Output is correct
210 Correct 35 ms 26964 KB Output is correct
211 Correct 64 ms 31772 KB Output is correct
212 Correct 72 ms 34772 KB Output is correct
213 Correct 76 ms 37064 KB Output is correct
214 Correct 41 ms 29612 KB Output is correct
215 Correct 43 ms 29524 KB Output is correct
216 Correct 81 ms 31060 KB Output is correct
217 Correct 71 ms 30152 KB Output is correct
218 Correct 52 ms 29264 KB Output is correct
219 Correct 50 ms 29012 KB Output is correct
220 Correct 53 ms 28824 KB Output is correct
221 Correct 44 ms 28964 KB Output is correct
222 Correct 58 ms 30292 KB Output is correct
223 Correct 76 ms 35060 KB Output is correct
224 Correct 67 ms 33108 KB Output is correct
225 Correct 63 ms 30036 KB Output is correct
226 Correct 65 ms 29936 KB Output is correct
227 Correct 61 ms 30036 KB Output is correct
228 Correct 55 ms 29508 KB Output is correct
229 Correct 48 ms 29268 KB Output is correct
230 Correct 58 ms 30536 KB Output is correct
231 Correct 58 ms 30544 KB Output is correct