Submission #598299

# Submission time Handle Problem Language Result Execution time Memory
598299 2022-07-18T01:39:21 Z codebuster_10 Duathlon (APIO18_duathlon) C++17
100 / 100
214 ms 44224 KB
#include <bits/stdc++.h>
#define int int64_t //be careful about this 
 
using namespace std;
 
#define vt vector 
#define ar array 
#define pr pair 
 
#define f first 
#define s second
 
#define pb push_back
#define eb emplace_back
 
#define fr(i,a,b) for(int i = (a); i < (b); ++i)
#define rf(i,a,b) for(int i = (b)-1; i >= (a); --i)
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
 
namespace IN{
  template<class T> void re(vector<T> &A);
  template<class S,class T> void re(pair<S,T> &A);
  template<class T,size_t N> void re(array<T,N> &A);
 
  template<class T> void re(T& x){ 
    cin >> x;}
  template<class H, class... T> void re(H& h, T&... t){ 
    re(h); re(t...);}
 
  template<class T> void re(vector<T> &A){ 
    for(auto& x : A) re(x);}
  template<class S,class T> void re(pair<S,T> &A){ 
      re(A.first); re(A.second);}
  template<class T,size_t N> void re(array<T,N> &A){
    for(int i = 0; i < N; ++i)  re(A[i]);}
}
 
namespace OUT{
  template<class T>
  void __p(const T& a){ cout<<a; }
  template<class T, class F>
  void __p(const pair<T, F>& a){ cout<<"{"; __p(a.first); cout<<","; __p(a.second); cout<<"}\n"; }
  template<class T, size_t N>
  void __p(const array<T,N>& a){ cout<<"{"; for(int i=0;i<N;++i)__p(a[i]),cout<<",}\n"[i+1==N]; }
  template<class T>
  void __p(const vector<T>& a){
    cout<<"{";for(auto it=a.begin();it<a.end();it++)__p(*it),cout<<",}\n"[it+1==a.end()]; }
  template<class T, class ...Arg>
  void __p(T a1, Arg ...a){__p(a1); __p(a...); }
  template<class Arg1>
  void __f(const char *s, Arg1 &&arg1){ cout<<s<<" : "; __p(arg1); cout<<endl; }
  template<class Arg1, class ... Args>
  void __f(const char *ss, Arg1 &&arg1, Args &&... args){
    int b=0,i=0; do{ if(ss[i]=='(') b++; if(ss[i]==')') b--; i++;}while(!(ss[i]==','&&b==0));
    const char *comma=ss+i; cout.write(ss,comma-ss)<<" : ";__p(arg1);cout<<" | ";__f(comma+1,args...);}
  #define trace(...) cout<<"Line:"<<__LINE__<<"  ", __f(#__VA_ARGS__, __VA_ARGS__)
}
 
 
namespace FUNC{
  void IO(string s = ""){
    ios_base::sync_with_stdio(NULL); 
    cin.tie(nullptr); 
    cout.precision(20); 
    cout << fixed;
    if(!s.empty()){
      freopen((s+".in").c_str(),"r",stdin);
      freopen((s+".out").c_str(),"w",stdout);
    }
  }
 
  const auto start_time = chrono::high_resolution_clock::now();
  void output_run_time(){
    // will work for ac,cc&&cf.
#ifndef ONLINE_JUDGE
    auto end_time = chrono::high_resolution_clock::now();
    chrono::duration<double> diff = end_time-start_time;
      cout << "\n\n\nTime Taken : " << diff.count();
#endif
  }
 
  template<class T> bool ckmin(T& a, const T& b){ 
    return b < a ? a = b, true : false; }
    
  template<class T> bool ckmax(T& a, const T& b){ 
    return a < b ? a = b, true : false; }
 
  mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
  int my_rand(int L, int R){ 
    return uniform_int_distribution<int>(L,R)(rng); }
  
  template<class T> int sz(const T& x){ 
    return int(x.size()); }
 
  template<class T> int lb(const vector<T>& vec,const T& val){
    return int(lower_bound(vec.begin(), vec.end(),val) - vec.begin()); }
 
