Submission #593234

# Submission time Handle Problem Language Result Execution time Memory
593234 2022-07-10T15:49:01 Z SeDunion Diversity (CEOI21_diversity) C++17
100 / 100
4008 ms 8148 KB
#include <iostream>
#include <cassert>
#include <iomanip>
#include <algorithm>
#include <string>
#include <bitset> 
#include <vector>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#ifndef LOCAL
	#include <bits/stdc++.h>
	#define cerr if(false)cerr
#endif
 
using namespace std;
using ll = long long;
 
const int N = 3e5 + 66;
 
ll a[N], n;
 
ll pref[N];

/*
summa(a[i]*(a[i]+1)/2 + a[i]*pref[i-1]*(i+1) - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i-1]*i+a[i]*pref[i-1] - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i-1] - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*(pref[n-1]-pref[i])*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i-a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa((a[i]^2+a[i])/2 + a[i]*pref[i]*i - a[i]^2*i + a[i]*pref[i]-a[i]^2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa(a[i]/2 + a[i]*pref[i]*(i+1) - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i - a[i]*pref[i]*i)
summa(a[i]/2 + a[i]*pref[i] - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i)
summa(a[i]/2 + a[i]*pref[i] - a[i]^2*i - a[i]^2/2 - a[i]*pref[n-1]*i)
 */

ll f(ll s) { return s * (s + 1) / 2; }

//summa(f(pref[i - 1]) + f(pref[n - 1] - pref[i]))

ll solve() {
	ll ans = 0;
	for (int i = 0 ; i < n ; ++ i) {
		pref[i] = a[i];
		if (i) pref[i] += pref[i - 1];
	}
	for (int i = 0 ; i < n ; ++ i) {
		if (i) ans += f(pref[i - 1]);
		ans += f(pref[n - 1] - pref[i]);
	}
	ll C = n * f(pref[n-1]);
	// C = len * f(sum)
	return C-ans;
}

vector<int>vec;
int used[N];
int comp[N], freq[N];

void del(int v) {
	v = a[v];
	cerr << "del " << v << endl;
	comp[freq[v]]--;
	freq[v]--;
	if (freq[v] > 0 && !comp[freq[v]] && !used[freq[v]]) {
		used[freq[v]] = 1;
		vec.emplace_back(freq[v]);
	}
	comp[freq[v]]++;
}
void add(int v) {
	v = a[v];
	cerr << "add " << v << endl;
	comp[freq[v]]--;
	freq[v]++;
	if (freq[v] > 0 && !comp[freq[v]] && !used[freq[v]]) {
		used[freq[v]] = 1;
		vec.emplace_back(freq[v]);
	}
	comp[freq[v]]++;
}

using pll = pair<ll,ll>;
deque<pll>d;
int L, R;
ll sq(ll x) { return x*x; }
ll t(ll x) { return x*(x+1)*(2*x+1)/6; }
ll get() {
	for (int i = 0 ; i < (int)vec.size() ; ++ i) {
		if (!comp[vec[i]]) {
			used[vec[i]] = 0;
			swap(vec[i], vec.back());
			vec.pop_back();
			--i;
		}
	}
	sort(vec.rbegin(), vec.rend());
	ll q = 0;
	d.clear();
	int par = 0;
	int M = 0;
	for (int i : vec) { 
		M += comp[i];
		int lc, rc;
		if (par) lc = comp[i] / 2, rc = comp[i] - comp[i] / 2;
		else rc = comp[i] / 2, lc = comp[i] - comp[i] / 2;
		if (lc) d.push_front({i, lc});
		if (rc) d.push_back({i, rc});
		par ^= (comp[i] & 1);
	}
	int m = d.size(); ll pref = 0;
	cerr << "m ";
	for (int i = 0 ; i < m ; ++ i) cerr << "{" << d[i].first << ", " << d[i].second << "} ";
	cerr << endl;
	for (int i = 0 ; i < m ; ++ i) {
		q += d[i].second * sq(pref);
		q += 2 * pref * d[i].first * f(d[i].second - 1);
		q += sq(d[i].first) * t(d[i].second - 1); 
		pref += d[i].first * d[i].second;
		ll w = R-L+1-pref;
		q += d[i].second * sq(w);
		q += 2 * w * d[i].first * f(d[i].second - 1);
		q += sq(d[i].first) * t(d[i].second - 1); 
	}
	q = (ll)M * f(R-L+1) - ((ll)M * (R-L+1) - (R-L+1) + q) / 2;
	cerr << "get " << q << endl;
	return q;
}

