답안 #603220

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
603220 2022-07-23T17:14:43 Z cadmiumsky Diversity (CEOI21_diversity) C++14
64 / 100
430 ms 32324 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
const int nmax = 3e5 + 5;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rng(2);

int n, q;

int absol(int x) { return  (x >= 0? x : -x);}


namespace Treap {
  struct Node {
    Node *l, *r;
    int area, pri;
    int ind() { return l -> area + 1; } 
    int val, sum;
    bool lazy; 
    ll intl, intr; // left : e mai mic in left
  }*nil = new Node{0, 0, 0, -1, 0, 0, 0, 0, 0};
  using ns = Node*;
  struct pns { ns l, r; };
  
  void prop(ns& node) {
    if(node == nil)
      return;
    if(node -> lazy == 1) {
      swap(node -> l, node -> r);
      swap(node -> intl, node -> intr);
      node -> l -> lazy ^= 1;
      node -> r -> lazy ^= 1;
      node -> lazy = 0;
    }
    return;
  } 
  ns updnode(ns node, ns x, int w) {
    if(node == nil)
      return nil;
    (w == 1? node -> r : node -> l) = x;
    prop(node);
    prop(node -> l);
    prop(node -> r);
    node -> area = 1 + node -> l -> area + node -> r -> area;
    node -> sum = node -> val + node -> l -> sum + node -> r -> sum; 
    node -> intl = node -> l -> intl + (ll)(node -> r -> sum + node -> val) * (node -> ind()) + node -> r -> intl;
    node -> intr = node -> r -> intr + (ll)(node -> l -> sum + node -> val) * (node -> r -> area + 1) + node -> l -> intr;
    return node;
  }
  pns split(ns node, int val) {
    prop(node);
    pns temp;
    return node == nil? pns{nil, nil}:
            node -> area <= val? pns{node, nil}:
              val == 0?  pns{nil, node}:
                node -> ind() <= val? (temp = split(node -> r, val - node ->ind()), temp.l = updnode(node, temp.l, 1), temp):
                  (temp = split(node -> l, val), temp.r = updnode(node, temp.r, 0), temp);
  }
  ns merge(ns l, ns r) {
    prop(l);
    prop(r);
    return l == nil? r:
            r == nil? l:
              l -> pri < r -> pri? updnode(r, merge(l, r -> l), 0): 
                updnode(l, merge(l -> r, r), 1); 
  }
  void print(ns node) {
    //if(node == nil)
      //return;
    //print(node -> l);
    //cerr << node -> val << ' ';
    //print(node -> r);
    //return;
  } 
  ns parity[2] = {nil, nil};
  void flip(ns& root) {
    root -> lazy ^= 1;
    prop(root);
  }
  void append(ns& root) { root = merge(new Node{nil, nil, 1, rng(), 0, 0, 0, 0, 0}, root);
     //cerr << "--\n"; print(root); cerr << "\n--\n";
     }
  void pop(ns& root) { pns temp = split(root, 1); root = temp.r; }
  
