답안 #911238

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
911238 2024-01-18T16:43:55 Z cadmiumsky Fish 2 (JOI22_fish2) C++17
83 / 100
4000 ms 27136 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

const int nmax = 1e5 + 5;
const int inf = 1e9 + 5;

template<typename Node> 
struct AINT {
  vector<Node> aint;
  int n;
  void init(int _n, Node TMP = Node()) {
    n = _n;
    aint.assign(2 * n + 5, TMP);
  }
  
  tii getsons(int node, int cl, int cr) { int mid = cl + cr >> 1; return tii{mid, node + 1, node + (mid - cl + 1) * 2};}
  
  template<class CB> void walk(int ismutable, int toRight, CB&& cb) { 
    if(ismutable == 0 && toRight == 0) walk<0, 0>(cb, 1, 1, n); 
    else if(ismutable == 0) walk<0, 1>(cb, 1, 1, n); 
    else if(toRight == 0) walk<1, 0>(cb, 1, 1, n);
    else walk<1, 1>(cb, 1, 1, n);
  }
  template<int ismutable, int toRight, class CB> void walk(CB&& cb, int node, int cl, int cr) { 
    
    //cerr << node << '\t' << cl << ' ' << cr << '\n';
    
    if(!cb(aint[node], cl, cr)) return;
    
    auto [mid, L, R] = getsons(node, cl, cr);
    aint[node].push(aint[L], aint[R]);
    
    if(toRight) walk<ismutable, toRight>(cb, L, cl, mid), walk<ismutable, toRight>(cb, R, mid + 1, cr);
    else walk<ismutable, toRight>(cb, R, mid + 1, cr), walk<ismutable, toRight>(cb, L, cl, mid);
    
    if(ismutable) aint[node].pull(aint[L], aint[R]);
    return;
  }
};

struct MinCounter {
  int mn, cnt;
  
  int add;
  
  MinCounter(int a, int b, int c = 0): mn(a), cnt(b), add(c) {;}
  MinCounter(): mn(inf), cnt(0), add(0) {;}
  
  void push(MinCounter& a, MinCounter& b) {
    a.mn += add;
    a.add += add;
    b.add += add;
    b.mn += add;
    
    add = 0;
  }
  
  void pull(const MinCounter a, const MinCounter b) {
    *this = MinCounter(min(a.mn, b.mn), a.cnt * (a.mn <= b.mn) + b.cnt * (b.mn <= a.mn));
  }
};

struct GreaterFinder {
  int mx;
  GreaterFinder(int a = 0): mx(a) {;}
  void pull(const GreaterFinder& a, const GreaterFinder& b) { *this = GreaterFinder(max(a.mx, b.mx)); }
  void push(const GreaterFinder& a, const GreaterFinder& b) {;}
};

struct Sum {
  ll sum;
  Sum(ll a = 0): sum(a) {;}
  void pull(const Sum& a, const Sum& b) { *this = Sum(a.sum + b.sum); }
  void push(const Sum& a, const Sum& b) {;}
};

int a[nmax];

AINT<Sum> sum;

ll getsum(int l, int r) { 
  ll rez = 0;
  
  //for(int i = l; i <= r; i++)
    //rez += a[i];
  
  sum.walk(0, 1, [&](Sum& a, int cl, int cr) { if(cr < l || r < cl) return 0; if(l <= cl && cr <= r) { rez += a.sum; return 0; } return 1; }); return rez; 
  
  return rez;
}

AINT<MinCounter> mncnt;

int n;

namespace Finders {
  AINT<GreaterFinder> finder;
  
  int nextGreater(int P, ll lim) { // urmatorul de la pozitia P >= lim
    int rez = n + 1;
    finder.walk(0, 1, 
      [&](GreaterFinder& a, int cl, int cr) { if(rez < cl) return 0; if(cr < P || a.mx < lim) { rez = cr + 1; return 0; } if(cl == cr) { rez = cl; return 0; } return 1; });
    return rez;
  }
  
  int prevGreater(int P, ll lim) {
    int rez = 0;
    finder.walk(0, 0, 
      [&](GreaterFinder& a, int cl, int cr) { if(rez > cr) return 0; if(P < cl || a.mx < lim) { rez = cl - 1; return 0; } if(cl == cr) { rez = cl; return 0; } return 1; });
    return rez;
  }
  