ll ans[N];

int ql[N], qr[N];

vector<tuple<int,int,int>>MO;

const int K = 400;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int q;
	cin >> n >> q;
	for (int i = 0 ; i < n ; ++ i) cin >> a[i];
	for (int i = 0 ; i < q ; ++ i) {
		cin >> ql[i] >> qr[i];
		ql[i]--, qr[i]--;
		MO.emplace_back(ql[i]/K, qr[i], i);
	}
	sort(MO.begin(), MO.end());
	L = 1, R = 0;
	for (int $ = 0 ; $ < q ; ++ $) {
		int i = get<2>(MO[$]);
		int l = ql[i], r = qr[i];
		while (L > l) add(--L);
		while (R < r) add(++R);
		while (L < l) del(L++);
		while (R > r) del(R--);
		ans[i] = get();
	}
	for (int i = 0 ; i < q ; ++ i) {
		cout << ans[i] << "\n";
	}
	return 0;
	map<int,int>mp;
	for (int i = 0 ; i < n ; ++ i) mp[a[i]]++;
	vector<int>freq;
	for (auto [f, s] : mp) freq.emplace_back(s);
	sort(freq.rbegin(), freq.rend());
	deque<int>p;
	for (int i : freq) {
		if ((int)p.size() & 1) p.push_back(i);
		else p.push_front(i);
	}
	n = p.size();
	for (int i = 0 ; i < n ; ++ i) a[i] = p[i];
	cout << solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 6 ms 1776 KB Output is correct