  template<class T> int ub(const vector<T>& vec,const T& val){
    return int(upper_bound(vec.begin(), vec.end(),val) - vec.begin()); }
 
  constexpr int  dx[4] = {1,0,-1,0};
  constexpr int  dy[4] = {0,1,0,-1};
  constexpr char dr[4] = {'D','R','U','L'};
 
  constexpr long long INFLL1 = 1e16, INFLL2 = 9e18;
  constexpr int INF = 2e9;
 
  template<class T>
  vector<T> V(int n,T val){
    return vector<T> (n,val);
  }
 
  template<class T>
  vector<vector<T>> V(int n,int m,T val){
    return vector<vector<T>> (n,vector<T> (m,val));
  }
 
  template<class T>
  vector<vector<vector<T>>> V(int n,int m,int k,T val){
    return vector<vector<vector<T>>> (n,vector<vector<T>> (m,vector<T> (k,val)));
  }
}
 
 
using namespace IN;
using namespace OUT;
using namespace FUNC;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
struct edge{
  int to;
};
 
// returns {#bcc components, block tree}.
pair<int,vector<vector<int>>> bi_cc(const vector<vector<edge>> &g){
 
  int n = g.size();
 
  vector<int> depth(n,-1), low(n), comp;
  vector<vector<int>> block_tree(n);
  stack<int> s;
  int z = 0, f = -1;
 
  auto dfs = [&](auto self,int node,int parent) -> void {
    low[node] = depth[node];
 
    for(auto [child] : g[node])
      if(child != parent){
        if(depth[child] < 0){
          s.push(f); int here = f; --f;
          s.push(child); s.push(node);
          depth[child] = depth[node] + 1;
          self(self,child,node);
          if(low[child] >= depth[node]){
          
            while(comp.empty() || comp.back() != here)
              comp.push_back(s.top()), s.pop();
 
            sort(all(comp));
            comp.erase(unique(all(comp)),comp.end());
            
            for(auto i : comp) if(i >= 0) block_tree[i].pb(n+z);
 
            comp = {};
            z++;
          }
          low[node] = min(low[node],low[child]);
        }else if(depth[child] < depth[node]){
          s.push(child); s.push(node);
          low[node] = min(low[node],depth[child]);
        }
      }
    
    return;
  };
 
  for(int i = 0; i < n; ++i)
    if(depth[i] < 0){
      depth[i] = 0;
      dfs(dfs,i,-1);
    }
 
  block_tree.resize(z + n);
  fr(i,0,n){
    for(auto j : block_tree[i]){
      assert(j >= n);
      block_tree[j].pb(i);
    }
  } 
 
  return {z,block_tree};
}
 
 
 
signed main(){
  IO();
 
  int n,m;
  re(n,m);
 
  vt<vt<edge>> g(n);
  fr(e,0,m){
    int u,v; re(u,v); --u,--v;
    g[u].pb({v}); g[v].pb({u});
  }
 
  auto [z,block_tree] = bi_cc(g);
 
  vt<int> ss(z + n,0);
  vt<bool> vis(z + n, false);
 
  fr(i,0,n) ss[i] = 1;
 
  auto dfs = [&](auto self,int node,int parent) -> void {
    vis[node] = true;
    for(auto child : block_tree[node])
      if(child != parent){
        self(self,child,node);
        ss[node] += ss[child];
      }
  };  
 
  fr(i,0,z+n) if(!vis[i]) dfs(dfs,i,-1);
 
  fr(i,0,z+n) vis[i] = false;
 
  int ans = 0;
 
  auto re_root = [&](auto self,int node,int parent) -> void {
    vis[node] = true;
    if(node >= n){
      for(auto child : block_tree[node])
        ans -= (sz(block_tree[node]) - 1) * ss[child] * ss[child];
    }
    for(auto child : block_tree[node])
      if(child != parent){
        ss[node] -= ss[child];
        ss[child] += ss[node];
        self(self,child,node);
        ss[child] -= ss[node];
        ss[node] += ss[child];
      }
  };
 
  fr(i,0,z+n){
    if(!vis[i]){
      ans += ss[i] * (ss[i] - 1) * (ss[i] - 1);
      re_root(re_root,i,-1);
    }
  } 
 
  cout << ans;
 
 
  
  //output_run_time();
  return 0;
}