  ll modify(ns& root, int poz, int with) {
    int how = (root == parity[0]? 1 : 0);
    poz++;
    poz = (root == parity[0]? poz : root -> area - poz + 1);
    //cerr << "long " << poz << ' ' << root -> area<<  ' ' ;
    //cerr << "So here we have had " << root -> sum << ' ' << root -> area << '\n';
    pns temp[2];
    temp[0] = split(root, poz - 1);
    temp[1] = split(temp[0].r, 1);
    //auto incaunu = split(temp[1].r, 1);
    //temp[1].r = merge(incaunu.l, incaunu.r);
    
    temp[1].l -> val += with;
    temp[1].l -> sum += with;
    temp[1].l -> intl += with;
    temp[1].l -> intr += with;
    //cerr << temp[1].l -> val << ' ' << temp[1].l -> intl << ' ' <<temp[1].l -> sum << ' ' <<temp[1].l -> area << ' ' << '\n';
    
    ll modifier = temp[1].r -> intl + temp[0].l -> intr;
    //cerr << "> " << modifier << ' ' << temp[1].r -> val << ' ' << temp[1].r -> intl << ' ' << temp[1].r->intr << ' ' << temp[1].r -> sum << ' ' << temp[1].r -> area << '\n';
    //if(temp[1].r != nil)
      //cerr << temp[1].r -> l -> val << ' ' << ' ' << temp[1].r -> val << ' ' << temp[1].r -> r -> val << '\n';
    //cerr << temp[0].l -> area << '\n';
    //cerr << "to be further told " << temp[0].l -> sum << ' ' << temp[1].l -> sum << ' ' << temp[1].r -> sum << '\n';
    root = merge(temp[0].l, merge(temp[1].l, temp[1].r));
    //cerr << "So here we have " << root -> sum << ' ' << root -> area << '\n';
    poz = (how == 1? root -> area - poz : poz - 1);
    if(how == 1) modifier += parity[how] -> intl;
    else modifier += parity[how] -> intr;
    //cerr << "> " << modifier << '\n';
    modifier += (ll)parity[how] -> sum * poz;
    //cerr << how << ' ' << parity[how] -> sum<< '/' << parity[how] -> area << ' ' << root -> area << ' ' << poz << '\n';
    //cerr << modifier << "< \n";;
    modifier *= with;
    return modifier;
  }
}
using namespace Treap;
int buck;
int v[nmax];
struct Query { 
  int l, r, ind;
  bool operator <(const Query& other) const {
    return (l / buck < other.l / buck || (l / buck == other.l / buck && r < other.r));
  }
};

namespace Mo {
  deque<int> sorted;
  deque<int> vals;
  int freq[nmax];
  int atrindex[nmax];
  ll total, comb, sum, sqsum;
  void add(int x) {
    x = v[x];
    //cerr <<x << '\n';
    
    int it;
    if(freq[x] == 0) {
      flip(parity[0]);
      flip(parity[1]);
      swap(parity[0], parity[1]);
      append(parity[0]);
      it = 0;
      atrindex[x] = sorted.size();
      sorted.push_front(0);
      vals.push_front(x);
    }
    else {
      it = prev(upper_bound(sorted.begin(), sorted.end(), sorted.rbegin()[atrindex[x]])) - sorted.begin();
      int otr = vals[it];
      swap(atrindex[x], atrindex[otr]);
      swap(vals.rbegin()[atrindex[x]], vals.rbegin()[atrindex[otr]]);
    }
    auto temp = modify(parity[it % 2], it / 2, 1);
    //cout << x << ' ' << temp << '\n';
    total += temp;
    
    sorted[it]++;
    
    sqsum += freq[x] * 2 + 1;
    sum++;
    freq[x]++;
    comb += freq[x];
    
    //for(auto a : vals)
      //cerr << a << ' ';
    //cerr << '\n';
    //for(auto a : sorted)
      //cerr << a << ' ';
    //cerr << '\n';
    //cerr << '\n';
    
    //cerr << parity[0] -> area << ' ' << parity[1] -> area << '\n';
  }
  void erase(int x) {
    x = v[x];
    
    int it;
    it = lower_bound(sorted.begin(), sorted.end(), sorted.rbegin()[atrindex[x]]) - sorted.begin();
    int otr = vals[it];
    swap(atrindex[x], atrindex[otr]);
    swap(vals.rbegin()[atrindex[x]], vals.rbegin()[atrindex[otr]]);
    
    total += modify(parity[it % 2], it / 2, -1);
    sorted[it]--;
    
    
    comb -= freq[x];
    freq[x]--;
    sum--;
    sqsum -= freq[x] * 2 + 1;
    if(freq[x] == 0) {
      pop(parity[0]);
      flip(parity[0]);
      flip(parity[1]);
      swap(parity[0], parity[1]);
      sorted.pop_back();
      vals.pop_back();
      atrindex[x] = 0;
    }
    return;
  }
  ll query() {
    cerr << total << ' ' << comb << ' ' << sum << ' ' << sqsum << '\n';
    return total + comb + (sum * sum - sqsum) / 2;
  }
}