  int nextBreaker(int L, int start) {
    int ptr = start;
    while(ptr < n) {
      int essai = nextGreater(ptr + 1, getsum(L, ptr) + 1);
      if(essai == ptr + 1) {
        return ptr + 1;
      }
      ptr = essai - 1;
    }
    return n + 1;
  }
  
  int prevBreaker(int R, int start) {
    int ptr = start;
    while(ptr > 1) {
      int essai = prevGreater(ptr - 1, getsum(ptr, R) + 1);
      if(essai == ptr - 1) {
        return ptr - 1;
      }
      ptr = essai + 1;
    }
    return 0;
  }
}


vector<pii> getIntervs(int P) {
  
  using namespace Finders;
  vector<pii> elems;
  
  
  
  int L = P, R = P, direction = 1, fail = 0;
  while(L > 1 || R < n) {
    if(direction == 1) {
      int nvR = nextBreaker(L, R) - 1;
      if(nvR == R && fail) {
        elems.emplace_back(L, R);
        if((L != 1 && a[L - 1] <= a[R + 1]) || R == n) L--;
        else R++;
        fail = 0;
      }
      else { fail = R == nvR; R = nvR; }
    }
    
    else {
      int nvL = prevBreaker(R, L) + 1;
      if(nvL == L && fail) {
        elems.emplace_back(L, R);
        if((L != 1 && a[L - 1] <= a[R + 1]) || R == n) L--;
        else R++;
        fail = 0;
      }
      else {fail = L == nvL; L = nvL; }
    }
    
    direction *= -1;
  }
  
  return elems;
}


namespace Segments {
  set<pii> appearingIntervs;
  
  void erase(int l, int r) {
    if(appearingIntervs.count(pii{l, r})) {
      appearingIntervs.erase(pii{l, r});
      mncnt.walk(1, 1, [&](MinCounter& val, int cl, int cr) {
        if(cr < l || r < cl) return 0;
        if(l <= cl && cr <= r) {
          val.mn -= 1;
          val.add -= 1;
          return 0;
        }
        return 1;
      });
    }
    return;
  }
  
  void insert(int l, int r) {
    if(!appearingIntervs.count(pii{l, r})) {
      appearingIntervs.insert(pii{l, r});
      
      mncnt.walk(1, 1, [&](MinCounter& val, int cl, int cr) {
        if(cr < l || r < cl) return 0;
        if(l <= cl && cr <= r) {
          val.mn += 1;
          val.add += 1;
          return 0;
        }
        return 1;
      });
    }
    return;
  }
}

void updPoz(int P, int x) {
  
  vector<pii> V = getIntervs(P), T;
  V.reserve(60);
  if(P > 1) T = getIntervs(P - 1), copy(all(T), back_inserter(V));
  if(P < n) T = getIntervs(P + 1), copy(all(T), back_inserter(V));
  
  for(auto [l, r] : V)
    Segments::erase(l, r);
  
  Finders::finder.walk(1, 1, [&](GreaterFinder& val, int cl, int cr) {
    if(cr < P || P < cl) return 0;
    if(cl == cr) {
      val = GreaterFinder(x);
      return 0;
    } 
    return 1;
  });
  
  a[P] = x;
  
  sum.walk(1, 1, [&](Sum& val, int cl, int cr) {
    if(cr < P || P < cl) return 0;
    if(cl == cr) {
      val = Sum(x);
      return 0;
    } 
    return 1;
  });
  
  V = getIntervs(P);
  if(P > 1) T = getIntervs(P - 1), copy(all(T), back_inserter(V));
  if(P < n) T = getIntervs(P + 1), copy(all(T), back_inserter(V));
 
  for(auto [l, r] : V)
    Segments::insert(l, r);
    
  return;
}