Compilation message

count_triplets.cpp: In function 'void FUNC::IO(std::string)':
count_triplets.cpp:68:14: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   68 |       freopen((s+".in").c_str(),"r",stdin);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
count_triplets.cpp:69:14: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   69 |       freopen((s+".out").c_str(),"w",stdout);
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 328 KB Output is correct
17 Correct 0 ms 328 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 328 KB Output is correct
17 Correct 0 ms 328 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 0 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 340 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 324 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 328 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 308 KB Output is correct
52 Correct 0 ms 332 KB Output is correct
53 Correct 0 ms 340 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 1 ms 324 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 0 ms 328 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 0 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 44224 KB Output is correct
2 Correct 113 ms 44096 KB Output is correct
3 Correct 127 ms 36912 KB Output is correct
4 Correct 123 ms 41748 KB Output is correct
5 Correct 128 ms 32412 KB Output is correct
6 Correct 128 ms 34448 KB Output is correct
7 Correct 135 ms 31604 KB Output is correct
8 Correct 171 ms 33552 KB Output is correct
9 Correct 146 ms 29320 KB Output is correct
10 Correct 127 ms 30508 KB Output is correct
11 Correct 127 ms 25120 KB Output is correct
12 Correct 155 ms 24780 KB Output is correct
13 Correct 87 ms 24352 KB Output is correct
14 Correct 89 ms 23840 KB Output is correct
15 Correct 74 ms 21928 KB Output is correct
16 Correct 72 ms 21540 KB Output is correct
17 Correct 10 ms 8960 KB Output is correct
18 Correct 10 ms 8984 KB Output is correct
19 Correct 9 ms 8932 KB Output is correct
20 Correct 20 ms 8916 KB Output is correct
21 Correct 23 ms 8968 KB Output is correct
22 Correct 9 ms 8916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 788 KB Output is correct
5 Correct 1 ms 724 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 724 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 2 ms 596 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
11 Correct 1 ms 596 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 1 ms 588 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 2 ms 596 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 596 KB Output is correct
20 Correct 2 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 185 ms 30652 KB Output is correct
2 Correct 201 ms 30736 KB Output is correct
3 Correct 181 ms 30772 KB Output is correct
4 Correct 153 ms 30764 KB Output is correct
5 Correct 186 ms 30704 KB Output is correct
6 Correct 188 ms 41252 KB Output is correct
7 Correct 181 ms 38032 KB Output is correct
8 Correct 195 ms 36048 KB Output is correct
9 Correct 195 ms 34192 KB Output is correct
10 Correct 195 ms 30708 KB Output is correct
11 Correct 162 ms 32044 KB Output is correct
12 Correct 174 ms 31936 KB Output is correct
13 Correct 178 ms 31968 KB Output is correct
14 Correct 136 ms 30172 KB Output is correct
15 Correct 130 ms 28328 KB Output is correct
16 Correct 87 ms 22212 KB Output is correct
17 Correct 128 ms 33152 KB Output is correct
18 Correct 115 ms 32844 KB Output is correct
19 Correct 146 ms 32876 KB Output is correct
20 Correct 140 ms 32916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 2 ms 596 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 1 ms 596 KB Output is correct
15 Correct 1 ms 596 KB Output is correct
16 Correct 1 ms 588 KB Output is correct
17 Correct 1 ms 592 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 1 ms 468 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 596 KB Output is correct
22 Correct 2 ms 596 KB Output is correct
23 Correct 1 ms 596 KB Output is correct
24 Correct 2 ms 588 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 456 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 164 ms 30720 KB Output is correct
2 Correct 156 ms 30432 KB Output is correct
3 Correct 199 ms 28888 KB Output is correct
4 Correct 162 ms 26544 KB Output is correct
5 Correct 121 ms 23936 KB Output is correct
6 Correct 127 ms 22772 KB Output is correct
7 Correct 149 ms 22244 KB Output is correct
8 Correct 122 ms 21660 KB Output is correct
9 Correct 103 ms 21284 KB Output is correct
10 Correct 97 ms 21156 KB Output is correct
11 Correct 95 ms 20900 KB Output is correct
12 Correct 123 ms 20912 KB Output is correct
13 Correct 104 ms 21104 KB Output is correct
14 Correct 94 ms 26216 KB Output is correct
15 Correct 170 ms 37552 KB Output is correct
16 Correct 175 ms 34644 KB Output is correct
17 Correct 214 ms 35660 KB Output is correct
18 Correct 187 ms 32932 KB Output is correct
19 Correct 154 ms 26584 KB Output is correct
20 Correct 168 ms 28072 KB Output is correct
21 Correct 175 ms 28004 KB Output is correct
22 Correct 126 ms 26344 KB Output is correct
23 Correct 110 ms 24776 KB Output is correct
24 Correct 147 ms 30648 KB Output is correct
25 Correct 151 ms 30620 KB Output is correct
26 Correct 143 ms 29212 KB Output is correct
27 Correct 171 ms 29260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 328 KB Output is correct
17 Correct 0 ms 328 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 0 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 340 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 324 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 328 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 308 KB Output is correct
52 Correct 0 ms 332 KB Output is correct
53 Correct 0 ms 340 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 1 ms 324 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 0 ms 328 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 0 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 1 ms 340 KB Output is correct
67 Correct 1 ms 468 KB Output is correct
68 Correct 1 ms 596 KB Output is correct
69 Correct 2 ms 596 KB Output is correct
70 Correct 2 ms 724 KB Output is correct
71 Correct 1 ms 468 KB Output is correct
72 Correct 1 ms 468 KB Output is correct
73 Correct 2 ms 464 KB Output is correct
74 Correct 2 ms 468 KB Output is correct
75 Correct 1 ms 468 KB Output is correct
76 Correct 0 ms 328 KB Output is correct
77 Correct 1 ms 596 KB Output is correct
78 Correct 1 ms 468 KB Output is correct
79 Correct 1 ms 468 KB Output is correct
80 Correct 1 ms 468 KB Output is correct
81 Correct 2 ms 468 KB Output is correct
82 Correct 1 ms 596 KB Output is correct
83 Correct 1 ms 744 KB Output is correct
84 Correct 2 ms 596 KB Output is correct
85 Correct 1 ms 596 KB Output is correct
86 Correct 1 ms 468 KB Output is correct
87 Correct 1 ms 464 KB Output is correct
88 Correct 2 ms 468 KB Output is correct
89 Correct 2 ms 460 KB Output is correct
90 Correct 1 ms 468 KB Output is correct
91 Correct 1 ms 596 KB Output is correct
92 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 328 KB Output is correct
17 Correct 0 ms 328 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 0 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 0 ms 340 KB Output is correct
39 Correct 1 ms 340 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 340 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 336 KB Output is correct
45 Correct 1 ms 324 KB Output is correct
46 Correct 1 ms 340 KB Output is correct
47 Correct 1 ms 328 KB Output is correct
48 Correct 1 ms 340 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 212 KB Output is correct
51 Correct 1 ms 308 KB Output is correct
52 Correct 0 ms 332 KB Output is correct
53 Correct 0 ms 340 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 1 ms 324 KB Output is correct
57 Correct 1 ms 340 KB Output is correct
58 Correct 0 ms 328 KB Output is correct
59 Correct 1 ms 340 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 0 ms 340 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 0 ms 340 KB Output is correct
64 Correct 1 ms 340 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 104 ms 44224 KB Output is correct
67 Correct 113 ms 44096 KB Output is correct
68 Correct 127 ms 36912 KB Output is correct
69 Correct 123 ms 41748 KB Output is correct
70 Correct 128 ms 32412 KB Output is correct
71 Correct 128 ms 34448 KB Output is correct
72 Correct 135 ms 31604 KB Output is correct
73 Correct 171 ms 33552 KB Output is correct
74 Correct 146 ms 29320 KB Output is correct
75 Correct 127 ms 30508 KB Output is correct
76 Correct 127 ms 25120 KB Output is correct
77 Correct 155 ms 24780 KB Output is correct
78 Correct 87 ms 24352 KB Output is correct
79 Correct 89 ms 23840 KB Output is correct
80 Correct 74 ms 21928 KB Output is correct
81 Correct 72 ms 21540 KB Output is correct
82 Correct 10 ms 8960 KB Output is correct
83 Correct 10 ms 8984 KB Output is correct
84 Correct 9 ms 8932 KB Output is correct
85 Correct 20 ms 8916 KB Output is correct
86 Correct 23 ms 8968 KB Output is correct
87 Correct 9 ms 8916 KB Output is correct
88 Correct 1 ms 596 KB Output is correct
89 Correct 1 ms 596 KB Output is correct
90 Correct 1 ms 596 KB Output is correct
91 Correct 1 ms 788 KB Output is correct
92 Correct 1 ms 724 KB Output is correct
93 Correct 1 ms 724 KB Output is correct
94 Correct 1 ms 724 KB Output is correct
95 Correct 1 ms 596 KB Output is correct
96 Correct 2 ms 596 KB Output is correct
97 Correct 1 ms 596 KB Output is correct
98 Correct 1 ms 596 KB Output is correct
99 Correct 2 ms 576 KB Output is correct
100 Correct 1 ms 596 KB Output is correct
101 Correct 1 ms 596 KB Output is correct
102 Correct 1 ms 588 KB Output is correct
103 Correct 1 ms 468 KB Output is correct
104 Correct 2 ms 596 KB Output is correct
105 Correct 1 ms 596 KB Output is correct
106 Correct 1 ms 596 KB Output is correct
107 Correct 2 ms 596 KB Output is correct
108 Correct 185 ms 30652 KB Output is correct
109 Correct 201 ms 30736 KB Output is correct
110 Correct 181 ms 30772 KB Output is correct
111 Correct 153 ms 30764 KB Output is correct
112 Correct 186 ms 30704 KB Output is correct
113 Correct 188 ms 41252 KB Output is correct
114 Correct 181 ms 38032 KB Output is correct
115 Correct 195 ms 36048 KB Output is correct
116 Correct 195 ms 34192 KB Output is correct
117 Correct 195 ms 30708 KB Output is correct
118 Correct 162 ms 32044 KB Output is correct
119 Correct 174 ms 31936 KB Output is correct
120 Correct 178 ms 31968 KB Output is correct
121 Correct 136 ms 30172 KB Output is correct
122 Correct 130 ms 28328 KB Output is correct
123 Correct 87 ms 22212 KB Output is correct
124 Correct 128 ms 33152 KB Output is correct
125 Correct 115 ms 32844 KB Output is correct
126 Correct 146 ms 32876 KB Output is correct
127 Correct 140 ms 32916 KB Output is correct
128 Correct 2 ms 596 KB Output is correct
129 Correct 1 ms 596 KB Output is correct
130 Correct 1 ms 596 KB Output is correct
131 Correct 1 ms 588 KB Output is correct
132 Correct 1 ms 468 KB Output is correct
133 Correct 1 ms 468 KB Output is correct
134 Correct 1 ms 468 KB Output is correct
135 Correct 1 ms 468 KB Output is correct
136 Correct 2 ms 468 KB Output is correct
137 Correct 1 ms 468 KB Output is correct
138 Correct 1 ms 468 KB Output is correct
139 Correct 2 ms 596 KB Output is correct
140 Correct 1 ms 596 KB Output is correct
141 Correct 1 ms 596 KB Output is correct
142 Correct 1 ms 596 KB Output is correct
143 Correct 1 ms 588 KB Output is correct
144 Correct 1 ms 592 KB Output is correct
145 Correct 1 ms 596 KB Output is correct
146 Correct 1 ms 468 KB Output is correct
147 Correct 1 ms 460 KB Output is correct
148 Correct 1 ms 596 KB Output is correct
149 Correct 2 ms 596 KB Output is correct
150 Correct 1 ms 596 KB Output is correct
151 Correct 2 ms 588 KB Output is correct
152 Correct 1 ms 468 KB Output is correct
153 Correct 1 ms 456 KB Output is correct
154 Correct 1 ms 340 KB Output is correct
155 Correct 164 ms 30720 KB Output is correct
156 Correct 156 ms 30432 KB Output is correct
157 Correct 199 ms 28888 KB Output is correct
158 Correct 162 ms 26544 KB Output is correct
159 Correct 121 ms 23936 KB Output is correct
160 Correct 127 ms 22772 KB Output is correct
161 Correct 149 ms 22244 KB Output is correct
162 Correct 122 ms 21660 KB Output is correct
163 Correct 103 ms 21284 KB Output is correct
164 Correct 97 ms 21156 KB Output is correct
165 Correct 95 ms 20900 KB Output is correct
166 Correct 123 ms 20912 KB Output is correct
167 Correct 104 ms 21104 KB Output is correct
168 Correct 94 ms 26216 KB Output is correct
169 Correct 170 ms 37552 KB Output is correct
170 Correct 175 ms 34644 KB Output is correct
171 Correct 214 ms 35660 KB Output is correct
172 Correct 187 ms 32932 KB Output is correct
173 Correct 154 ms 26584 KB Output is correct
174 Correct 168 ms 28072 KB Output is correct
175 Correct 175 ms 28004 KB Output is correct
176 Correct 126 ms 26344 KB Output is correct
177 Correct 110 ms 24776 KB Output is correct
178 Correct 147 ms 30648 KB Output is correct
179 Correct 151 ms 30620 KB Output is correct
180 Correct 143 ms 29212 KB Output is correct
181 Correct 171 ms 29260 KB Output is correct
182 Correct 1 ms 340 KB Output is correct
183 Correct 1 ms 468 KB Output is correct
184 Correct 1 ms 596 KB Output is correct
185 Correct 2 ms 596 KB Output is correct
186 Correct 2 ms 724 KB Output is correct
187 Correct 1 ms 468 KB Output is correct
188 Correct 1 ms 468 KB Output is correct
189 Correct 2 ms 464 KB Output is correct
190 Correct 2 ms 468 KB Output is correct
191 Correct 1 ms 468 KB Output is correct
192 Correct 0 ms 328 KB Output is correct
193 Correct 1 ms 596 KB Output is correct
194 Correct 1 ms 468 KB Output is correct
195 Correct 1 ms 468 KB Output is correct
196 Correct 1 ms 468 KB Output is correct
197 Correct 2 ms 468 KB Output is correct
198 Correct 1 ms 596 KB Output is correct
199 Correct 1 ms 744 KB Output is correct
200 Correct 2 ms 596 KB Output is correct
201 Correct 1 ms 596 KB Output is correct
202 Correct 1 ms 468 KB Output is correct
203 Correct 1 ms 464 KB Output is correct
204 Correct 2 ms 468 KB Output is correct
205 Correct 2 ms 460 KB Output is correct
206 Correct 1 ms 468 KB Output is correct
207 Correct 1 ms 596 KB Output is correct
208 Correct 1 ms 468 KB Output is correct
209 Correct 9 ms 8916 KB Output is correct
210 Correct 74 ms 21244 KB Output is correct
211 Correct 169 ms 31028 KB Output is correct
212 Correct 162 ms 37488 KB Output is correct
213 Correct 173 ms 42352 KB Output is correct
214 Correct 68 ms 25120 KB Output is correct
215 Correct 71 ms 24360 KB Output is correct
216 Correct 179 ms 29544 KB Output is correct
217 Correct 139 ms 26452 KB Output is correct
218 Correct 111 ms 23028 KB Output is correct
219 Correct 107 ms 22328 KB Output is correct
220 Correct 109 ms 22052 KB Output is correct
221 Correct 102 ms 21912 KB Output is correct
222 Correct 92 ms 24860 KB Output is correct
223 Correct 146 ms 32340 KB Output is correct
224 Correct 145 ms 30500 KB Output is correct
225 Correct 128 ms 25820 KB Output is correct
226 Correct 162 ms 25764 KB Output is correct
227 Correct 146 ms 25880 KB Output is correct
228 Correct 117 ms 24712 KB Output is correct
229 Correct 132 ms 23692 KB Output is correct
230 Correct 127 ms 26844 KB Output is correct
231 Correct 130 ms 26852 KB Output is correct