Submission #1052554

# Submission time Handle Problem Language Result Execution time Memory
1052554 2024-08-10T16:15:20 Z Zbyszek99 Rainforest Jumps (APIO21_jumps) C++17
60 / 100
4000 ms 43648 KB
#include "jumps.h"
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<long long, long long>
#define pb push_back
#define rep(i, b) for(int i = 0; i < (b); ++i)
#define rep2(i,a,b) for(int i = a; i <= (b); ++i)
#define rep3(i,a,b,c) for(int i = a; i <= (b); i+=c)
#define count_bits(x) __builtin_popcountll((x))
#define all(x) (x).begin(),(x).end()
#define size(x) (int)(x).size()
#define forall(it,x) for(auto& it:(x))
using namespace std;
//mt19937 mt;void random(){mt.seed(chrono::time_point_cast<chrono::milliseconds>(chrono::high_resolution_clock::now()).time_since_epoch().count());}
//ll rand(ll a, ll b) {return a + (mt() % (b-a+1));}
const int INF = 1e9+50;
const ll INF_L = 1e18+40;
const ll MOD = 1e9+7;

int next_[200001];
int prev_[200001];
int jump[200001][20];
int jump2[200001][20];
int h[200001];
int odl[200001];
bitset<200001> odw;
int n;
bool subtask1 = true;

int skok(int v, int k)
{
  rep(bit,20)
  {
    if(k & (1 << bit)) v = jump[v][bit];
  }
  return v;
}

int skok2(int v, int k)
{
  rep(bit,20)
  {
    if(k & (1 << bit)) v = jump2[v][bit];
  }
  return v;
}

void init(int N, vector<int> H) 
{
  n = N;
  rep(i,n) h[i] = H[i];
  vector<pii> q;
  rep(i,n)
  {
    if(i != 0)
    {
      if(h[i] < h[i-1]) subtask1 = false;
    }
    while(size(q) > 0 && h[i] > q.back().ff) q.pop_back();
    if(size(q) != 0)
    {
      prev_[i] = q.back().ss;
    } 
    else prev_[i] = i;
    q.pb({h[i],i});
  }
  q = {};
  for(int i = n-1; i >= 0; i--)
  {
    while(size(q) > 0 && h[i] > q.back().ff) q.pop_back();
    if(size(q) != 0)
    {
      next_[i] = q.back().ss;
    } 
    else next_[i] = i;
    q.pb({h[i],i});
  }
  rep(i,n)
  {
    if(h[next_[i]] < h[prev_[i]])
    {
      swap(next_[i],prev_[i]);
    }
    cerr << i << " " << next_[i] << " " << prev_[i] << " nx prv\n";
    jump[i][0] = next_[i];
    if(prev_[i] != i) jump2[i][0] = prev_[i];
    else jump2[i][0] = next_[i];
  }
  rep2(bit,1,19)
  {
    rep(i,n)
    {
      jump[i][bit] = jump[jump[i][bit-1]][bit-1];
    }
  }
  rep2(bit,1,19)
  {
    rep(i,n)
    {
      jump2[i][bit] = jump2[jump2[i][bit-1]][bit-1];
    }
  }
}