int query(int l, int r) {
  int answer = l, ptr = l;
  while(ptr <= r) {
    ptr = Finders::nextBreaker(l, ptr);
    if(ptr <= r) answer = ptr;
  }
  
  l = answer;
  
  answer = ptr = r;
  while(ptr >= l) {
    ptr = Finders::prevBreaker(r, ptr);
    if(ptr >= l) answer = ptr;
  }
  
  r = answer;
  
  MinCounter cnt(1e9 + 5, -1, 0), cnt2;
  
  mncnt.walk(0, 1, [&](MinCounter& val, int cl, int cr) {
    if(cr < l || r < cl) return 0;
    if(l <= cl && cr <= r) {
      cnt.pull(cnt, val);
      return 0;
    }
    return 1;
  });
  
  return cnt.cnt;
}


signed main() {
  cin >> n;
  for(int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  
  using namespace Finders;
  
  finder.init(n);
  mncnt.init(n);
  sum.init(n);
  
  finder.walk(1, 1, [&](GreaterFinder& val, int cl, int cr) { if(cl != cr) return 1; val = GreaterFinder(a[cl]); return 0;});
  mncnt.walk(1, 1, [&](MinCounter& val, int cl, int cr) { if(cl != cr) return 1; val = MinCounter(0, 1); return 0;});
  sum.walk(1, 1, [&](Sum& val, int cl, int cr) { if(cl != cr) return 1; val = Sum(a[cl]); return 0;});
  
  vector<pii> V, T;
  for(int i = 1; i <= n; i++) {
    T = getIntervs(i);
    copy(all(T), back_inserter(V));
  }
  
  for(auto [l, r] : V) {
    Segments::insert(l, r);
  }
  
  int q;
  cin >> q;
  for(int TC = 0, t, x, y; TC < q; TC++) {
    cin >> t >> x >> y;
    if(t == 1)
      updPoz(x, y);
    else
      cout << query(x, y) << '\n';
  }
}

/**
      Anul asta se da centroid.
-- Surse oficiale
*/

Compilation message

fish2.cpp: In instantiation of 'tii AINT<Node>::getsons(int, int, int) [with Node = Sum; tii = std::tuple<int, int, int>]':
fish2.cpp:41:24:   required from 'void AINT<Node>::walk(CB&&, int, int, int) [with int ismutable = 0; int toRight = 0; CB = getsum(int, int)::<lambda(Sum&, int, int)>&; Node = Sum]'
fish2.cpp:30:50:   required from 'void AINT<Node>::walk(int, int, CB&&) [with CB = getsum(int, int)::<lambda(Sum&, int, int)>; Node = Sum]'
fish2.cpp:98:141:   required from here
fish2.cpp:27:56: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   27 |   tii getsons(int node, int cl, int cr) { int mid = cl + cr >> 1; return tii{mid, node + 1, node + (mid - cl + 1) * 2};}
      |                                                     ~~~^~~~
fish2.cpp: In instantiation of 'tii AINT<Node>::getsons(int, int, int) [with Node = GreaterFinder; tii = std::tuple<int, int, int>]':
fish2.cpp:41:24:   required from 'void AINT<Node>::walk(CB&&, int, int, int) [with int ismutable = 0; int toRight = 0; CB = Finders::nextGreater(int, ll)::<lambda(GreaterFinder&, int, int)>&; Node = GreaterFinder]'
fish2.cpp:30:50:   required from 'void AINT<Node>::walk(int, int, CB&&) [with CB = Finders::nextGreater(int, ll)::<lambda(GreaterFinder&, int, int)>; Node = GreaterFinder]'
fish2.cpp:113:171:   required from here
fish2.cpp:27:56: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
fish2.cpp: In instantiation of 'tii AINT<Node>::getsons(int, int, int) [with Node = MinCounter; tii = std::tuple<int, int, int>]':
fish2.cpp:41:24:   required from 'void AINT<Node>::walk(CB&&, int, int, int) [with int ismutable = 0; int toRight = 0; CB = Segments::erase(int, int)::<lambda(MinCounter&, int, int)>&; Node = MinCounter]'
fish2.cpp:30:50:   required from 'void AINT<Node>::walk(int, int, CB&&) [with CB = Segments::erase(int, int)::<lambda(MinCounter&, int, int)>; Node = MinCounter]'
fish2.cpp:202:8:   required from here
fish2.cpp:27:56: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 11 ms 568 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 13 ms 588 KB Output is correct
8 Correct 9 ms 576 KB Output is correct
9 Correct 7 ms 604 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 348 KB Output is correct
13 Correct 6 ms 348 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 9 ms 568 KB Output is correct
16 Correct 5 ms 464 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 344 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 674 ms 24036 KB Output is correct
3 Correct 1042 ms 23260 KB Output is correct
4 Correct 658 ms 22504 KB Output is correct
5 Correct 1037 ms 23656 KB Output is correct
6 Correct 135 ms 8136 KB Output is correct
7 Correct 562 ms 10276 KB Output is correct
8 Correct 137 ms 7884 KB Output is correct
9 Correct 558 ms 10676 KB Output is correct
10 Correct 756 ms 15364 KB Output is correct
11 Correct 1077 ms 22284 KB Output is correct
12 Correct 255 ms 8580 KB Output is correct
13 Correct 255 ms 8768 KB Output is correct
14 Correct 178 ms 9456 KB Output is correct
15 Correct 191 ms 9516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 11 ms 568 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 13 ms 588 KB Output is correct
8 Correct 9 ms 576 KB Output is correct
9 Correct 7 ms 604 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 348 KB Output is correct
13 Correct 6 ms 348 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 9 ms 568 KB Output is correct
16 Correct 5 ms 464 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 344 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 674 ms 24036 KB Output is correct
23 Correct 1042 ms 23260 KB Output is correct
24 Correct 658 ms 22504 KB Output is correct
25 Correct 1037 ms 23656 KB Output is correct
26 Correct 135 ms 8136 KB Output is correct
27 Correct 562 ms 10276 KB Output is correct
28 Correct 137 ms 7884 KB Output is correct
29 Correct 558 ms 10676 KB Output is correct
30 Correct 756 ms 15364 KB Output is correct
31 Correct 1077 ms 22284 KB Output is correct
32 Correct 255 ms 8580 KB Output is correct
33 Correct 255 ms 8768 KB Output is correct
34 Correct 178 ms 9456 KB Output is correct
35 Correct 191 ms 9516 KB Output is correct
36 Correct 693 ms 22700 KB Output is correct
37 Correct 1074 ms 22708 KB Output is correct
38 Correct 995 ms 23732 KB Output is correct
39 Correct 696 ms 22920 KB Output is correct
40 Correct 1056 ms 22672 KB Output is correct
41 Correct 125 ms 7792 KB Output is correct
42 Correct 123 ms 7964 KB Output is correct
43 Correct 524 ms 11264 KB Output is correct
44 Correct 529 ms 11728 KB Output is correct
45 Correct 863 ms 15764 KB Output is correct
46 Correct 769 ms 13792 KB Output is correct
47 Correct 955 ms 15648 KB Output is correct
48 Correct 264 ms 9156 KB Output is correct
49 Correct 261 ms 9284 KB Output is correct
50 Correct 186 ms 9588 KB Output is correct
51 Correct 187 ms 9472 KB Output is correct
52 Correct 186 ms 9464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 674 ms 24036 KB Output is correct
3 Correct 1042 ms 23260 KB Output is correct
4 Correct 658 ms 22504 KB Output is correct
5 Correct 1037 ms 23656 KB Output is correct
6 Correct 135 ms 8136 KB Output is correct
7 Correct 562 ms 10276 KB Output is correct
8 Correct 137 ms 7884 KB Output is correct
9 Correct 558 ms 10676 KB Output is correct
10 Correct 756 ms 15364 KB Output is correct
11 Correct 1077 ms 22284 KB Output is correct
12 Correct 255 ms 8580 KB Output is correct
13 Correct 255 ms 8768 KB Output is correct
14 Correct 178 ms 9456 KB Output is correct
15 Correct 191 ms 9516 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1825 ms 23624 KB Output is correct
18 Correct 1224 ms 23432 KB Output is correct
19 Correct 1796 ms 24536 KB Output is correct
20 Correct 1844 ms 24828 KB Output is correct
21 Correct 1731 ms 22448 KB Output is correct
22 Correct 1257 ms 22972 KB Output is correct
23 Correct 1704 ms 24184 KB Output is correct
24 Correct 1870 ms 23688 KB Output is correct
25 Correct 1748 ms 22896 KB Output is correct
26 Correct 1981 ms 25620 KB Output is correct
27 Correct 448 ms 8652 KB Output is correct
28 Correct 452 ms 8392 KB Output is correct
29 Correct 443 ms 8552 KB Output is correct
30 Correct 1323 ms 14036 KB Output is correct
31 Correct 1458 ms 15548 KB Output is correct
32 Correct 2127 ms 23216 KB Output is correct
33 Correct 1214 ms 14692 KB Output is correct
34 Correct 2144 ms 22036 KB Output is correct
35 Correct 1721 ms 14976 KB Output is correct
36 Correct 1562 ms 15392 KB Output is correct
37 Correct 687 ms 8984 KB Output is correct
38 Correct 664 ms 9316 KB Output is correct
39 Correct 583 ms 10284 KB Output is correct
40 Correct 552 ms 10248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 674 ms 24036 KB Output is correct
3 Correct 1042 ms 23260 KB Output is correct
4 Correct 658 ms 22504 KB Output is correct
5 Correct 1037 ms 23656 KB Output is correct
6 Correct 135 ms 8136 KB Output is correct
7 Correct 562 ms 10276 KB Output is correct
8 Correct 137 ms 7884 KB Output is correct
9 Correct 558 ms 10676 KB Output is correct
10 Correct 756 ms 15364 KB Output is correct
11 Correct 1077 ms 22284 KB Output is correct
12 Correct 255 ms 8580 KB Output is correct
13 Correct 255 ms 8768 KB Output is correct
14 Correct 178 ms 9456 KB Output is correct
15 Correct 191 ms 9516 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 3397 ms 23504 KB Output is correct
18 Correct 2822 ms 25376 KB Output is correct
19 Correct 3320 ms 23952 KB Output is correct
20 Correct 2561 ms 26976 KB Output is correct
21 Correct 3878 ms 23236 KB Output is correct
22 Correct 2768 ms 27136 KB Output is correct
23 Correct 3987 ms 25504 KB Output is correct
24 Correct 2678 ms 25212 KB Output is correct
25 Correct 3776 ms 23760 KB Output is correct
26 Correct 775 ms 10628 KB Output is correct
27 Correct 930 ms 10600 KB Output is correct
28 Correct 1744 ms 16136 KB Output is correct
29 Correct 739 ms 10848 KB Output is correct
30 Correct 830 ms 10732 KB Output is correct
31 Correct 1935 ms 16448 KB Output is correct
32 Correct 2708 ms 23548 KB Output is correct
33 Correct 2176 ms 16308 KB Output is correct
34 Correct 2261 ms 19788 KB Output is correct
35 Correct 1696 ms 16524 KB Output is correct
36 Correct 2510 ms 23668 KB Output is correct
37 Correct 1695 ms 11872 KB Output is correct
38 Correct 1272 ms 11440 KB Output is correct
39 Correct 1002 ms 11968 KB Output is correct
40 Correct 656 ms 12156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 11 ms 568 KB Output is correct
6 Correct 6 ms 348 KB Output is correct
7 Correct 13 ms 588 KB Output is correct
8 Correct 9 ms 576 KB Output is correct
9 Correct 7 ms 604 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 348 KB Output is correct
13 Correct 6 ms 348 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 9 ms 568 KB Output is correct
16 Correct 5 ms 464 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 4 ms 344 KB Output is correct
20 Correct 3 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 674 ms 24036 KB Output is correct
23 Correct 1042 ms 23260 KB Output is correct
24 Correct 658 ms 22504 KB Output is correct
25 Correct 1037 ms 23656 KB Output is correct
26 Correct 135 ms 8136 KB Output is correct
27 Correct 562 ms 10276 KB Output is correct
28 Correct 137 ms 7884 KB Output is correct
29 Correct 558 ms 10676 KB Output is correct
30 Correct 756 ms 15364 KB Output is correct
31 Correct 1077 ms 22284 KB Output is correct
32 Correct 255 ms 8580 KB Output is correct
33 Correct 255 ms 8768 KB Output is correct
34 Correct 178 ms 9456 KB Output is correct
35 Correct 191 ms 9516 KB Output is correct
36 Correct 693 ms 22700 KB Output is correct
37 Correct 1074 ms 22708 KB Output is correct
38 Correct 995 ms 23732 KB Output is correct
39 Correct 696 ms 22920 KB Output is correct
40 Correct 1056 ms 22672 KB Output is correct
41 Correct 125 ms 7792 KB Output is correct
42 Correct 123 ms 7964 KB Output is correct
43 Correct 524 ms 11264 KB Output is correct
44 Correct 529 ms 11728 KB Output is correct
45 Correct 863 ms 15764 KB Output is correct
46 Correct 769 ms 13792 KB Output is correct
47 Correct 955 ms 15648 KB Output is correct
48 Correct 264 ms 9156 KB Output is correct
49 Correct 261 ms 9284 KB Output is correct
50 Correct 186 ms 9588 KB Output is correct
51 Correct 187 ms 9472 KB Output is correct
52 Correct 186 ms 9464 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1825 ms 23624 KB Output is correct
55 Correct 1224 ms 23432 KB Output is correct
56 Correct 1796 ms 24536 KB Output is correct
57 Correct 1844 ms 24828 KB Output is correct
58 Correct 1731 ms 22448 KB Output is correct
59 Correct 1257 ms 22972 KB Output is correct
60 Correct 1704 ms 24184 KB Output is correct
61 Correct 1870 ms 23688 KB Output is correct
62 Correct 1748 ms 22896 KB Output is correct
63 Correct 1981 ms 25620 KB Output is correct
64 Correct 448 ms 8652 KB Output is correct
65 Correct 452 ms 8392 KB Output is correct
66 Correct 443 ms 8552 KB Output is correct
67 Correct 1323 ms 14036 KB Output is correct
68 Correct 1458 ms 15548 KB Output is correct
69 Correct 2127 ms 23216 KB Output is correct
70 Correct 1214 ms 14692 KB Output is correct
71 Correct 2144 ms 22036 KB Output is correct
72 Correct 1721 ms 14976 KB Output is correct
73 Correct 1562 ms 15392 KB Output is correct
74 Correct 687 ms 8984 KB Output is correct
75 Correct 664 ms 9316 KB Output is correct
76 Correct 583 ms 10284 KB Output is correct
77 Correct 552 ms 10248 KB Output is correct
78 Correct 1 ms 344 KB Output is correct
79 Correct 3397 ms 23504 KB Output is correct
80 Correct 2822 ms 25376 KB Output is correct
81 Correct 3320 ms 23952 KB Output is correct
82 Correct 2561 ms 26976 KB Output is correct
83 Correct 3878 ms 23236 KB Output is correct
84 Correct 2768 ms 27136 KB Output is correct
85 Correct 3987 ms 25504 KB Output is correct
86 Correct 2678 ms 25212 KB Output is correct
87 Correct 3776 ms 23760 KB Output is correct
88 Correct 775 ms 10628 KB Output is correct
89 Correct 930 ms 10600 KB Output is correct
90 Correct 1744 ms 16136 KB Output is correct
91 Correct 739 ms 10848 KB Output is correct
92 Correct 830 ms 10732 KB Output is correct
93 Correct 1935 ms 16448 KB Output is correct
94 Correct 2708 ms 23548 KB Output is correct
95 Correct 2176 ms 16308 KB Output is correct
96 Correct 2261 ms 19788 KB Output is correct
97 Correct 1696 ms 16524 KB Output is correct
98 Correct 2510 ms 23668 KB Output is correct
99 Correct 1695 ms 11872 KB Output is correct
100 Correct 1272 ms 11440 KB Output is correct
101 Correct 1002 ms 11968 KB Output is correct
102 Correct 656 ms 12156 KB Output is correct
103 Correct 3993 ms 22544 KB Output is correct
104 Correct 2225 ms 23912 KB Output is correct
105 Correct 2185 ms 26240 KB Output is correct
106 Correct 1978 ms 25368 KB Output is correct
107 Execution timed out 4022 ms 23168 KB Time limit exceeded
108 Halted 0 ms 0 KB -