5 Correct 13 ms 3432 KB Output is correct
6 Correct 21 ms 4184 KB Output is correct
7 Correct 22 ms 5460 KB Output is correct
8 Correct 19 ms 4084 KB Output is correct
9 Correct 20 ms 4096 KB Output is correct
10 Correct 22 ms 4608 KB Output is correct
11 Correct 20 ms 4436 KB Output is correct
12 Correct 21 ms 4084 KB Output is correct
13 Correct 19 ms 4056 KB Output is correct
14 Correct 19 ms 4428 KB Output is correct
15 Correct 20 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 6 ms 1776 KB Output is correct
5 Correct 13 ms 3432 KB Output is correct
6 Correct 21 ms 4184 KB Output is correct
7 Correct 22 ms 5460 KB Output is correct
8 Correct 19 ms 4084 KB Output is correct
9 Correct 20 ms 4096 KB Output is correct
10 Correct 22 ms 4608 KB Output is correct
11 Correct 20 ms 4436 KB Output is correct
12 Correct 21 ms 4084 KB Output is correct
13 Correct 19 ms 4056 KB Output is correct
14 Correct 19 ms 4428 KB Output is correct
15 Correct 20 ms 4440 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 8 ms 1772 KB Output is correct
20 Correct 14 ms 2924 KB Output is correct
21 Correct 21 ms 4292 KB Output is correct
22 Correct 22 ms 4048 KB Output is correct
23 Correct 20 ms 4228 KB Output is correct
24 Correct 21 ms 4064 KB Output is correct
25 Correct 20 ms 4024 KB Output is correct
26 Correct 21 ms 4112 KB Output is correct
27 Correct 20 ms 4060 KB Output is correct
28 Correct 21 ms 4560 KB Output is correct
29 Correct 21 ms 4032 KB Output is correct
30 Correct 21 ms 4044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 484 KB Output is correct
4 Correct 6 ms 1776 KB Output is correct
5 Correct 13 ms 3432 KB Output is correct
6 Correct 21 ms 4184 KB Output is correct
7 Correct 22 ms 5460 KB Output is correct
8 Correct 19 ms 4084 KB Output is correct
9 Correct 20 ms 4096 KB Output is correct
10 Correct 22 ms 4608 KB Output is correct
11 Correct 20 ms 4436 KB Output is correct
12 Correct 21 ms 4084 KB Output is correct
13 Correct 19 ms 4056 KB Output is correct
14 Correct 19 ms 4428 KB Output is correct
15 Correct 20 ms 4440 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 8 ms 1772 KB Output is correct
20 Correct 14 ms 2924 KB Output is correct
21 Correct 21 ms 4292 KB Output is correct
22 Correct 22 ms 4048 KB Output is correct
23 Correct 20 ms 4228 KB Output is correct
24 Correct 21 ms 4064 KB Output is correct
25 Correct 20 ms 4024 KB Output is correct
26 Correct 21 ms 4112 KB Output is correct
27 Correct 20 ms 4060 KB Output is correct
28 Correct 21 ms 4560 KB Output is correct
29 Correct 21 ms 4032 KB Output is correct
30 Correct 21 ms 4044 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 1 ms 460 KB Output is correct
35 Correct 1 ms 468 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 4 ms 892 KB Output is correct
38 Correct 4 ms 868 KB Output is correct
39 Correct 7 ms 1516 KB Output is correct
40 Correct 15 ms 2680 KB Output is correct
41 Correct 22 ms 3892 KB Output is correct
42 Correct 22 ms 3900 KB Output is correct
43 Correct 23 ms 3788 KB Output is correct
44 Correct 22 ms 3844 KB Output is correct
45 Correct 22 ms 3816 KB Output is correct
46 Correct 21 ms 3876 KB Output is correct
47 Correct 22 ms 3788 KB Output is correct
48 Correct 23 ms 3788 KB Output is correct
49 Correct 21 ms 3784 KB Output is correct
50 Correct 24 ms 3832 KB Output is correct
51 Correct 23 ms 3884 KB Output is correct
52 Correct 23 ms 3796 KB Output is correct
53 Correct 22 ms 3888 KB Output is correct
54 Correct 25 ms 3840 KB Output is correct
55 Correct 23 ms 3844 KB Output is correct
56 Correct 21 ms 3876 KB Output is correct
57 Correct 22 ms 3804 KB Output is correct
58 Correct 22 ms 3812 KB Output is correct
59 Correct 22 ms 3808 KB Output is correct
60 Correct 23 ms 3788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 484 KB Output is correct
14 Correct 6 ms 1776 KB Output is correct
15 Correct 13 ms 3432 KB Output is correct
16 Correct 21 ms 4184 KB Output is correct
17 Correct 22 ms 5460 KB Output is correct
18 Correct 19 ms 4084 KB Output is correct
19 Correct 20 ms 4096 KB Output is correct
20 Correct 22 ms 4608 KB Output is correct
21 Correct 20 ms 4436 KB Output is correct
22 Correct 21 ms 4084 KB Output is correct
23 Correct 19 ms 4056 KB Output is correct
24 Correct 19 ms 4428 KB Output is correct
25 Correct 20 ms 4440 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 352 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 8 ms 1772 KB Output is correct
30 Correct 14 ms 2924 KB Output is correct
31 Correct 21 ms 4292 KB Output is correct
32 Correct 22 ms 4048 KB Output is correct
33 Correct 20 ms 4228 KB Output is correct
34 Correct 21 ms 4064 KB Output is correct
35 Correct 20 ms 4024 KB Output is correct
36 Correct 21 ms 4112 KB Output is correct
37 Correct 20 ms 4060 KB Output is correct
38 Correct 21 ms 4560 KB Output is correct
39 Correct 21 ms 4032 KB Output is correct
40 Correct 21 ms 4044 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 1 ms 460 KB Output is correct
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 468 KB Output is correct
47 Correct 4 ms 892 KB Output is correct
48 Correct 4 ms 868 KB Output is correct
49 Correct 7 ms 1516 KB Output is correct
50 Correct 15 ms 2680 KB Output is correct
51 Correct 22 ms 3892 KB Output is correct
52 Correct 22 ms 3900 KB Output is correct
53 Correct 23 ms 3788 KB Output is correct
54 Correct 22 ms 3844 KB Output is correct
55 Correct 22 ms 3816 KB Output is correct
56 Correct 21 ms 3876 KB Output is correct
57 Correct 22 ms 3788 KB Output is correct
58 Correct 23 ms 3788 KB Output is correct
59 Correct 21 ms 3784 KB Output is correct
60 Correct 24 ms 3832 KB Output is correct
61 Correct 23 ms 3884 KB Output is correct
62 Correct 23 ms 3796 KB Output is correct
63 Correct 22 ms 3888 KB Output is correct
64 Correct 25 ms 3840 KB Output is correct
65 Correct 23 ms 3844 KB Output is correct
66 Correct 21 ms 3876 KB Output is correct
67 Correct 22 ms 3804 KB Output is correct
68 Correct 22 ms 3812 KB Output is correct
69 Correct 22 ms 3808 KB Output is correct
70 Correct 23 ms 3788 KB Output is correct
71 Correct 4 ms 980 KB Output is correct
72 Correct 5 ms 996 KB Output is correct
73 Correct 7 ms 1000 KB Output is correct
74 Correct 5 ms 980 KB Output is correct
75 Correct 5 ms 952 KB Output is correct
76 Correct 8 ms 1640 KB Output is correct
77 Correct 8 ms 1640 KB Output is correct
78 Correct 8 ms 1636 KB Output is correct
79 Correct 9 ms 1636 KB Output is correct
80 Correct 10 ms 1620 KB Output is correct
81 Correct 17 ms 2808 KB Output is correct
82 Correct 17 ms 2904 KB Output is correct
83 Correct 16 ms 2936 KB Output is correct
84 Correct 16 ms 2932 KB Output is correct
85 Correct 15 ms 2844 KB Output is correct
86 Correct 19 ms 3056 KB Output is correct
87 Correct 18 ms 3028 KB Output is correct
88 Correct 17 ms 2968 KB Output is correct
89 Correct 18 ms 3028 KB Output is correct
90 Correct 18 ms 3028 KB Output is correct
91 Correct 26 ms 4700 KB Output is correct
92 Correct 28 ms 4812 KB Output is correct
93 Correct 26 ms 4764 KB Output is correct
94 Correct 27 ms 4788 KB Output is correct
95 Correct 30 ms 4800 KB Output is correct
96 Correct 30 ms 5340 KB Output is correct
97 Correct 30 ms 5348 KB Output is correct
98 Correct 30 ms 5372 KB Output is correct
99 Correct 30 ms 5332 KB Output is correct
100 Correct 32 ms 5280 KB Output is correct
101 Correct 31 ms 5324 KB Output is correct
102 Correct 31 ms 5256 KB Output is correct
103 Correct 30 ms 5296 KB Output is correct
104 Correct 31 ms 5348 KB Output is correct
105 Correct 31 ms 5344 KB Output is correct
106 Correct 29 ms 5592 KB Output is correct
107 Correct 31 ms 5580 KB Output is correct
108 Correct 34 ms 5608 KB Output is correct
109 Correct 31 ms 5584 KB Output is correct
110 Correct 32 ms 5548 KB Output is correct
111 Correct 31 ms 5500 KB Output is correct
112 Correct 30 ms 5560 KB Output is correct
113 Correct 31 ms 5508 KB Output is correct
114 Correct 30 ms 5580 KB Output is correct
115 Correct 32 ms 5560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 484 KB Output is correct
14 Correct 6 ms 1776 KB Output is correct
15 Correct 13 ms 3432 KB Output is correct
16 Correct 21 ms 4184 KB Output is correct
17 Correct 22 ms 5460 KB Output is correct
18 Correct 19 ms 4084 KB Output is correct
19 Correct 20 ms 4096 KB Output is correct
20 Correct 22 ms 4608 KB Output is correct
21 Correct 20 ms 4436 KB Output is correct
22 Correct 21 ms 4084 KB Output is correct
23 Correct 19 ms 4056 KB Output is correct
24 Correct 19 ms 4428 KB Output is correct
25 Correct 20 ms 4440 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 352 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 8 ms 1772 KB Output is correct
30 Correct 14 ms 2924 KB Output is correct
31 Correct 21 ms 4292 KB Output is correct
32 Correct 22 ms 4048 KB Output is correct
33 Correct 20 ms 4228 KB Output is correct
34 Correct 21 ms 4064 KB Output is correct
35 Correct 20 ms 4024 KB Output is correct
36 Correct 21 ms 4112 KB Output is correct
37 Correct 20 ms 4060 KB Output is correct
38 Correct 21 ms 4560 KB Output is correct
39 Correct 21 ms 4032 KB Output is correct
40 Correct 21 ms 4044 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 1 ms 460 KB Output is correct
45 Correct 1 ms 468 KB Output is correct
46 Correct 1 ms 468 KB Output is correct
47 Correct 4 ms 892 KB Output is correct
48 Correct 4 ms 868 KB Output is correct
49 Correct 7 ms 1516 KB Output is correct
50 Correct 15 ms 2680 KB Output is correct
51 Correct 22 ms 3892 KB Output is correct
52 Correct 22 ms 3900 KB Output is correct
53 Correct 23 ms 3788 KB Output is correct
54 Correct 22 ms 3844 KB Output is correct
55 Correct 22 ms 3816 KB Output is correct
56 Correct 21 ms 3876 KB Output is correct
57 Correct 22 ms 3788 KB Output is correct
58 Correct 23 ms 3788 KB Output is correct
59 Correct 21 ms 3784 KB Output is correct
60 Correct 24 ms 3832 KB Output is correct
61 Correct 23 ms 3884 KB Output is correct
62 Correct 23 ms 3796 KB Output is correct
63 Correct 22 ms 3888 KB Output is correct
64 Correct 25 ms 3840 KB Output is correct
65 Correct 23 ms 3844 KB Output is correct
66 Correct 21 ms 3876 KB Output is correct
67 Correct 22 ms 3804 KB Output is correct
68 Correct 22 ms 3812 KB Output is correct
69 Correct 22 ms 3808 KB Output is correct
70 Correct 23 ms 3788 KB Output is correct
71 Correct 4 ms 980 KB Output is correct
72 Correct 5 ms 996 KB Output is correct
73 Correct 7 ms 1000 KB Output is correct
74 Correct 5 ms 980 KB Output is correct
75 Correct 5 ms 952 KB Output is correct
76 Correct 8 ms 1640 KB Output is correct
77 Correct 8 ms 1640 KB Output is correct
78 Correct 8 ms 1636 KB Output is correct
79 Correct 9 ms 1636 KB Output is correct
80 Correct 10 ms 1620 KB Output is correct
81 Correct 17 ms 2808 KB Output is correct
82 Correct 17 ms 2904 KB Output is correct
83 Correct 16 ms 2936 KB Output is correct
84 Correct 16 ms 2932 KB Output is correct
85 Correct 15 ms 2844 KB Output is correct
86 Correct 19 ms 3056 KB Output is correct
87 Correct 18 ms 3028 KB Output is correct
88 Correct 17 ms 2968 KB Output is correct
89 Correct 18 ms 3028 KB Output is correct
90 Correct 18 ms 3028 KB Output is correct
91 Correct 26 ms 4700 KB Output is correct
92 Correct 28 ms 4812 KB Output is correct
93 Correct 26 ms 4764 KB Output is correct
94 Correct 27 ms 4788 KB Output is correct
95 Correct 30 ms 4800 KB Output is correct
96 Correct 30 ms 5340 KB Output is correct
97 Correct 30 ms 5348 KB Output is correct
98 Correct 30 ms 5372 KB Output is correct
99 Correct 30 ms 5332 KB Output is correct
100 Correct 32 ms 5280 KB Output is correct
101 Correct 31 ms 5324 KB Output is correct
102 Correct 31 ms 5256 KB Output is correct
103 Correct 30 ms 5296 KB Output is correct
104 Correct 31 ms 5348 KB Output is correct
105 Correct 31 ms 5344 KB Output is correct
106 Correct 29 ms 5592 KB Output is correct
107 Correct 31 ms 5580 KB Output is correct
108 Correct 34 ms 5608 KB Output is correct
109 Correct 31 ms 5584 KB Output is correct
110 Correct 32 ms 5548 KB Output is correct
111 Correct 31 ms 5500 KB Output is correct
112 Correct 30 ms 5560 KB Output is correct
113 Correct 31 ms 5508 KB Output is correct
114 Correct 30 ms 5580 KB Output is correct
115 Correct 32 ms 5560 KB Output is correct
116 Correct 233 ms 2860 KB Output is correct
117 Correct 247 ms 2852 KB Output is correct
118 Correct 419 ms 3504 KB Output is correct
119 Correct 422 ms 3524 KB Output is correct
120 Correct 307 ms 3544 KB Output is correct
121 Correct 654 ms 4148 KB Output is correct
122 Correct 501 ms 4208 KB Output is correct
123 Correct 1705 ms 5492 KB Output is correct
124 Correct 1136 ms 5672 KB Output is correct
125 Correct 1168 ms 5708 KB Output is correct
126 Correct 3493 ms 6524 KB Output is correct
127 Correct 3471 ms 6496 KB Output is correct
128 Correct 3525 ms 6536 KB Output is correct
129 Correct 3450 ms 6484 KB Output is correct
130 Correct 3405 ms 6600 KB Output is correct
131 Correct 3515 ms 6644 KB Output is correct
132 Correct 3567 ms 6652 KB Output is correct
133 Correct 3548 ms 6636 KB Output is correct
134 Correct 3663 ms 6644 KB Output is correct
135 Correct 3587 ms 6656 KB Output is correct
136 Correct 3604 ms 6664 KB Output is correct
137 Correct 3618 ms 6664 KB Output is correct
138 Correct 3593 ms 6668 KB Output is correct
139 Correct 3589 ms 6644 KB Output is correct
140 Correct 3689 ms 6664 KB Output is correct
141 Correct 3251 ms 6668 KB Output is correct
142 Correct 3216 ms 6668 KB Output is correct
143 Correct 3240 ms 6668 KB Output is correct
144 Correct 3220 ms 6672 KB Output is correct
145 Correct 3197 ms 6660 KB Output is correct
146 Correct 2245 ms 6948 KB Output is correct
147 Correct 2289 ms 6928 KB Output is correct
148 Correct 2254 ms 6928 KB Output is correct
149 Correct 2244 ms 6996 KB Output is correct
150 Correct 2248 ms 6932 KB Output is correct
151 Correct 2360 ms 6984 KB Output is correct
152 Correct 2307 ms 6980 KB Output is correct
153 Correct 2401 ms 6976 KB Output is correct
154 Correct 2320 ms 6988 KB Output is correct
155 Correct 2316 ms 6976 KB Output is correct
156 Correct 3890 ms 7736 KB Output is correct
157 Correct 4008 ms 7948 KB Output is correct
158 Correct 3979 ms 7544 KB Output is correct
159 Correct 3901 ms 7628 KB Output is correct
160 Correct 3734 ms 7748 KB Output is correct
161 Correct 3837 ms 8148 KB Output is correct
162 Correct 3717 ms 7820 KB Output is correct
163 Correct 3682 ms 7736 KB Output is correct
164 Correct 3722 ms 7808 KB Output is correct
165 Correct 3669 ms 7724 KB Output is correct
166 Correct 3822 ms 7340 KB Output is correct
167 Correct 3741 ms 7192 KB Output is correct
168 Correct 3739 ms 7124 KB Output is correct
169 Correct 3842 ms 7328 KB Output is correct
170 Correct 3852 ms 7236 KB Output is correct
171 Correct 3784 ms 7204 KB Output is correct
172 Correct 3912 ms 7160 KB Output is correct
173 Correct 3777 ms 7172 KB Output is correct
174 Correct 3829 ms 7180 KB Output is correct
175 Correct 3868 ms 7324 KB Output is correct