int minimum_jumps(int A, int B, int C, int D) {
  bool subtask5 = A == B && C == D;
  //subtask5 = false;
  if(!subtask1 && !subtask5)
  {
    rep(i,n) odl[i] = 1e9;
    rep(i,n) odw[i] = 0;
    rep2(i,A,B) odl[i] = 0;
    queue<int> kol; 
    rep2(i,A,B) kol.push(i);
    int wyn = 1e9;
    while(!kol.empty())
    {
      int t = kol.front();
      kol.pop();
      if(odw[t] == 1) continue;
      if(t >= C && t <= D) wyn = min(wyn,odl[t]);
      odl[next_[t]] = min(odl[next_[t]],odl[t]+1);
      odl[prev_[t]] = min(odl[prev_[t]],odl[t]+1);
      kol.push(next_[t]);
      kol.push(prev_[t]);
      odw[t] = 1;
    }
    if(wyn == 1e9) return -1;
    return wyn;
  }
  else if(subtask1)
  {
    int ans = 1e9;
    if(C-B >= 0) ans = C-B;
    if(C <= B) ans = 0;
    if(ans == 1e9) return -1;
    return ans;    
  }
  else
  {
    if(A == C) return 0;
    int pocz = 0;
    int kon = 200000;
    int ans = 0;
    while(pocz <= kon)
    {
      int srod = (pocz+kon)/2;
      int new_v = skok(A,srod);
      if(h[new_v] >= h[C])
      {
        kon = srod-1;
      }
      else
      {
        ans = srod;
        pocz = srod+1;
      }
    }
    int v = skok(A,ans);
    cerr << v << " " << ans << " v\n";
    if(prev_[v] == C || next_[v] == C) return ans+1;
    int ans2 = ans;
    pocz = 0;
    kon = 200000;
    ans = 0;
    while(pocz <= kon)
    {
      int srod = (pocz+kon)/2;
      int new_v = skok2(v,srod);
      if(h[new_v] >= h[C])
      {
        kon = srod-1;
      }
      else
      {
        ans = srod;
        pocz = srod+1;
      }
    }
    v = skok2(v,ans);
    cerr << v << " " << ans << " v\n";    
    if(h[v] > h[C]) return -1;
    if(prev_[v] == C || next_[v] == C) return ans+1+ans2;
    return -1;
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 0 ms 6488 KB Output is correct
3 Correct 858 ms 38968 KB Output is correct
4 Correct 1531 ms 43256 KB Output is correct
5 Correct 1041 ms 27692 KB Output is correct
6 Correct 1598 ms 43200 KB Output is correct
7 Correct 1150 ms 33728 KB Output is correct
8 Correct 1584 ms 43200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 2 ms 6488 KB Output is correct
6 Correct 2 ms 6488 KB Output is correct
7 Correct 2 ms 6488 KB Output is correct
8 Correct 3 ms 6488 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 2 ms 6488 KB Output is correct
11 Correct 2 ms 6488 KB Output is correct
12 Correct 2 ms 6488 KB Output is correct
13 Correct 3 ms 6488 KB Output is correct
14 Correct 2 ms 6488 KB Output is correct
15 Correct 3 ms 6488 KB Output is correct
16 Correct 3 ms 6488 KB Output is correct
17 Correct 2 ms 6488 KB Output is correct
18 Correct 1 ms 6488 KB Output is correct
19 Correct 1 ms 6488 KB Output is correct
20 Correct 2 ms 6488 KB Output is correct
21 Correct 3 ms 6612 KB Output is correct
22 Correct 4 ms 6488 KB Output is correct
23 Correct 3 ms 6608 KB Output is correct
24 Correct 3 ms 6488 KB Output is correct
25 Correct 1 ms 6584 KB Output is correct
26 Correct 1 ms 6592 KB Output is correct
27 Correct 2 ms 6488 KB Output is correct
28 Correct 5 ms 6608 KB Output is correct
29 Correct 4 ms 6488 KB Output is correct
30 Correct 4 ms 6488 KB Output is correct
31 Correct 3 ms 6536 KB Output is correct
32 Correct 4 ms 6488 KB Output is correct
33 Correct 1 ms 6488 KB Output is correct
34 Correct 2 ms 6488 KB Output is correct
35 Correct 2 ms 6488 KB Output is correct
36 Correct 2 ms 6484 KB Output is correct
37 Correct 2 ms 6484 KB Output is correct
38 Correct 2 ms 6488 KB Output is correct
39 Correct 1 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 2 ms 6488 KB Output is correct
6 Correct 2 ms 6488 KB Output is correct
7 Correct 2 ms 6488 KB Output is correct
8 Correct 3 ms 6488 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 2 ms 6488 KB Output is correct
11 Correct 2 ms 6488 KB Output is correct
12 Correct 2 ms 6488 KB Output is correct
13 Correct 3 ms 6488 KB Output is correct
14 Correct 2 ms 6488 KB Output is correct
15 Correct 3 ms 6488 KB Output is correct
16 Correct 3 ms 6488 KB Output is correct
17 Correct 2 ms 6488 KB Output is correct
18 Correct 1 ms 6488 KB Output is correct
19 Correct 1 ms 6488 KB Output is correct
20 Correct 2 ms 6488 KB Output is correct
21 Correct 3 ms 6612 KB Output is correct
22 Correct 4 ms 6488 KB Output is correct
23 Correct 3 ms 6608 KB Output is correct
24 Correct 3 ms 6488 KB Output is correct
25 Correct 1 ms 6584 KB Output is correct
26 Correct 1 ms 6592 KB Output is correct
27 Correct 2 ms 6488 KB Output is correct
28 Correct 5 ms 6608 KB Output is correct
29 Correct 4 ms 6488 KB Output is correct
30 Correct 4 ms 6488 KB Output is correct
31 Correct 3 ms 6536 KB Output is correct
32 Correct 4 ms 6488 KB Output is correct
33 Correct 1 ms 6488 KB Output is correct
34 Correct 2 ms 6488 KB Output is correct
35 Correct 2 ms 6488 KB Output is correct
36 Correct 2 ms 6484 KB Output is correct
37 Correct 2 ms 6484 KB Output is correct
38 Correct 2 ms 6488 KB Output is correct
39 Correct 1 ms 6488 KB Output is correct
40 Correct 1 ms 6488 KB Output is correct
41 Correct 0 ms 6488 KB Output is correct
42 Correct 1 ms 6488 KB Output is correct
43 Correct 1 ms 6592 KB Output is correct
44 Correct 1 ms 6488 KB Output is correct
45 Correct 3 ms 6488 KB Output is correct
46 Correct 2 ms 6488 KB Output is correct
47 Correct 3 ms 6604 KB Output is correct
48 Correct 2 ms 6488 KB Output is correct
49 Correct 2 ms 6488 KB Output is correct
50 Correct 2 ms 6488 KB Output is correct
51 Correct 3 ms 6488 KB Output is correct
52 Correct 2 ms 6488 KB Output is correct
53 Correct 2 ms 6488 KB Output is correct
54 Correct 3 ms 6488 KB Output is correct
55 Correct 2 ms 6608 KB Output is correct
56 Correct 2 ms 6488 KB Output is correct
57 Correct 2 ms 6488 KB Output is correct
58 Correct 23 ms 6632 KB Output is correct
59 Correct 32 ms 6660 KB Output is correct
60 Correct 8 ms 6488 KB Output is correct
61 Correct 39 ms 6656 KB Output is correct
62 Correct 13 ms 6488 KB Output is correct
63 Correct 32 ms 6488 KB Output is correct
64 Correct 18 ms 6488 KB Output is correct
65 Correct 60 ms 6488 KB Output is correct
66 Correct 52 ms 6484 KB Output is correct
67 Correct 40 ms 6736 KB Output is correct
68 Correct 40 ms 6488 KB Output is correct
69 Correct 38 ms 6488 KB Output is correct
70 Correct 37 ms 6488 KB Output is correct
71 Correct 1 ms 6488 KB Output is correct
72 Correct 1 ms 6600 KB Output is correct
73 Correct 3 ms 6488 KB Output is correct
74 Correct 3 ms 6488 KB Output is correct
75 Correct 3 ms 6488 KB Output is correct
76 Correct 3 ms 6588 KB Output is correct
77 Correct 3 ms 6488 KB Output is correct
78 Correct 0 ms 6488 KB Output is correct
79 Correct 0 ms 6488 KB Output is correct
80 Correct 2 ms 6488 KB Output is correct
81 Correct 4 ms 6488 KB Output is correct
82 Correct 4 ms 6488 KB Output is correct
83 Correct 4 ms 6488 KB Output is correct
84 Correct 4 ms 6616 KB Output is correct
85 Correct 4 ms 6488 KB Output is correct
86 Correct 1 ms 6488 KB Output is correct
87 Correct 1 ms 6488 KB Output is correct
88 Correct 1 ms 6488 KB Output is correct
89 Correct 1 ms 6488 KB Output is correct
90 Correct 2 ms 6488 KB Output is correct
91 Correct 1 ms 6488 KB Output is correct
92 Correct 2 ms 6740 KB Output is correct
93 Correct 2 ms 6488 KB Output is correct
94 Correct 4 ms 6488 KB Output is correct
95 Correct 31 ms 6636 KB Output is correct
96 Correct 39 ms 6740 KB Output is correct
97 Correct 35 ms 6488 KB Output is correct
98 Correct 40 ms 6668 KB Output is correct
99 Correct 52 ms 6672 KB Output is correct
100 Correct 2 ms 6488 KB Output is correct
101 Correct 5 ms 6488 KB Output is correct
102 Correct 34 ms 6688 KB Output is correct
103 Correct 27 ms 6744 KB Output is correct
104 Correct 34 ms 6676 KB Output is correct
105 Correct 38 ms 6644 KB Output is correct
106 Correct 37 ms 6752 KB Output is correct
107 Correct 1 ms 6488 KB Output is correct
108 Correct 5 ms 6488 KB Output is correct
109 Correct 10 ms 6660 KB Output is correct
110 Correct 10 ms 6680 KB Output is correct
111 Correct 11 ms 6488 KB Output is correct
112 Correct 11 ms 6644 KB Output is correct
113 Correct 10 ms 6680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 1 ms 6488 KB Output is correct
3 Correct 0 ms 6488 KB Output is correct
4 Correct 1 ms 6488 KB Output is correct
5 Correct 833 ms 38192 KB Output is correct
6 Correct 1044 ms 41480 KB Output is correct
7 Correct 515 ms 26960 KB Output is correct
8 Correct 1016 ms 42304 KB Output is correct
9 Correct 170 ms 11904 KB Output is correct
10 Correct 1006 ms 41540 KB Output is correct
11 Correct 1010 ms 43088 KB Output is correct
12 Correct 1059 ms 42676 KB Output is correct
13 Correct 1018 ms 42804 KB Output is correct
14 Correct 1014 ms 41556 KB Output is correct
15 Correct 1022 ms 42320 KB Output is correct
16 Correct 1048 ms 43196 KB Output is correct
17 Correct 1051 ms 43200 KB Output is correct
18 Correct 1 ms 6488 KB Output is correct
19 Correct 1 ms 6488 KB Output is correct
20 Correct 2 ms 6488 KB Output is correct
21 Correct 1 ms 6488 KB Output is correct
22 Correct 1 ms 6488 KB Output is correct
23 Correct 2 ms 6488 KB Output is correct
24 Correct 1 ms 6488 KB Output is correct
25 Correct 2 ms 6488 KB Output is correct
26 Correct 6 ms 6488 KB Output is correct
27 Correct 13 ms 6488 KB Output is correct
28 Correct 11 ms 6488 KB Output is correct
29 Correct 10 ms 6488 KB Output is correct
30 Correct 11 ms 6488 KB Output is correct
31 Correct 10 ms 6488 KB Output is correct
32 Correct 1 ms 6488 KB Output is correct
33 Correct 1018 ms 41316 KB Output is correct
34 Correct 1022 ms 41552 KB Output is correct
35 Correct 1093 ms 42796 KB Output is correct
36 Correct 1025 ms 41464 KB Output is correct
37 Correct 1014 ms 42448 KB Output is correct
38 Correct 1042 ms 43168 KB Output is correct
39 Correct 1 ms 6488 KB Output is correct
40 Correct 600 ms 29776 KB Output is correct
41 Correct 1039 ms 41464 KB Output is correct
42 Correct 1064 ms 42944 KB Output is correct
43 Correct 1014 ms 41336 KB Output is correct
44 Correct 1043 ms 42436 KB Output is correct
45 Correct 1061 ms 43152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 0 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 820 ms 24620 KB Output is correct
5 Correct 2394 ms 43104 KB Output is correct
6 Correct 1135 ms 13448 KB Output is correct
7 Correct 2452 ms 42892 KB Output is correct
8 Correct 1189 ms 20624 KB Output is correct
9 Correct 2425 ms 42924 KB Output is correct
10 Correct 1576 ms 43208 KB Output is correct
11 Correct 2426 ms 43208 KB Output is correct
12 Correct 2214 ms 42944 KB Output is correct
13 Correct 2466 ms 43428 KB Output is correct
14 Correct 2490 ms 42904 KB Output is correct
15 Correct 2457 ms 43200 KB Output is correct
16 Correct 2492 ms 43200 KB Output is correct
17 Correct 1 ms 6488 KB Output is correct
18 Correct 0 ms 6488 KB Output is correct
19 Correct 2 ms 6488 KB Output is correct
20 Correct 4 ms 6612 KB Output is correct
21 Correct 3 ms 6488 KB Output is correct
22 Correct 5 ms 6488 KB Output is correct
23 Correct 3 ms 6488 KB Output is correct
24 Correct 4 ms 6488 KB Output is correct
25 Correct 1 ms 6488 KB Output is correct
26 Correct 5 ms 6488 KB Output is correct
27 Correct 33 ms 6488 KB Output is correct
28 Correct 30 ms 6488 KB Output is correct
29 Correct 39 ms 6992 KB Output is correct
30 Correct 30 ms 6488 KB Output is correct
31 Correct 33 ms 6744 KB Output is correct
32 Correct 1 ms 6488 KB Output is correct
33 Correct 594 ms 29864 KB Output is correct
34 Correct 1081 ms 41416 KB Output is correct
35 Correct 1045 ms 42944 KB Output is correct
36 Correct 1022 ms 41416 KB Output is correct
37 Correct 1025 ms 42436 KB Output is correct
38 Correct 1055 ms 43200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 0 ms 6488 KB Output is correct
3 Correct 1 ms 6488 KB Output is correct
4 Correct 820 ms 24620 KB Output is correct
5 Correct 2394 ms 43104 KB Output is correct
6 Correct 1135 ms 13448 KB Output is correct
7 Correct 2452 ms 42892 KB Output is correct
8 Correct 1189 ms 20624 KB Output is correct
9 Correct 2425 ms 42924 KB Output is correct
10 Correct 1576 ms 43208 KB Output is correct
11 Correct 2426 ms 43208 KB Output is correct
12 Correct 2214 ms 42944 KB Output is correct
13 Correct 2466 ms 43428 KB Output is correct
14 Correct 2490 ms 42904 KB Output is correct
15 Correct 2457 ms 43200 KB Output is correct
16 Correct 2492 ms 43200 KB Output is correct
17 Correct 1 ms 6488 KB Output is correct
18 Correct 0 ms 6488 KB Output is correct
19 Correct 2 ms 6488 KB Output is correct
20 Correct 4 ms 6612 KB Output is correct
21 Correct 3 ms 6488 KB Output is correct
22 Correct 5 ms 6488 KB Output is correct
23 Correct 3 ms 6488 KB Output is correct
24 Correct 4 ms 6488 KB Output is correct
25 Correct 1 ms 6488 KB Output is correct
26 Correct 5 ms 6488 KB Output is correct
27 Correct 33 ms 6488 KB Output is correct
28 Correct 30 ms 6488 KB Output is correct
29 Correct 39 ms 6992 KB Output is correct
30 Correct 30 ms 6488 KB Output is correct
31 Correct 33 ms 6744 KB Output is correct
32 Correct 1 ms 6488 KB Output is correct
33 Correct 594 ms 29864 KB Output is correct
34 Correct 1081 ms 41416 KB Output is correct
35 Correct 1045 ms 42944 KB Output is correct
36 Correct 1022 ms 41416 KB Output is correct
37 Correct 1025 ms 42436 KB Output is correct
38 Correct 1055 ms 43200 KB Output is correct
39 Correct 1 ms 6488 KB Output is correct
40 Correct 1 ms 6488 KB Output is correct
41 Correct 1 ms 6488 KB Output is correct
42 Correct 797 ms 24992 KB Output is correct
43 Correct 2470 ms 43424 KB Output is correct
44 Correct 1193 ms 13432 KB Output is correct
45 Correct 2413 ms 43252 KB Output is correct
46 Correct 1188 ms 21208 KB Output is correct
47 Correct 2550 ms 43020 KB Output is correct
48 Correct 1564 ms 43256 KB Output is correct
49 Correct 2492 ms 43648 KB Output is correct
50 Correct 2218 ms 42896 KB Output is correct
51 Correct 2424 ms 43292 KB Output is correct
52 Correct 2375 ms 43316 KB Output is correct
53 Correct 2463 ms 43468 KB Output is correct
54 Correct 2577 ms 43204 KB Output is correct
55 Correct 1 ms 6488 KB Output is correct
56 Execution timed out 4019 ms 42680 KB Time limit exceeded
57 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6488 KB Output is correct
2 Correct 0 ms 6488 KB Output is correct
3 Correct 858 ms 38968 KB Output is correct
4 Correct 1531 ms 43256 KB Output is correct
5 Correct 1041 ms 27692 KB Output is correct
6 Correct 1598 ms 43200 KB Output is correct
7 Correct 1150 ms 33728 KB Output is correct
8 Correct 1584 ms 43200 KB Output is correct
9 Correct 1 ms 6488 KB Output is correct
10 Correct 1 ms 6488 KB Output is correct
11 Correct 1 ms 6488 KB Output is correct
12 Correct 1 ms 6488 KB Output is correct
13 Correct 2 ms 6488 KB Output is correct
14 Correct 2 ms 6488 KB Output is correct
15 Correct 2 ms 6488 KB Output is correct
16 Correct 3 ms 6488 KB Output is correct
17 Correct 1 ms 6488 KB Output is correct
18 Correct 2 ms 6488 KB Output is correct
19 Correct 2 ms 6488 KB Output is correct
20 Correct 2 ms 6488 KB Output is correct
21 Correct 3 ms 6488 KB Output is correct
22 Correct 2 ms 6488 KB Output is correct
23 Correct 3 ms 6488 KB Output is correct
24 Correct 3 ms 6488 KB Output is correct
25 Correct 2 ms 6488 KB Output is correct
26 Correct 1 ms 6488 KB Output is correct
27 Correct 1 ms 6488 KB Output is correct
28 Correct 2 ms 6488 KB Output is correct
29 Correct 3 ms 6612 KB Output is correct
30 Correct 4 ms 6488 KB Output is correct
31 Correct 3 ms 6608 KB Output is correct
32 Correct 3 ms 6488 KB Output is correct
33 Correct 1 ms 6584 KB Output is correct
34 Correct 1 ms 6592 KB Output is correct
35 Correct 2 ms 6488 KB Output is correct
36 Correct 5 ms 6608 KB Output is correct
37 Correct 4 ms 6488 KB Output is correct
38 Correct 4 ms 6488 KB Output is correct
39 Correct 3 ms 6536 KB Output is correct
40 Correct 4 ms 6488 KB Output is correct
41 Correct 1 ms 6488 KB Output is correct
42 Correct 2 ms 6488 KB Output is correct
43 Correct 2 ms 6488 KB Output is correct
44 Correct 2 ms 6484 KB Output is correct
45 Correct 2 ms 6484 KB Output is correct
46 Correct 2 ms 6488 KB Output is correct
47 Correct 1 ms 6488 KB Output is correct
48 Correct 1 ms 6488 KB Output is correct
49 Correct 0 ms 6488 KB Output is correct
50 Correct 1 ms 6488 KB Output is correct
51 Correct 1 ms 6592 KB Output is correct
52 Correct 1 ms 6488 KB Output is correct
53 Correct 3 ms 6488 KB Output is correct
54 Correct 2 ms 6488 KB Output is correct
55 Correct 3 ms 6604 KB Output is correct
56 Correct 2 ms 6488 KB Output is correct
57 Correct 2 ms 6488 KB Output is correct
58 Correct 2 ms 6488 KB Output is correct
59 Correct 3 ms 6488 KB Output is correct
60 Correct 2 ms 6488 KB Output is correct
61 Correct 2 ms 6488 KB Output is correct
62 Correct 3 ms 6488 KB Output is correct
63 Correct 2 ms 6608 KB Output is correct
64 Correct 2 ms 6488 KB Output is correct
65 Correct 2 ms 6488 KB Output is correct
66 Correct 23 ms 6632 KB Output is correct
67 Correct 32 ms 6660 KB Output is correct
68 Correct 8 ms 6488 KB Output is correct
69 Correct 39 ms 6656 KB Output is correct
70 Correct 13 ms 6488 KB Output is correct
71 Correct 32 ms 6488 KB Output is correct
72 Correct 18 ms 6488 KB Output is correct
73 Correct 60 ms 6488 KB Output is correct
74 Correct 52 ms 6484 KB Output is correct
75 Correct 40 ms 6736 KB Output is correct
76 Correct 40 ms 6488 KB Output is correct
77 Correct 38 ms 6488 KB Output is correct
78 Correct 37 ms 6488 KB Output is correct
79 Correct 1 ms 6488 KB Output is correct
80 Correct 1 ms 6600 KB Output is correct
81 Correct 3 ms 6488 KB Output is correct
82 Correct 3 ms 6488 KB Output is correct
83 Correct 3 ms 6488 KB Output is correct
84 Correct 3 ms 6588 KB Output is correct
85 Correct 3 ms 6488 KB Output is correct
86 Correct 0 ms 6488 KB Output is correct
87 Correct 0 ms 6488 KB Output is correct
88 Correct 2 ms 6488 KB Output is correct
89 Correct 4 ms 6488 KB Output is correct
90 Correct 4 ms 6488 KB Output is correct
91 Correct 4 ms 6488 KB Output is correct
92 Correct 4 ms 6616 KB Output is correct
93 Correct 4 ms 6488 KB Output is correct
94 Correct 1 ms 6488 KB Output is correct
95 Correct 1 ms 6488 KB Output is correct
96 Correct 1 ms 6488 KB Output is correct
97 Correct 1 ms 6488 KB Output is correct
98 Correct 2 ms 6488 KB Output is correct
99 Correct 1 ms 6488 KB Output is correct
100 Correct 2 ms 6740 KB Output is correct
101 Correct 2 ms 6488 KB Output is correct
102 Correct 4 ms 6488 KB Output is correct
103 Correct 31 ms 6636 KB Output is correct
104 Correct 39 ms 6740 KB Output is correct
105 Correct 35 ms 6488 KB Output is correct
106 Correct 40 ms 6668 KB Output is correct
107 Correct 52 ms 6672 KB Output is correct
108 Correct 2 ms 6488 KB Output is correct
109 Correct 5 ms 6488 KB Output is correct
110 Correct 34 ms 6688 KB Output is correct
111 Correct 27 ms 6744 KB Output is correct
112 Correct 34 ms 6676 KB Output is correct
113 Correct 38 ms 6644 KB Output is correct
114 Correct 37 ms 6752 KB Output is correct
115 Correct 1 ms 6488 KB Output is correct
116 Correct 5 ms 6488 KB Output is correct
117 Correct 10 ms 6660 KB Output is correct
118 Correct 10 ms 6680 KB Output is correct
119 Correct 11 ms 6488 KB Output is correct
120 Correct 11 ms 6644 KB Output is correct
121 Correct 10 ms 6680 KB Output is correct
122 Correct 1 ms 6488 KB Output is correct
123 Correct 1 ms 6488 KB Output is correct
124 Correct 0 ms 6488 KB Output is correct
125 Correct 1 ms 6488 KB Output is correct
126 Correct 833 ms 38192 KB Output is correct
127 Correct 1044 ms 41480 KB Output is correct
128 Correct 515 ms 26960 KB Output is correct
129 Correct 1016 ms 42304 KB Output is correct
130 Correct 170 ms 11904 KB Output is correct
131 Correct 1006 ms 41540 KB Output is correct
132 Correct 1010 ms 43088 KB Output is correct
133 Correct 1059 ms 42676 KB Output is correct
134 Correct 1018 ms 42804 KB Output is correct
135 Correct 1014 ms 41556 KB Output is correct
136 Correct 1022 ms 42320 KB Output is correct
137 Correct 1048 ms 43196 KB Output is correct
138 Correct 1051 ms 43200 KB Output is correct
139 Correct 1 ms 6488 KB Output is correct
140 Correct 1 ms 6488 KB Output is correct
141 Correct 2 ms 6488 KB Output is correct
142 Correct 1 ms 6488 KB Output is correct
143 Correct 1 ms 6488 KB Output is correct
144 Correct 2 ms 6488 KB Output is correct
145 Correct 1 ms 6488 KB Output is correct
146 Correct 2 ms 6488 KB Output is correct
147 Correct 6 ms 6488 KB Output is correct
148 Correct 13 ms 6488 KB Output is correct
149 Correct 11 ms 6488 KB Output is correct
150 Correct 10 ms 6488 KB Output is correct
151 Correct 11 ms 6488 KB Output is correct
152 Correct 10 ms 6488 KB Output is correct
153 Correct 1 ms 6488 KB Output is correct
154 Correct 1018 ms 41316 KB Output is correct
155 Correct 1022 ms 41552 KB Output is correct
156 Correct 1093 ms 42796 KB Output is correct
157 Correct 1025 ms 41464 KB Output is correct
158 Correct 1014 ms 42448 KB Output is correct
159 Correct 1042 ms 43168 KB Output is correct
160 Correct 1 ms 6488 KB Output is correct
161 Correct 600 ms 29776 KB Output is correct
162 Correct 1039 ms 41464 KB Output is correct
163 Correct 1064 ms 42944 KB Output is correct
164 Correct 1014 ms 41336 KB Output is correct
165 Correct 1043 ms 42436 KB Output is correct
166 Correct 1061 ms 43152 KB Output is correct
167 Correct 1 ms 6488 KB Output is correct
168 Correct 0 ms 6488 KB Output is correct
169 Correct 1 ms 6488 KB Output is correct
170 Correct 820 ms 24620 KB Output is correct
171 Correct 2394 ms 43104 KB Output is correct
172 Correct 1135 ms 13448 KB Output is correct
173 Correct 2452 ms 42892 KB Output is correct
174 Correct 1189 ms 20624 KB Output is correct
175 Correct 2425 ms 42924 KB Output is correct
176 Correct 1576 ms 43208 KB Output is correct
177 Correct 2426 ms 43208 KB Output is correct
178 Correct 2214 ms 42944 KB Output is correct
179 Correct 2466 ms 43428 KB Output is correct
180 Correct 2490 ms 42904 KB Output is correct
181 Correct 2457 ms 43200 KB Output is correct
182 Correct 2492 ms 43200 KB Output is correct
183 Correct 1 ms 6488 KB Output is correct
184 Correct 0 ms 6488 KB Output is correct
185 Correct 2 ms 6488 KB Output is correct
186 Correct 4 ms 6612 KB Output is correct
187 Correct 3 ms 6488 KB Output is correct
188 Correct 5 ms 6488 KB Output is correct
189 Correct 3 ms 6488 KB Output is correct
190 Correct 4 ms 6488 KB Output is correct
191 Correct 1 ms 6488 KB Output is correct
192 Correct 5 ms 6488 KB Output is correct
193 Correct 33 ms 6488 KB Output is correct
194 Correct 30 ms 6488 KB Output is correct
195 Correct 39 ms 6992 KB Output is correct
196 Correct 30 ms 6488 KB Output is correct
197 Correct 33 ms 6744 KB Output is correct
198 Correct 1 ms 6488 KB Output is correct
199 Correct 594 ms 29864 KB Output is correct
200 Correct 1081 ms 41416 KB Output is correct
201 Correct 1045 ms 42944 KB Output is correct
202 Correct 1022 ms 41416 KB Output is correct
203 Correct 1025 ms 42436 KB Output is correct
204 Correct 1055 ms 43200 KB Output is correct
205 Correct 1 ms 6488 KB Output is correct
206 Correct 1 ms 6488 KB Output is correct
207 Correct 1 ms 6488 KB Output is correct
208 Correct 797 ms 24992 KB Output is correct
209 Correct 2470 ms 43424 KB Output is correct
210 Correct 1193 ms 13432 KB Output is correct
211 Correct 2413 ms 43252 KB Output is correct
212 Correct 1188 ms 21208 KB Output is correct
213 Correct 2550 ms 43020 KB Output is correct
214 Correct 1564 ms 43256 KB Output is correct
215 Correct 2492 ms 43648 KB Output is correct
216 Correct 2218 ms 42896 KB Output is correct
217 Correct 2424 ms 43292 KB Output is correct
218 Correct 2375 ms 43316 KB Output is correct
219 Correct 2463 ms 43468 KB Output is correct
220 Correct 2577 ms 43204 KB Output is correct
221 Correct 1 ms 6488 KB Output is correct
222 Execution timed out 4019 ms 42680 KB Time limit exceeded
223 Halted 0 ms 0 KB -