signed main() {
  cin >> n >> q;
  buck = max(1.0, sqrt((ll) n * n / q));
  for(int i = 1; i <= n; i++)
    cin >> v[i];
  vector<int> rez(q);
  vector<Query> qs(q);
  int cnt = 0;
  for(auto &[l, r, ind] : qs) {
    cin >> l >> r;        
    ind = cnt++;
  }
  
  sort(qs.begin(), qs.end());
  int lastl = 1, lastr = 0;
  for(auto [l, r, ind] : qs) {
    //cerr << l << ' ' << r << ' ' << ind << '\n';0
    while(lastr < r)
      Mo::add(++lastr);
    while(lastl > l)
      Mo::add(--lastl);
    while(lastl < l)
      Mo::erase(lastl++);
    while(lastr > r)
      Mo::erase(lastr--);
    cerr << lastr << ' ' << lastl << '\n';
    //for(auto x : Mo::sorted)
      //cerr << x << ' ';
    //cerr << '\n';
    //for(auto x : Mo::vals)
      //cerr << x << ' ';
    //cerr << '\n';
    rez[ind] = Mo::query();
  }
  //cerr << "unamog\n";
  for(auto x : rez)
    cout << x << '\n';
}

Compilation message

diversity.cpp: In function 'void Treap::append(Treap::Node*&)':
diversity.cpp:82:65: warning: narrowing conversion of 'rng.std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::operator()()' from 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::result_type' {aka 'long unsigned int'} to 'll' {aka 'long long int'} [-Wnarrowing]
   82 |   void append(ns& root) { root = merge(new Node{nil, nil, 1, rng(), 0, 0, 0, 0, 0}, root);
      |                                                              ~~~^~
diversity.cpp: In function 'int main()':
diversity.cpp:224:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  224 |   for(auto &[l, r, ind] : qs) {
      |             ^
diversity.cpp:231:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
  231 |   for(auto [l, r, ind] : qs) {
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 26 ms 1088 KB Output is correct
5 Correct 52 ms 2264 KB Output is correct
6 Correct 79 ms 3328 KB Output is correct
7 Correct 75 ms 3224 KB Output is correct
8 Correct 78 ms 3216 KB Output is correct
9 Correct 81 ms 3248 KB Output is correct
10 Correct 77 ms 3224 KB Output is correct
11 Correct 78 ms 3260 KB Output is correct
12 Correct 78 ms 3308 KB Output is correct
13 Correct 82 ms 3296 KB Output is correct
14 Correct 78 ms 3376 KB Output is correct
15 Correct 77 ms 3264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 26 ms 1088 KB Output is correct
5 Correct 52 ms 2264 KB Output is correct
6 Correct 79 ms 3328 KB Output is correct
7 Correct 75 ms 3224 KB Output is correct
8 Correct 78 ms 3216 KB Output is correct
9 Correct 81 ms 3248 KB Output is correct
10 Correct 77 ms 3224 KB Output is correct
11 Correct 78 ms 3260 KB Output is correct
12 Correct 78 ms 3308 KB Output is correct
13 Correct 82 ms 3296 KB Output is correct
14 Correct 78 ms 3376 KB Output is correct
15 Correct 77 ms 3264 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 33 ms 1360 KB Output is correct
20 Correct 68 ms 2508 KB Output is correct
21 Correct 107 ms 3420 KB Output is correct
22 Correct 109 ms 3436 KB Output is correct
23 Correct 106 ms 3428 KB Output is correct
24 Correct 105 ms 3320 KB Output is correct
25 Correct 107 ms 3436 KB Output is correct
26 Correct 107 ms 3408 KB Output is correct
27 Correct 104 ms 3660 KB Output is correct
28 Correct 100 ms 3380 KB Output is correct
29 Correct 103 ms 3396 KB Output is correct
30 Correct 114 ms 3456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 26 ms 1088 KB Output is correct
5 Correct 52 ms 2264 KB Output is correct
6 Correct 79 ms 3328 KB Output is correct
7 Correct 75 ms 3224 KB Output is correct
8 Correct 78 ms 3216 KB Output is correct
9 Correct 81 ms 3248 KB Output is correct
10 Correct 77 ms 3224 KB Output is correct
11 Correct 78 ms 3260 KB Output is correct
12 Correct 78 ms 3308 KB Output is correct
13 Correct 82 ms 3296 KB Output is correct
14 Correct 78 ms 3376 KB Output is correct
15 Correct 77 ms 3264 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 33 ms 1360 KB Output is correct
20 Correct 68 ms 2508 KB Output is correct
21 Correct 107 ms 3420 KB Output is correct
22 Correct 109 ms 3436 KB Output is correct
23 Correct 106 ms 3428 KB Output is correct
24 Correct 105 ms 3320 KB Output is correct
25 Correct 107 ms 3436 KB Output is correct
26 Correct 107 ms 3408 KB Output is correct
27 Correct 104 ms 3660 KB Output is correct
28 Correct 100 ms 3380 KB Output is correct
29 Correct 103 ms 3396 KB Output is correct
30 Correct 114 ms 3456 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 6 ms 468 KB Output is correct
35 Correct 7 ms 468 KB Output is correct
36 Correct 11 ms 468 KB Output is correct
37 Correct 36 ms 872 KB Output is correct
38 Correct 45 ms 980 KB Output is correct
39 Correct 88 ms 1580 KB Output is correct
40 Correct 173 ms 2648 KB Output is correct
41 Correct 261 ms 3992 KB Output is correct
42 Correct 257 ms 3908 KB Output is correct
43 Correct 253 ms 3844 KB Output is correct
44 Correct 269 ms 4004 KB Output is correct
45 Correct 257 ms 3900 KB Output is correct
46 Correct 267 ms 3928 KB Output is correct
47 Correct 257 ms 3788 KB Output is correct
48 Correct 263 ms 3880 KB Output is correct
49 Correct 261 ms 3900 KB Output is correct
50 Correct 263 ms 3992 KB Output is correct
51 Correct 252 ms 3904 KB Output is correct
52 Correct 256 ms 3884 KB Output is correct
53 Correct 256 ms 3988 KB Output is correct
54 Correct 266 ms 3904 KB Output is correct
55 Correct 256 ms 3796 KB Output is correct
56 Correct 265 ms 3964 KB Output is correct
57 Correct 258 ms 3924 KB Output is correct
58 Correct 286 ms 3916 KB Output is correct
59 Correct 261 ms 3796 KB Output is correct
60 Correct 262 ms 3896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 26 ms 1088 KB Output is correct
15 Correct 52 ms 2264 KB Output is correct
16 Correct 79 ms 3328 KB Output is correct
17 Correct 75 ms 3224 KB Output is correct
18 Correct 78 ms 3216 KB Output is correct
19 Correct 81 ms 3248 KB Output is correct
20 Correct 77 ms 3224 KB Output is correct
21 Correct 78 ms 3260 KB Output is correct
22 Correct 78 ms 3308 KB Output is correct
23 Correct 82 ms 3296 KB Output is correct
24 Correct 78 ms 3376 KB Output is correct
25 Correct 77 ms 3264 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 324 KB Output is correct
28 Correct 4 ms 436 KB Output is correct
29 Correct 33 ms 1360 KB Output is correct
30 Correct 68 ms 2508 KB Output is correct
31 Correct 107 ms 3420 KB Output is correct
32 Correct 109 ms 3436 KB Output is correct
33 Correct 106 ms 3428 KB Output is correct
34 Correct 105 ms 3320 KB Output is correct
35 Correct 107 ms 3436 KB Output is correct
36 Correct 107 ms 3408 KB Output is correct
37 Correct 104 ms 3660 KB Output is correct
38 Correct 100 ms 3380 KB Output is correct
39 Correct 103 ms 3396 KB Output is correct
40 Correct 114 ms 3456 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 6 ms 468 KB Output is correct
45 Correct 7 ms 468 KB Output is correct
46 Correct 11 ms 468 KB Output is correct
47 Correct 36 ms 872 KB Output is correct
48 Correct 45 ms 980 KB Output is correct
49 Correct 88 ms 1580 KB Output is correct
50 Correct 173 ms 2648 KB Output is correct
51 Correct 261 ms 3992 KB Output is correct
52 Correct 257 ms 3908 KB Output is correct
53 Correct 253 ms 3844 KB Output is correct
54 Correct 269 ms 4004 KB Output is correct
55 Correct 257 ms 3900 KB Output is correct
56 Correct 267 ms 3928 KB Output is correct
57 Correct 257 ms 3788 KB Output is correct
58 Correct 263 ms 3880 KB Output is correct
59 Correct 261 ms 3900 KB Output is correct
60 Correct 263 ms 3992 KB Output is correct
61 Correct 252 ms 3904 KB Output is correct
62 Correct 256 ms 3884 KB Output is correct
63 Correct 256 ms 3988 KB Output is correct
64 Correct 266 ms 3904 KB Output is correct
65 Correct 256 ms 3796 KB Output is correct
66 Correct 265 ms 3964 KB Output is correct
67 Correct 258 ms 3924 KB Output is correct
68 Correct 286 ms 3916 KB Output is correct
69 Correct 261 ms 3796 KB Output is correct
70 Correct 262 ms 3896 KB Output is correct
71 Correct 52 ms 1136 KB Output is correct
72 Correct 49 ms 1108 KB Output is correct
73 Correct 49 ms 1136 KB Output is correct
74 Correct 48 ms 1100 KB Output is correct
75 Correct 48 ms 1104 KB Output is correct
76 Correct 110 ms 2116 KB Output is correct
77 Correct 111 ms 2124 KB Output is correct
78 Correct 110 ms 2068 KB Output is correct
79 Correct 117 ms 2036 KB Output is correct
80 Correct 110 ms 2120 KB Output is correct
81 Correct 238 ms 3932 KB Output is correct
82 Correct 242 ms 3916 KB Output is correct
83 Correct 240 ms 3916 KB Output is correct
84 Correct 240 ms 4020 KB Output is correct
85 Correct 239 ms 3936 KB Output is correct
86 Correct 278 ms 5048 KB Output is correct
87 Correct 267 ms 5160 KB Output is correct
88 Correct 270 ms 5108 KB Output is correct
89 Correct 264 ms 5120 KB Output is correct
90 Correct 265 ms 5064 KB Output is correct
91 Correct 429 ms 15452 KB Output is correct
92 Correct 418 ms 15308 KB Output is correct
93 Correct 421 ms 15348 KB Output is correct
94 Correct 424 ms 15420 KB Output is correct
95 Correct 425 ms 15404 KB Output is correct
96 Correct 398 ms 26680 KB Output is correct
97 Correct 363 ms 26572 KB Output is correct
98 Correct 360 ms 26556 KB Output is correct
99 Correct 359 ms 26616 KB Output is correct
100 Correct 361 ms 26624 KB Output is correct
101 Correct 360 ms 26504 KB Output is correct
102 Correct 420 ms 26564 KB Output is correct
103 Correct 430 ms 26624 KB Output is correct
104 Correct 375 ms 26520 KB Output is correct
105 Correct 364 ms 26544 KB Output is correct
106 Correct 379 ms 32092 KB Output is correct
107 Correct 320 ms 32100 KB Output is correct
108 Correct 352 ms 32324 KB Output is correct
109 Correct 345 ms 32092 KB Output is correct
110 Correct 374 ms 32112 KB Output is correct
111 Correct 383 ms 32060 KB Output is correct
112 Correct 381 ms 32164 KB Output is correct
113 Correct 414 ms 32048 KB Output is correct
114 Correct 329 ms 32056 KB Output is correct
115 Correct 321 ms 32096 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 3 ms 340 KB Output is correct
14 Correct 26 ms 1088 KB Output is correct
15 Correct 52 ms 2264 KB Output is correct
16 Correct 79 ms 3328 KB Output is correct
17 Correct 75 ms 3224 KB Output is correct
18 Correct 78 ms 3216 KB Output is correct
19 Correct 81 ms 3248 KB Output is correct
20 Correct 77 ms 3224 KB Output is correct
21 Correct 78 ms 3260 KB Output is correct
22 Correct 78 ms 3308 KB Output is correct
23 Correct 82 ms 3296 KB Output is correct
24 Correct 78 ms 3376 KB Output is correct
25 Correct 77 ms 3264 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 324 KB Output is correct
28 Correct 4 ms 436 KB Output is correct
29 Correct 33 ms 1360 KB Output is correct
30 Correct 68 ms 2508 KB Output is correct
31 Correct 107 ms 3420 KB Output is correct
32 Correct 109 ms 3436 KB Output is correct
33 Correct 106 ms 3428 KB Output is correct
34 Correct 105 ms 3320 KB Output is correct
35 Correct 107 ms 3436 KB Output is correct
36 Correct 107 ms 3408 KB Output is correct
37 Correct 104 ms 3660 KB Output is correct
38 Correct 100 ms 3380 KB Output is correct
39 Correct 103 ms 3396 KB Output is correct
40 Correct 114 ms 3456 KB Output is correct
41 Correct 1 ms 340 KB Output is correct
42 Correct 1 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 6 ms 468 KB Output is correct
45 Correct 7 ms 468 KB Output is correct
46 Correct 11 ms 468 KB Output is correct
47 Correct 36 ms 872 KB Output is correct
48 Correct 45 ms 980 KB Output is correct
49 Correct 88 ms 1580 KB Output is correct
50 Correct 173 ms 2648 KB Output is correct
51 Correct 261 ms 3992 KB Output is correct
52 Correct 257 ms 3908 KB Output is correct
53 Correct 253 ms 3844 KB Output is correct
54 Correct 269 ms 4004 KB Output is correct
55 Correct 257 ms 3900 KB Output is correct
56 Correct 267 ms 3928 KB Output is correct
57 Correct 257 ms 3788 KB Output is correct
58 Correct 263 ms 3880 KB Output is correct
59 Correct 261 ms 3900 KB Output is correct
60 Correct 263 ms 3992 KB Output is correct
61 Correct 252 ms 3904 KB Output is correct
62 Correct 256 ms 3884 KB Output is correct
63 Correct 256 ms 3988 KB Output is correct
64 Correct 266 ms 3904 KB Output is correct
65 Correct 256 ms 3796 KB Output is correct
66 Correct 265 ms 3964 KB Output is correct
67 Correct 258 ms 3924 KB Output is correct
68 Correct 286 ms 3916 KB Output is correct
69 Correct 261 ms 3796 KB Output is correct
70 Correct 262 ms 3896 KB Output is correct
71 Correct 52 ms 1136 KB Output is correct
72 Correct 49 ms 1108 KB Output is correct
73 Correct 49 ms 1136 KB Output is correct
74 Correct 48 ms 1100 KB Output is correct
75 Correct 48 ms 1104 KB Output is correct
76 Correct 110 ms 2116 KB Output is correct
77 Correct 111 ms 2124 KB Output is correct
78 Correct 110 ms 2068 KB Output is correct
79 Correct 117 ms 2036 KB Output is correct
80 Correct 110 ms 2120 KB Output is correct
81 Correct 238 ms 3932 KB Output is correct
82 Correct 242 ms 3916 KB Output is correct
83 Correct 240 ms 3916 KB Output is correct
84 Correct 240 ms 4020 KB Output is correct
85 Correct 239 ms 3936 KB Output is correct
86 Correct 278 ms 5048 KB Output is correct
87 Correct 267 ms 5160 KB Output is correct
88 Correct 270 ms 5108 KB Output is correct
89 Correct 264 ms 5120 KB Output is correct
90 Correct 265 ms 5064 KB Output is correct
91 Correct 429 ms 15452 KB Output is correct
92 Correct 418 ms 15308 KB Output is correct
93 Correct 421 ms 15348 KB Output is correct
94 Correct 424 ms 15420 KB Output is correct
95 Correct 425 ms 15404 KB Output is correct
96 Correct 398 ms 26680 KB Output is correct
97 Correct 363 ms 26572 KB Output is correct
98 Correct 360 ms 26556 KB Output is correct
99 Correct 359 ms 26616 KB Output is correct
100 Correct 361 ms 26624 KB Output is correct
101 Correct 360 ms 26504 KB Output is correct
102 Correct 420 ms 26564 KB Output is correct
103 Correct 430 ms 26624 KB Output is correct
104 Correct 375 ms 26520 KB Output is correct
105 Correct 364 ms 26544 KB Output is correct
106 Correct 379 ms 32092 KB Output is correct
107 Correct 320 ms 32100 KB Output is correct
108 Correct 352 ms 32324 KB Output is correct
109 Correct 345 ms 32092 KB Output is correct
110 Correct 374 ms 32112 KB Output is correct
111 Correct 383 ms 32060 KB Output is correct
112 Correct 381 ms 32164 KB Output is correct
113 Correct 414 ms 32048 KB Output is correct
114 Correct 329 ms 32056 KB Output is correct
115 Correct 321 ms 32096 KB Output is correct
116 Runtime error 35 ms 4248 KB Execution killed with signal 11
117 Halted 0 ms 0 KB -