답안 #886724

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
886724 2023-12-12T17:54:09 Z Kutan 철인 이종 경기 (APIO18_duathlon) C++14
100 / 100
76 ms 39952 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);
            sz[u] += sz[v];
            if (u > n) 
                res -= 1LL * (f[u] - 1) * (sz[v]) * (sz[v] - 1);
        }
        if (u > n) res -= 1LL * (f[u] - 1) * (totsize - sz[u]) * (totsize - sz[u] -1);
    }       

    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];
            res += 1LL * totsize * (totsize - 1) * (totsize - 2);
            dfs(i);
            dfs_tree(i, -1);
        }
        cout << res << 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);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 4 ms 20640 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20572 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 4 ms 20572 KB Output is correct
8 Correct 4 ms 20572 KB Output is correct
9 Correct 4 ms 20728 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 5 ms 20584 KB Output is correct
14 Correct 4 ms 20592 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 4 ms 20572 KB Output is correct
17 Correct 4 ms 20408 KB Output is correct
18 Correct 4 ms 20572 KB Output is correct
19 Correct 4 ms 20572 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 20568 KB Output is correct
23 Correct 4 ms 20568 KB Output is correct
24 Correct 4 ms 20572 KB Output is correct
25 Correct 5 ms 20572 KB Output is correct
26 Correct 7 ms 20572 KB Output is correct
27 Correct 5 ms 20568 KB Output is correct
28 Correct 4 ms 20588 KB Output is correct
29 Correct 4 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 4 ms 20604 KB Output is correct
32 Correct 4 ms 20636 KB Output is correct
33 Correct 5 ms 20572 KB Output is correct
34 Correct 4 ms 20568 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 4 ms 20640 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20572 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 4 ms 20572 KB Output is correct
8 Correct 4 ms 20572 KB Output is correct
9 Correct 4 ms 20728 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 5 ms 20584 KB Output is correct
14 Correct 4 ms 20592 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 4 ms 20572 KB Output is correct
17 Correct 4 ms 20408 KB Output is correct
18 Correct 4 ms 20572 KB Output is correct
19 Correct 4 ms 20572 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 20568 KB Output is correct
23 Correct 4 ms 20568 KB Output is correct
24 Correct 4 ms 20572 KB Output is correct
25 Correct 5 ms 20572 KB Output is correct
26 Correct 7 ms 20572 KB Output is correct
27 Correct 5 ms 20568 KB Output is correct
28 Correct 4 ms 20588 KB Output is correct
29 Correct 4 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 4 ms 20604 KB Output is correct
32 Correct 4 ms 20636 KB Output is correct
33 Correct 5 ms 20572 KB Output is correct
34 Correct 4 ms 20568 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20576 KB Output is correct
37 Correct 4 ms 20640 KB Output is correct
38 Correct 5 ms 20824 KB Output is correct
39 Correct 4 ms 20572 KB Output is correct
40 Correct 5 ms 20592 KB Output is correct
41 Correct 5 ms 20572 KB Output is correct
42 Correct 4 ms 20572 KB Output is correct
43 Correct 5 ms 20600 KB Output is correct
44 Correct 5 ms 20568 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 5 ms 20640 KB Output is correct
47 Correct 4 ms 20572 KB Output is correct
48 Correct 4 ms 20596 KB Output is correct
49 Correct 5 ms 20572 KB Output is correct
50 Correct 5 ms 20568 KB Output is correct
51 Correct 4 ms 20568 KB Output is correct
52 Correct 4 ms 20572 KB Output is correct
53 Correct 4 ms 20572 KB Output is correct
54 Correct 4 ms 20568 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 5 ms 20572 KB Output is correct
57 Correct 4 ms 20572 KB Output is correct
58 Correct 5 ms 20568 KB Output is correct
59 Correct 4 ms 20568 KB Output is correct
60 Correct 4 ms 20572 KB Output is correct
61 Correct 5 ms 20572 KB Output is correct
62 Correct 4 ms 20572 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 4 ms 20572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 38200 KB Output is correct
2 Correct 52 ms 38348 KB Output is correct
3 Correct 67 ms 34264 KB Output is correct
4 Correct 58 ms 36300 KB Output is correct
5 Correct 63 ms 32708 KB Output is correct
6 Correct 60 ms 37204 KB Output is correct
7 Correct 73 ms 32216 KB Output is correct
8 Correct 65 ms 32304 KB Output is correct
9 Correct 62 ms 30316 KB Output is correct
10 Correct 56 ms 30800 KB Output is correct
11 Correct 45 ms 28500 KB Output is correct
12 Correct 47 ms 28400 KB Output is correct
13 Correct 43 ms 28236 KB Output is correct
14 Correct 41 ms 27984 KB Output is correct
15 Correct 38 ms 27364 KB Output is correct
16 Correct 35 ms 27000 KB Output is correct
17 Correct 6 ms 21084 KB Output is correct
18 Correct 6 ms 21084 KB Output is correct
19 Correct 6 ms 21084 KB Output is correct
20 Correct 6 ms 21084 KB Output is correct
21 Correct 6 ms 21084 KB Output is correct
22 Correct 8 ms 21084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 5 ms 20572 KB Output is correct
3 Correct 6 ms 20572 KB Output is correct
4 Correct 5 ms 20828 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 5 ms 20828 KB Output is correct
8 Correct 4 ms 20572 KB Output is correct
9 Correct 5 ms 20572 KB Output is correct
10 Correct 5 ms 20572 KB Output is correct
11 Correct 5 ms 20824 KB Output is correct
12 Correct 5 ms 20572 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 20600 KB Output is correct
17 Correct 5 ms 20568 KB Output is correct
18 Correct 4 ms 20572 KB Output is correct
19 Correct 4 ms 20572 KB Output is correct
20 Correct 4 ms 20572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 30384 KB Output is correct
2 Correct 60 ms 30408 KB Output is correct
3 Correct 59 ms 30288 KB Output is correct
4 Correct 61 ms 30300 KB Output is correct
5 Correct 58 ms 30288 KB Output is correct
6 Correct 65 ms 37936 KB Output is correct
7 Correct 67 ms 36440 KB Output is correct
8 Correct 64 ms 34144 KB Output is correct
9 Correct 70 ms 32832 KB Output is correct
10 Correct 60 ms 30152 KB Output is correct
11 Correct 60 ms 30288 KB Output is correct
12 Correct 61 ms 30292 KB Output is correct
13 Correct 59 ms 30288 KB Output is correct
14 Correct 56 ms 29776 KB Output is correct
15 Correct 60 ms 29268 KB Output is correct
16 Correct 33 ms 27216 KB Output is correct
17 Correct 44 ms 30856 KB Output is correct
18 Correct 48 ms 31056 KB Output is correct
19 Correct 45 ms 30928 KB Output is correct
20 Correct 48 ms 30804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 20568 KB Output is correct
2 Correct 5 ms 20664 KB Output is correct
3 Correct 5 ms 20572 KB Output is correct
4 Correct 5 ms 20568 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 4 ms 20572 KB Output is correct
8 Correct 5 ms 20572 KB Output is correct
9 Correct 6 ms 20572 KB Output is correct
10 Correct 6 ms 20568 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20572 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 5 ms 20728 KB Output is correct
19 Correct 6 ms 20572 KB Output is correct
20 Correct 5 ms 20572 KB Output is correct
21 Correct 6 ms 20572 KB Output is correct
22 Correct 5 ms 20572 KB Output is correct
23 Correct 5 ms 20572 KB Output is correct
24 Correct 6 ms 20572 KB Output is correct
25 Correct 4 ms 20572 KB Output is correct
26 Correct 4 ms 20572 KB Output is correct
27 Correct 5 ms 20648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 30312 KB Output is correct
2 Correct 64 ms 30292 KB Output is correct
3 Correct 72 ms 29532 KB Output is correct
4 Correct 60 ms 29008 KB Output is correct
5 Correct 55 ms 28372 KB Output is correct
6 Correct 53 ms 27984 KB Output is correct
7 Correct 52 ms 27932 KB Output is correct
8 Correct 49 ms 27728 KB Output is correct
9 Correct 61 ms 27728 KB Output is correct
10 Correct 48 ms 27728 KB Output is correct
11 Correct 60 ms 27708 KB Output is correct
12 Correct 45 ms 27728 KB Output is correct
13 Correct 45 ms 28020 KB Output is correct
14 Correct 49 ms 30244 KB Output is correct
15 Correct 73 ms 39952 KB Output is correct
16 Correct 70 ms 36208 KB Output is correct
17 Correct 66 ms 35156 KB Output is correct
18 Correct 69 ms 34896 KB Output is correct
19 Correct 67 ms 29008 KB Output is correct
20 Correct 61 ms 29012 KB Output is correct
21 Correct 59 ms 29004 KB Output is correct
22 Correct 60 ms 28496 KB Output is correct
23 Correct 54 ms 28340 KB Output is correct
24 Correct 54 ms 29908 KB Output is correct
25 Correct 58 ms 30032 KB Output is correct
26 Correct 54 ms 29392 KB Output is correct
27 Correct 59 ms 29552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 4 ms 20640 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20572 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 4 ms 20572 KB Output is correct
8 Correct 4 ms 20572 KB Output is correct
9 Correct 4 ms 20728 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 5 ms 20584 KB Output is correct
14 Correct 4 ms 20592 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 4 ms 20572 KB Output is correct
17 Correct 4 ms 20408 KB Output is correct
18 Correct 4 ms 20572 KB Output is correct
19 Correct 4 ms 20572 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 20568 KB Output is correct
23 Correct 4 ms 20568 KB Output is correct
24 Correct 4 ms 20572 KB Output is correct
25 Correct 5 ms 20572 KB Output is correct
26 Correct 7 ms 20572 KB Output is correct
27 Correct 5 ms 20568 KB Output is correct
28 Correct 4 ms 20588 KB Output is correct
29 Correct 4 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 4 ms 20604 KB Output is correct
32 Correct 4 ms 20636 KB Output is correct
33 Correct 5 ms 20572 KB Output is correct
34 Correct 4 ms 20568 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20576 KB Output is correct
37 Correct 4 ms 20640 KB Output is correct
38 Correct 5 ms 20824 KB Output is correct
39 Correct 4 ms 20572 KB Output is correct
40 Correct 5 ms 20592 KB Output is correct
41 Correct 5 ms 20572 KB Output is correct
42 Correct 4 ms 20572 KB Output is correct
43 Correct 5 ms 20600 KB Output is correct
44 Correct 5 ms 20568 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 5 ms 20640 KB Output is correct
47 Correct 4 ms 20572 KB Output is correct
48 Correct 4 ms 20596 KB Output is correct
49 Correct 5 ms 20572 KB Output is correct
50 Correct 5 ms 20568 KB Output is correct
51 Correct 4 ms 20568 KB Output is correct
52 Correct 4 ms 20572 KB Output is correct
53 Correct 4 ms 20572 KB Output is correct
54 Correct 4 ms 20568 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 5 ms 20572 KB Output is correct
57 Correct 4 ms 20572 KB Output is correct
58 Correct 5 ms 20568 KB Output is correct
59 Correct 4 ms 20568 KB Output is correct
60 Correct 4 ms 20572 KB Output is correct
61 Correct 5 ms 20572 KB Output is correct
62 Correct 4 ms 20572 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 4 ms 20572 KB Output is correct
66 Correct 5 ms 20568 KB Output is correct
67 Correct 6 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 5 ms 20568 KB Output is correct
71 Correct 5 ms 20572 KB Output is correct
72 Correct 5 ms 20572 KB Output is correct
73 Correct 4 ms 20572 KB Output is correct
74 Correct 5 ms 20572 KB Output is correct
75 Correct 5 ms 20572 KB Output is correct
76 Correct 4 ms 20596 KB Output is correct
77 Correct 6 ms 20572 KB Output is correct
78 Correct 5 ms 20568 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 20568 KB Output is correct
82 Correct 6 ms 20572 KB Output is correct
83 Correct 5 ms 20816 KB Output is correct
84 Correct 5 ms 20568 KB Output is correct
85 Correct 5 ms 20568 KB Output is correct
86 Correct 5 ms 20572 KB Output is correct
87 Correct 4 ms 20572 KB Output is correct
88 Correct 5 ms 20676 KB Output is correct
89 Correct 5 ms 20572 KB Output is correct
90 Correct 5 ms 20600 KB Output is correct
91 Correct 6 ms 20572 KB Output is correct
92 Correct 5 ms 20572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 20568 KB Output is correct
2 Correct 4 ms 20640 KB Output is correct
3 Correct 4 ms 20572 KB Output is correct
4 Correct 4 ms 20572 KB Output is correct
5 Correct 5 ms 20572 KB Output is correct
6 Correct 5 ms 20572 KB Output is correct
7 Correct 4 ms 20572 KB Output is correct
8 Correct 4 ms 20572 KB Output is correct
9 Correct 4 ms 20728 KB Output is correct
10 Correct 4 ms 20572 KB Output is correct
11 Correct 5 ms 20572 KB Output is correct
12 Correct 5 ms 20572 KB Output is correct
13 Correct 5 ms 20584 KB Output is correct
14 Correct 4 ms 20592 KB Output is correct
15 Correct 5 ms 20572 KB Output is correct
16 Correct 4 ms 20572 KB Output is correct
17 Correct 4 ms 20408 KB Output is correct
18 Correct 4 ms 20572 KB Output is correct
19 Correct 4 ms 20572 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 20568 KB Output is correct
23 Correct 4 ms 20568 KB Output is correct
24 Correct 4 ms 20572 KB Output is correct
25 Correct 5 ms 20572 KB Output is correct
26 Correct 7 ms 20572 KB Output is correct
27 Correct 5 ms 20568 KB Output is correct
28 Correct 4 ms 20588 KB Output is correct
29 Correct 4 ms 20572 KB Output is correct
30 Correct 5 ms 20572 KB Output is correct
31 Correct 4 ms 20604 KB Output is correct
32 Correct 4 ms 20636 KB Output is correct
33 Correct 5 ms 20572 KB Output is correct
34 Correct 4 ms 20568 KB Output is correct
35 Correct 4 ms 20572 KB Output is correct
36 Correct 4 ms 20576 KB Output is correct
37 Correct 4 ms 20640 KB Output is correct
38 Correct 5 ms 20824 KB Output is correct
39 Correct 4 ms 20572 KB Output is correct
40 Correct 5 ms 20592 KB Output is correct
41 Correct 5 ms 20572 KB Output is correct
42 Correct 4 ms 20572 KB Output is correct
43 Correct 5 ms 20600 KB Output is correct
44 Correct 5 ms 20568 KB Output is correct
45 Correct 4 ms 20572 KB Output is correct
46 Correct 5 ms 20640 KB Output is correct
47 Correct 4 ms 20572 KB Output is correct
48 Correct 4 ms 20596 KB Output is correct
49 Correct 5 ms 20572 KB Output is correct
50 Correct 5 ms 20568 KB Output is correct
51 Correct 4 ms 20568 KB Output is correct
52 Correct 4 ms 20572 KB Output is correct
53 Correct 4 ms 20572 KB Output is correct
54 Correct 4 ms 20568 KB Output is correct
55 Correct 4 ms 20572 KB Output is correct
56 Correct 5 ms 20572 KB Output is correct
57 Correct 4 ms 20572 KB Output is correct
58 Correct 5 ms 20568 KB Output is correct
59 Correct 4 ms 20568 KB Output is correct
60 Correct 4 ms 20572 KB Output is correct
61 Correct 5 ms 20572 KB Output is correct
62 Correct 4 ms 20572 KB Output is correct
63 Correct 6 ms 20572 KB Output is correct
64 Correct 4 ms 20572 KB Output is correct
65 Correct 4 ms 20572 KB Output is correct
66 Correct 65 ms 38200 KB Output is correct
67 Correct 52 ms 38348 KB Output is correct
68 Correct 67 ms 34264 KB Output is correct
69 Correct 58 ms 36300 KB Output is correct
70 Correct 63 ms 32708 KB Output is correct
71 Correct 60 ms 37204 KB Output is correct
72 Correct 73 ms 32216 KB Output is correct
73 Correct 65 ms 32304 KB Output is correct
74 Correct 62 ms 30316 KB Output is correct
75 Correct 56 ms 30800 KB Output is correct
76 Correct 45 ms 28500 KB Output is correct
77 Correct 47 ms 28400 KB Output is correct
78 Correct 43 ms 28236 KB Output is correct
79 Correct 41 ms 27984 KB Output is correct
80 Correct 38 ms 27364 KB Output is correct
81 Correct 35 ms 27000 KB Output is correct
82 Correct 6 ms 21084 KB Output is correct
83 Correct 6 ms 21084 KB Output is correct
84 Correct 6 ms 21084 KB Output is correct
85 Correct 6 ms 21084 KB Output is correct
86 Correct 6 ms 21084 KB Output is correct
87 Correct 8 ms 21084 KB Output is correct
88 Correct 5 ms 20568 KB Output is correct
89 Correct 5 ms 20572 KB Output is correct
90 Correct 6 ms 20572 KB Output is correct
91 Correct 5 ms 20828 KB Output is correct
92 Correct 5 ms 20572 KB Output is correct
93 Correct 5 ms 20572 KB Output is correct
94 Correct 5 ms 20828 KB Output is correct
95 Correct 4 ms 20572 KB Output is correct
96 Correct 5 ms 20572 KB Output is correct
97 Correct 5 ms 20572 KB Output is correct
98 Correct 5 ms 20824 KB Output is correct
99 Correct 5 ms 20572 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 20600 KB Output is correct
104 Correct 5 ms 20568 KB Output is correct
105 Correct 4 ms 20572 KB Output is correct
106 Correct 4 ms 20572 KB Output is correct
107 Correct 4 ms 20572 KB Output is correct
108 Correct 64 ms 30384 KB Output is correct
109 Correct 60 ms 30408 KB Output is correct
110 Correct 59 ms 30288 KB Output is correct
111 Correct 61 ms 30300 KB Output is correct
112 Correct 58 ms 30288 KB Output is correct
113 Correct 65 ms 37936 KB Output is correct
114 Correct 67 ms 36440 KB Output is correct
115 Correct 64 ms 34144 KB Output is correct
116 Correct 70 ms 32832 KB Output is correct
117 Correct 60 ms 30152 KB Output is correct
118 Correct 60 ms 30288 KB Output is correct
119 Correct 61 ms 30292 KB Output is correct
120 Correct 59 ms 30288 KB Output is correct
121 Correct 56 ms 29776 KB Output is correct
122 Correct 60 ms 29268 KB Output is correct
123 Correct 33 ms 27216 KB Output is correct
124 Correct 44 ms 30856 KB Output is correct
125 Correct 48 ms 31056 KB Output is correct
126 Correct 45 ms 30928 KB Output is correct
127 Correct 48 ms 30804 KB Output is correct
128 Correct 4 ms 20568 KB Output is correct
129 Correct 5 ms 20664 KB Output is correct
130 Correct 5 ms 20572 KB Output is correct
131 Correct 5 ms 20568 KB Output is correct
132 Correct 5 ms 20572 KB Output is correct
133 Correct 5 ms 20572 KB Output is correct
134 Correct 4 ms 20572 KB Output is correct
135 Correct 5 ms 20572 KB Output is correct
136 Correct 6 ms 20572 KB Output is correct
137 Correct 6 ms 20568 KB Output is correct
138 Correct 5 ms 20572 KB Output is correct
139 Correct 5 ms 20572 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 20568 KB Output is correct
144 Correct 5 ms 20572 KB Output is correct
145 Correct 5 ms 20728 KB Output is correct
146 Correct 6 ms 20572 KB Output is correct
147 Correct 5 ms 20572 KB Output is correct
148 Correct 6 ms 20572 KB Output is correct
149 Correct 5 ms 20572 KB Output is correct
150 Correct 5 ms 20572 KB Output is correct
151 Correct 6 ms 20572 KB Output is correct
152 Correct 4 ms 20572 KB Output is correct
153 Correct 4 ms 20572 KB Output is correct
154 Correct 5 ms 20648 KB Output is correct
155 Correct 63 ms 30312 KB Output is correct
156 Correct 64 ms 30292 KB Output is correct
157 Correct 72 ms 29532 KB Output is correct
158 Correct 60 ms 29008 KB Output is correct
159 Correct 55 ms 28372 KB Output is correct
160 Correct 53 ms 27984 KB Output is correct
161 Correct 52 ms 27932 KB Output is correct
162 Correct 49 ms 27728 KB Output is correct
163 Correct 61 ms 27728 KB Output is correct
164 Correct 48 ms 27728 KB Output is correct
165 Correct 60 ms 27708 KB Output is correct
166 Correct 45 ms 27728 KB Output is correct
167 Correct 45 ms 28020 KB Output is correct
168 Correct 49 ms 30244 KB Output is correct
169 Correct 73 ms 39952 KB Output is correct
170 Correct 70 ms 36208 KB Output is correct
171 Correct 66 ms 35156 KB Output is correct
172 Correct 69 ms 34896 KB Output is correct
173 Correct 67 ms 29008 KB Output is correct
174 Correct 61 ms 29012 KB Output is correct
175 Correct 59 ms 29004 KB Output is correct
176 Correct 60 ms 28496 KB Output is correct
177 Correct 54 ms 28340 KB Output is correct
178 Correct 54 ms 29908 KB Output is correct
179 Correct 58 ms 30032 KB Output is correct
180 Correct 54 ms 29392 KB Output is correct
181 Correct 59 ms 29552 KB Output is correct
182 Correct 5 ms 20568 KB Output is correct
183 Correct 6 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 5 ms 20568 KB Output is correct
187 Correct 5 ms 20572 KB Output is correct
188 Correct 5 ms 20572 KB Output is correct
189 Correct 4 ms 20572 KB Output is correct
190 Correct 5 ms 20572 KB Output is correct
191 Correct 5 ms 20572 KB Output is correct
192 Correct 4 ms 20596 KB Output is correct
193 Correct 6 ms 20572 KB Output is correct
194 Correct 5 ms 20568 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 20568 KB Output is correct
198 Correct 6 ms 20572 KB Output is correct
199 Correct 5 ms 20816 KB Output is correct
200 Correct 5 ms 20568 KB Output is correct
201 Correct 5 ms 20568 KB Output is correct
202 Correct 5 ms 20572 KB Output is correct
203 Correct 4 ms 20572 KB Output is correct
204 Correct 5 ms 20676 KB Output is correct
205 Correct 5 ms 20572 KB Output is correct
206 Correct 5 ms 20600 KB Output is correct
207 Correct 6 ms 20572 KB Output is correct
208 Correct 5 ms 20572 KB Output is correct
209 Correct 6 ms 21080 KB Output is correct
210 Correct 36 ms 26456 KB Output is correct
211 Correct 52 ms 30416 KB Output is correct
212 Correct 64 ms 33028 KB Output is correct
213 Correct 76 ms 34764 KB Output is correct
214 Correct 45 ms 28160 KB Output is correct
215 Correct 42 ms 27732 KB Output is correct
216 Correct 62 ms 29520 KB Output is correct
217 Correct 74 ms 28712 KB Output is correct
218 Correct 51 ms 27776 KB Output is correct
219 Correct 48 ms 27752 KB Output is correct
220 Correct 49 ms 27568 KB Output is correct
221 Correct 45 ms 27720 KB Output is correct
222 Correct 52 ms 28992 KB Output is correct
223 Correct 67 ms 33440 KB Output is correct
224 Correct 64 ms 31340 KB Output is correct
225 Correct 58 ms 28248 KB Output is correct
226 Correct 60 ms 28244 KB Output is correct
227 Correct 58 ms 28244 KB Output is correct
228 Correct 54 ms 28068 KB Output is correct
229 Correct 47 ms 27988 KB Output is correct
230 Correct 69 ms 28576 KB Output is correct
231 Correct 58 ms 28752 KB Output is correct