/*
* Author: Nonoze
* Created: Saturday 27/07/2024
*/
#include <bits/stdc++.h>
using namespace std;
namespace std {
// https://judge.yosupo.jp/submission/193613
struct IOPre {
static constexpr int TEN = 10, SZ = TEN * TEN * TEN * TEN;
std::array<char, 4 * SZ> num;
constexpr IOPre() : num{} {
for (int i = 0; i < SZ; i++) for (int n = i, j = 3; j >= 0; j--) num[i * 4 + j] = n % TEN + '0', n /= TEN;
}
};
struct IO {
#if !HAVE_DECL_FREAD_UNLOCKED
#define fread_unlocked fread
#endif
#if !HAVE_DECL_FWRITE_UNLOCKED
#define fwrite_unlocked fwrite
#endif
static constexpr int SZ = 1 << 17, LEN = 32, TEN = 10, HUNDRED = TEN * TEN,
THOUSAND = HUNDRED * TEN, TENTHOUSAND = THOUSAND * TEN,
MAGIC_MULTIPLY = 205, MAGIC_SHIFT = 11, MASK = 15,
TWELVE = 12, SIXTEEN = 16;
static constexpr IOPre io_pre = {};
std::array<char, SZ> input_buffer, output_buffer;
int input_ptr_left, input_ptr_right, output_ptr_right;
IO() : input_buffer{}, output_buffer{}, input_ptr_left{}, input_ptr_right{}, output_ptr_right{} {}
IO(const IO&) = delete;
IO(IO&&) = delete;
IO& operator=(const IO&) = delete;
IO& operator=(IO&&) = delete;
~IO() { flush(); }
template<typename T> static constexpr bool is_char_v = std::is_same_v<T, char>;
template<typename T> static constexpr bool is_bool_v = std::is_same_v<T, bool>;
template<typename T> static constexpr bool is_string_v =
std::is_same_v<T, std::string> || std::is_same_v<T, const char*> ||
std::is_same_v<T, char*> || std::is_same_v< std::decay_t<T>, char*>;
template<typename T> static constexpr bool is_default_v =
is_char_v<T> || is_bool_v<T> || is_string_v<T> || std::is_integral_v<T>;
inline void load() {
memmove(std::begin(input_buffer),
std::begin(input_buffer) + input_ptr_left,
input_ptr_right - input_ptr_left);
input_ptr_right =
input_ptr_right - input_ptr_left +
fread_unlocked(
std::begin(input_buffer) + input_ptr_right - input_ptr_left, 1,
SZ - input_ptr_right + input_ptr_left, stdin);
input_ptr_left = 0;
}
inline void read_char(char& c) {
if (input_ptr_left + LEN > input_ptr_right) load();
c = input_buffer[input_ptr_left++];
}
inline void read_string(std::string& x) {
char c;
while (read_char(c), c < '!') continue;
x = c;
while (read_char(c), c >= '!') x += c;
}
template<typename T>
inline std::enable_if_t<std::is_integral_v<T>, void> read_int(T& x) {
if (input_ptr_left + LEN > input_ptr_right) load();
char c = 0;
do c = input_buffer[input_ptr_left++];
while (c < '-');
[[maybe_unused]] bool minus = false;
if constexpr (std::is_signed<T>::value == true)
if (c == '-') minus = true, c = input_buffer[input_ptr_left++];
x = 0;
while (c >= '0')
x = x * TEN + (c & MASK), c = input_buffer[input_ptr_left++];
if constexpr (std::is_signed<T>::value == true)
if (minus) x = -x;
}
inline void skip_space() {
if (input_ptr_left + LEN > input_ptr_right) load();
while (input_buffer[input_ptr_left] <= ' ') input_ptr_left++;
}
inline void flush() {
fwrite_unlocked(std::begin(output_buffer), 1, output_ptr_right, stdout);
output_ptr_right = 0;
}
inline void write_char(char c) {
if (output_ptr_right > SZ - LEN) flush();
output_buffer[output_ptr_right++] = c;
}
inline void write_bool(bool b) {
if (output_ptr_right > SZ - LEN) flush();
output_buffer[output_ptr_right++] = b ? '1' : '0';
}
inline void write_string(const std::string& s) {
for (auto x : s) write_char(x);
}
inline void write_string(const char* s) {
while (*s) write_char(*s++);
}
inline void write_string(char* s) {
while (*s) write_char(*s++);
}
template <typename T>
inline std::enable_if_t< std::is_integral_v<T>, void> write_int(T x) {
if (output_ptr_right > SZ - LEN) flush();
if (!x) {
output_buffer[output_ptr_right++] = '0';
return;
}
if constexpr (std::is_signed_v<T>) if (x < 0) output_buffer[output_ptr_right++] = '-', x = -x;
int i = TWELVE;
std::array<char, SIXTEEN> buf{};
for (; x >= TENTHOUSAND; x /= TENTHOUSAND, i -= 4)
memcpy(std::begin(buf) + i, std::begin(io_pre.num) + (x % TENTHOUSAND) * 4, 4);
if (x < HUNDRED) {
if (x < TEN) output_buffer[output_ptr_right++] = '0' + x;
else {
uint32_t q = (uint32_t(x) * MAGIC_MULTIPLY) >> MAGIC_SHIFT;
uint32_t r = uint32_t(x) - q * TEN;
output_buffer[output_ptr_right++] = '0' + q;
output_buffer[output_ptr_right++] = '0' + r;
}
} else {
if (x < THOUSAND)
memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(io_pre.num) + (x << 2) + 1, 3),
output_ptr_right += 3;
else
memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(io_pre.num) + (x << 2), 4),
output_ptr_right += 4;
}
memcpy(std::begin(output_buffer) + output_ptr_right, std::begin(buf) + i + 4, TWELVE - i);
output_ptr_right += TWELVE - i;
}
template <typename T_>
std::enable_if_t<(is_default_v< std::remove_cv_t< std::remove_reference_t<T_> > >), IO&> operator<<(T_&& x) {
using T = std::remove_cv_t< std::remove_reference_t<T_> >;
if constexpr (is_bool_v<T>) write_bool(x);
else if constexpr (is_string_v<T>) write_string(x);
else if constexpr (is_char_v<T>) write_char(x);
else if constexpr (std::is_integral_v<T>) write_int(x);
return *this;
}
template<typename T>
std::enable_if_t<(is_default_v<T> && !is_bool_v<T>), IO&> operator>>(T& x) {
if constexpr (is_string_v<T>) read_string(x);
else if constexpr (is_char_v<T>) read_char(x);
else if constexpr (std::is_integral_v<T>) read_int(x);
return *this;
}
IO* tie(std::nullptr_t) { return this; }
void sync_with_stdio(bool) {}
} io;
} // namespace std
using std::io;
#define cin io
#define cout io
#ifndef _IN_LOCAL
#define dbg(...)
#endif
#define endl '\n'
#define endlfl '\n' << flush
#define quit(x) return (void)(cout << x << endl)
template<typename T> void read(T& x, bool write=0, bool write2=1) { if (write && write2) cout << x << endl; else if (write) cout << x << ' '; else cin >> x;}
template<typename T1, typename T2> void read(pair<T1, T2>& p, bool write=0, bool write2=1) { read(p.first, write, 0), read(p.second, write, 0); if (write && write2) cout << endl;}
template<typename T> void read(vector<T>& v, bool write=0) { for (auto& x : v) read(x, write, 0); if (write) cout << endl; }
template<typename T1, typename T2> void read(T1& x, T2& y, bool write=0) { read(x, write), read(y, write); if (write) cout << endl; }
template<typename T1, typename T2, typename T3> void read(T1& x, T2& y, T3& z, bool write=0) { read(x, write), read(y, write), read(z, write); if (write) cout << endl; }
template<typename T1, typename T2, typename T3, typename T4> void read(T1& x, T2& y, T3& z, T4& zz, bool write=0) { read(x, write), read(y, write), read(z, write), read(zz, write); if (write) cout << endl; }
template<typename T> void print(T x) { read(x, 1); }
template<typename T1, typename T2> void print(T1 x, T2 y) { read(x, y, 1); }
template<typename T1, typename T2, typename T3> void print(T1 x, T2 y, T3 z) { read(x, y, z, 1); }
template<typename T1, typename T2, typename T3, typename T4> void print(T1 x, T2 y, T3 z, T4 zz) { read(x, y, z, zz, 1); }
#define sz(x) (int)(x.size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define cmin(a, b) a = min(a, b)
#define cmax(a, b) a = max(a, b)
#define int long long
const int inf = numeric_limits<int>::max() / 4;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MOD = 1e9+7, LOG=25;
void solve();
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int tt=1;
// cin >> tt;
while(tt--) solve();
return 0;
}
vector<int> depth;
vector<vector<int>> nb, up;
vector<unordered_map<int, int>> nb2;
int lca(int a, int b) {
if (depth[a]<depth[b]) swap(a, b);
int k=depth[a]-depth[b];
for (int i=LOG-1; i>=0; i--) {
if (k&(1<<i)) a=up[a][i];
}
if (a==b) return a;
for (int i=LOG-1; i>=0; i--) {
if (up[a][i]!=up[b][i]) {
a=up[a][i], b=up[b][i];
}
}
return up[a][0];
}
int n, k, m, q;
vector<vector<int>> adj;
vector<int> a;
int SQRT;
void precalc(int x) {
nb[a[x]].pb(x);
nb2[depth[x]][a[x]]++;
for (auto u: adj[x]) {
depth[u]=depth[x]+1;
up[u][0]=x;
for (int i=1; i<LOG; i++) {
up[u][i] = up[ up[u][i-1] ][i-1];
}
precalc(u);
}
}
pair<int, int> calc(int x, unordered_map<int, int> &mp) {
unordered_map<int, int> in, out;
pair<int, int> ans;
for (auto u: nb[a[x]]) {
if (lca(u, x)!=x) out[depth[u]]++;
else in[depth[u]]++, ans.fi++;
}
for (auto u: out) {
int available=mp[u.fi]-in[u.fi], toadd=min(u.se, available);
ans.fi+=toadd, ans.se+=toadd;
}
return ans;
}
unordered_map<int, int> howmany, howmany2;
void dfs(int x, int colour) {
howmany[depth[x]]++;
if (a[x]==colour) howmany2[depth[x]]++;
for (auto u: adj[x]) dfs(u, colour);
}
pair<int, int> calc2(int x) {
howmany.clear(), howmany2.clear();
dfs(x, a[x]);
pair<int, int> ans={0, 0};
for (auto u: howmany) {
int toadd=min(u.se, nb2[u.fi][a[x]]);
ans.fi+=toadd;
ans.se+=toadd-howmany2[u.fi];
}
return ans;
}
pair<int, int> ans;
unordered_map<int, int> dfs(int x, vector<bool> &colour) {
bool past=colour[a[x]];
colour[a[x]]=1;
vector<unordered_map<int, int>> vec; vec.pb({{depth[x], 1}});
for (auto u: adj[x]) vec.pb(dfs(u, colour));
sort(all(vec), [&](auto &aa, auto &bb) {return sz(aa)>sz(bb);});
for (int i=1; i<sz(vec); i++) {
for (auto u: vec[i]) vec[0][u.fi]+=u.se;
}
colour[a[x]]=past;
if (!colour[a[x]]) {
if (sz(nb[a[x]])<SQRT) {
auto temp=calc(x, vec[0]);
if (temp.fi>ans.fi || (temp.fi==ans.fi && temp.se<ans.se)) ans=temp;
} else {
auto temp=calc2(x);
if (temp.fi>ans.fi || (temp.fi==ans.fi && temp.se<ans.se)) ans=temp;
}
}
return move(vec[0]);
}
void solve() {
read(n, k);
SQRT=sqrt(n);
if (k==1) {
cout << n << ' ' << 0 << endl;
return;
}
a.clear(), a.resize(n); read(a);
adj.clear(), adj.resize(n), depth.resize(n), nb.resize(k), nb2.resize(n), up.resize(n, vector<int>(LOG, 0));
for (int i=1; i<n; i++) {
int x; cin >> x;
adj[x].pb(i);
}
precalc(0);
vector<bool> colour(n, 0);
dfs(0, colour);
cout << ans.fi << ' ' << ans.se << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
8 ms |
4188 KB |
Output is correct |
9 |
Correct |
158 ms |
87532 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
2396 KB |
Output is correct |
12 |
Correct |
111 ms |
88080 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
2 ms |
2396 KB |
Output is correct |
15 |
Correct |
150 ms |
88784 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
2 ms |
2388 KB |
Output is correct |
5 |
Correct |
120 ms |
88056 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
1372 KB |
Output is correct |
8 |
Correct |
90 ms |
42776 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
1884 KB |
Output is correct |
11 |
Correct |
164 ms |
65496 KB |
Output is correct |
12 |
Correct |
51 ms |
47488 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
0 ms |
604 KB |
Output is correct |
15 |
Correct |
77 ms |
35648 KB |
Output is correct |
16 |
Correct |
87 ms |
35568 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
2 ms |
1372 KB |
Output is correct |
19 |
Correct |
82 ms |
35816 KB |
Output is correct |
20 |
Correct |
75 ms |
35916 KB |
Output is correct |
21 |
Correct |
85 ms |
35804 KB |
Output is correct |
22 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
159 ms |
87560 KB |
Output is correct |
9 |
Correct |
0 ms |
600 KB |
Output is correct |
10 |
Correct |
2 ms |
2396 KB |
Output is correct |
11 |
Correct |
131 ms |
88824 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
0 ms |
604 KB |
Output is correct |
15 |
Correct |
3 ms |
1372 KB |
Output is correct |
16 |
Correct |
4 ms |
1372 KB |
Output is correct |
17 |
Correct |
2 ms |
1628 KB |
Output is correct |
18 |
Correct |
216 ms |
42324 KB |
Output is correct |
19 |
Correct |
261 ms |
42020 KB |
Output is correct |
20 |
Correct |
372 ms |
55124 KB |
Output is correct |
21 |
Correct |
309 ms |
41512 KB |
Output is correct |
22 |
Correct |
151 ms |
45192 KB |
Output is correct |
23 |
Correct |
300 ms |
66556 KB |
Output is correct |
24 |
Correct |
343 ms |
57872 KB |
Output is correct |
25 |
Correct |
3 ms |
1836 KB |
Output is correct |
26 |
Correct |
3 ms |
2140 KB |
Output is correct |
27 |
Correct |
3 ms |
1372 KB |
Output is correct |
28 |
Correct |
4 ms |
1592 KB |
Output is correct |
29 |
Correct |
11 ms |
4956 KB |
Output is correct |
30 |
Correct |
242 ms |
41612 KB |
Output is correct |
31 |
Correct |
231 ms |
43624 KB |
Output is correct |
32 |
Correct |
291 ms |
53444 KB |
Output is correct |
33 |
Correct |
202 ms |
44252 KB |
Output is correct |
34 |
Correct |
0 ms |
604 KB |
Output is correct |
35 |
Correct |
0 ms |
604 KB |
Output is correct |
36 |
Correct |
0 ms |
604 KB |
Output is correct |
37 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
1 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
9 ms |
4192 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
2272 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
2 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
1372 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
2 ms |
1884 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
0 ms |
604 KB |
Output is correct |
19 |
Correct |
0 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
1372 KB |
Output is correct |
21 |
Correct |
0 ms |
604 KB |
Output is correct |
22 |
Correct |
0 ms |
604 KB |
Output is correct |
23 |
Correct |
4 ms |
1624 KB |
Output is correct |
24 |
Correct |
4 ms |
1372 KB |
Output is correct |
25 |
Correct |
4 ms |
1628 KB |
Output is correct |
26 |
Correct |
4 ms |
1628 KB |
Output is correct |
27 |
Correct |
3 ms |
2172 KB |
Output is correct |
28 |
Correct |
3 ms |
1372 KB |
Output is correct |
29 |
Correct |
2 ms |
1372 KB |
Output is correct |
30 |
Correct |
3 ms |
1884 KB |
Output is correct |
31 |
Correct |
4 ms |
1628 KB |
Output is correct |
32 |
Correct |
1 ms |
1372 KB |
Output is correct |
33 |
Correct |
2 ms |
1628 KB |
Output is correct |
34 |
Correct |
1 ms |
1372 KB |
Output is correct |
35 |
Correct |
1 ms |
1368 KB |
Output is correct |
36 |
Correct |
3 ms |
1372 KB |
Output is correct |
37 |
Correct |
2 ms |
1372 KB |
Output is correct |
38 |
Correct |
1 ms |
604 KB |
Output is correct |
39 |
Correct |
1 ms |
604 KB |
Output is correct |
40 |
Correct |
0 ms |
604 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
604 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
604 KB |
Output is correct |
4 |
Correct |
0 ms |
604 KB |
Output is correct |
5 |
Correct |
0 ms |
604 KB |
Output is correct |
6 |
Correct |
0 ms |
604 KB |
Output is correct |
7 |
Correct |
0 ms |
604 KB |
Output is correct |
8 |
Correct |
8 ms |
4188 KB |
Output is correct |
9 |
Correct |
158 ms |
87532 KB |
Output is correct |
10 |
Correct |
1 ms |
600 KB |
Output is correct |
11 |
Correct |
2 ms |
2396 KB |
Output is correct |
12 |
Correct |
111 ms |
88080 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
2 ms |
2396 KB |
Output is correct |
15 |
Correct |
150 ms |
88784 KB |
Output is correct |
16 |
Correct |
1 ms |
604 KB |
Output is correct |
17 |
Correct |
0 ms |
604 KB |
Output is correct |
18 |
Correct |
0 ms |
604 KB |
Output is correct |
19 |
Correct |
0 ms |
604 KB |
Output is correct |
20 |
Correct |
2 ms |
2388 KB |
Output is correct |
21 |
Correct |
120 ms |
88056 KB |
Output is correct |
22 |
Correct |
0 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
1372 KB |
Output is correct |
24 |
Correct |
90 ms |
42776 KB |
Output is correct |
25 |
Correct |
0 ms |
604 KB |
Output is correct |
26 |
Correct |
2 ms |
1884 KB |
Output is correct |
27 |
Correct |
164 ms |
65496 KB |
Output is correct |
28 |
Correct |
51 ms |
47488 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
0 ms |
604 KB |
Output is correct |
31 |
Correct |
77 ms |
35648 KB |
Output is correct |
32 |
Correct |
87 ms |
35568 KB |
Output is correct |
33 |
Correct |
0 ms |
604 KB |
Output is correct |
34 |
Correct |
2 ms |
1372 KB |
Output is correct |
35 |
Correct |
82 ms |
35816 KB |
Output is correct |
36 |
Correct |
75 ms |
35916 KB |
Output is correct |
37 |
Correct |
85 ms |
35804 KB |
Output is correct |
38 |
Correct |
0 ms |
604 KB |
Output is correct |
39 |
Correct |
0 ms |
604 KB |
Output is correct |
40 |
Correct |
0 ms |
604 KB |
Output is correct |
41 |
Correct |
0 ms |
604 KB |
Output is correct |
42 |
Correct |
0 ms |
604 KB |
Output is correct |
43 |
Correct |
0 ms |
604 KB |
Output is correct |
44 |
Correct |
0 ms |
604 KB |
Output is correct |
45 |
Correct |
0 ms |
604 KB |
Output is correct |
46 |
Correct |
159 ms |
87560 KB |
Output is correct |
47 |
Correct |
0 ms |
600 KB |
Output is correct |
48 |
Correct |
2 ms |
2396 KB |
Output is correct |
49 |
Correct |
131 ms |
88824 KB |
Output is correct |
50 |
Correct |
0 ms |
604 KB |
Output is correct |
51 |
Correct |
1 ms |
604 KB |
Output is correct |
52 |
Correct |
0 ms |
604 KB |
Output is correct |
53 |
Correct |
3 ms |
1372 KB |
Output is correct |
54 |
Correct |
4 ms |
1372 KB |
Output is correct |
55 |
Correct |
2 ms |
1628 KB |
Output is correct |
56 |
Correct |
216 ms |
42324 KB |
Output is correct |
57 |
Correct |
261 ms |
42020 KB |
Output is correct |
58 |
Correct |
372 ms |
55124 KB |
Output is correct |
59 |
Correct |
309 ms |
41512 KB |
Output is correct |
60 |
Correct |
151 ms |
45192 KB |
Output is correct |
61 |
Correct |
300 ms |
66556 KB |
Output is correct |
62 |
Correct |
343 ms |
57872 KB |
Output is correct |
63 |
Correct |
3 ms |
1836 KB |
Output is correct |
64 |
Correct |
3 ms |
2140 KB |
Output is correct |
65 |
Correct |
3 ms |
1372 KB |
Output is correct |
66 |
Correct |
4 ms |
1592 KB |
Output is correct |
67 |
Correct |
11 ms |
4956 KB |
Output is correct |
68 |
Correct |
242 ms |
41612 KB |
Output is correct |
69 |
Correct |
231 ms |
43624 KB |
Output is correct |
70 |
Correct |
291 ms |
53444 KB |
Output is correct |
71 |
Correct |
202 ms |
44252 KB |
Output is correct |
72 |
Correct |
0 ms |
604 KB |
Output is correct |
73 |
Correct |
0 ms |
604 KB |
Output is correct |
74 |
Correct |
0 ms |
604 KB |
Output is correct |
75 |
Correct |
0 ms |
604 KB |
Output is correct |
76 |
Correct |
0 ms |
604 KB |
Output is correct |
77 |
Correct |
0 ms |
600 KB |
Output is correct |
78 |
Correct |
1 ms |
604 KB |
Output is correct |
79 |
Correct |
0 ms |
604 KB |
Output is correct |
80 |
Correct |
1 ms |
604 KB |
Output is correct |
81 |
Correct |
0 ms |
604 KB |
Output is correct |
82 |
Correct |
0 ms |
604 KB |
Output is correct |
83 |
Correct |
9 ms |
4192 KB |
Output is correct |
84 |
Correct |
1 ms |
604 KB |
Output is correct |
85 |
Correct |
2 ms |
2272 KB |
Output is correct |
86 |
Correct |
1 ms |
604 KB |
Output is correct |
87 |
Correct |
2 ms |
2396 KB |
Output is correct |
88 |
Correct |
1 ms |
600 KB |
Output is correct |
89 |
Correct |
1 ms |
1372 KB |
Output is correct |
90 |
Correct |
0 ms |
604 KB |
Output is correct |
91 |
Correct |
2 ms |
1884 KB |
Output is correct |
92 |
Correct |
0 ms |
604 KB |
Output is correct |
93 |
Correct |
0 ms |
604 KB |
Output is correct |
94 |
Correct |
0 ms |
604 KB |
Output is correct |
95 |
Correct |
1 ms |
1372 KB |
Output is correct |
96 |
Correct |
0 ms |
604 KB |
Output is correct |
97 |
Correct |
0 ms |
604 KB |
Output is correct |
98 |
Correct |
4 ms |
1624 KB |
Output is correct |
99 |
Correct |
4 ms |
1372 KB |
Output is correct |
100 |
Correct |
4 ms |
1628 KB |
Output is correct |
101 |
Correct |
4 ms |
1628 KB |
Output is correct |
102 |
Correct |
3 ms |
2172 KB |
Output is correct |
103 |
Correct |
3 ms |
1372 KB |
Output is correct |
104 |
Correct |
2 ms |
1372 KB |
Output is correct |
105 |
Correct |
3 ms |
1884 KB |
Output is correct |
106 |
Correct |
4 ms |
1628 KB |
Output is correct |
107 |
Correct |
1 ms |
1372 KB |
Output is correct |
108 |
Correct |
2 ms |
1628 KB |
Output is correct |
109 |
Correct |
1 ms |
1372 KB |
Output is correct |
110 |
Correct |
1 ms |
1368 KB |
Output is correct |
111 |
Correct |
3 ms |
1372 KB |
Output is correct |
112 |
Correct |
2 ms |
1372 KB |
Output is correct |
113 |
Correct |
1 ms |
604 KB |
Output is correct |
114 |
Correct |
1 ms |
604 KB |
Output is correct |
115 |
Correct |
0 ms |
604 KB |
Output is correct |
116 |
Correct |
0 ms |
604 KB |
Output is correct |
117 |
Correct |
0 ms |
604 KB |
Output is correct |
118 |
Correct |
0 ms |
604 KB |
Output is correct |
119 |
Correct |
0 ms |
604 KB |
Output is correct |
120 |
Correct |
0 ms |
604 KB |
Output is correct |
121 |
Correct |
0 ms |
604 KB |
Output is correct |
122 |
Correct |
0 ms |
604 KB |
Output is correct |
123 |
Correct |
0 ms |
604 KB |
Output is correct |
124 |
Correct |
9 ms |
4232 KB |
Output is correct |
125 |
Correct |
164 ms |
87544 KB |
Output is correct |
126 |
Correct |
1 ms |
604 KB |
Output is correct |
127 |
Correct |
2 ms |
2396 KB |
Output is correct |
128 |
Correct |
110 ms |
88200 KB |
Output is correct |
129 |
Correct |
1 ms |
604 KB |
Output is correct |
130 |
Correct |
4 ms |
2396 KB |
Output is correct |
131 |
Correct |
137 ms |
88768 KB |
Output is correct |
132 |
Correct |
0 ms |
600 KB |
Output is correct |
133 |
Correct |
1 ms |
1372 KB |
Output is correct |
134 |
Correct |
63 ms |
43544 KB |
Output is correct |
135 |
Correct |
1 ms |
600 KB |
Output is correct |
136 |
Correct |
2 ms |
1884 KB |
Output is correct |
137 |
Correct |
159 ms |
65668 KB |
Output is correct |
138 |
Correct |
62 ms |
46484 KB |
Output is correct |
139 |
Correct |
1 ms |
604 KB |
Output is correct |
140 |
Correct |
1 ms |
604 KB |
Output is correct |
141 |
Correct |
76 ms |
35708 KB |
Output is correct |
142 |
Correct |
71 ms |
35612 KB |
Output is correct |
143 |
Correct |
1 ms |
604 KB |
Output is correct |
144 |
Correct |
1 ms |
1372 KB |
Output is correct |
145 |
Correct |
87 ms |
35864 KB |
Output is correct |
146 |
Correct |
76 ms |
35912 KB |
Output is correct |
147 |
Correct |
76 ms |
35780 KB |
Output is correct |
148 |
Correct |
0 ms |
600 KB |
Output is correct |
149 |
Correct |
0 ms |
604 KB |
Output is correct |
150 |
Correct |
3 ms |
1372 KB |
Output is correct |
151 |
Correct |
3 ms |
1576 KB |
Output is correct |
152 |
Correct |
2 ms |
1628 KB |
Output is correct |
153 |
Correct |
175 ms |
42380 KB |
Output is correct |
154 |
Correct |
278 ms |
42156 KB |
Output is correct |
155 |
Correct |
359 ms |
55120 KB |
Output is correct |
156 |
Correct |
278 ms |
41632 KB |
Output is correct |
157 |
Correct |
138 ms |
45292 KB |
Output is correct |
158 |
Correct |
279 ms |
66552 KB |
Output is correct |
159 |
Correct |
270 ms |
57760 KB |
Output is correct |
160 |
Correct |
3 ms |
1628 KB |
Output is correct |
161 |
Correct |
3 ms |
2140 KB |
Output is correct |
162 |
Correct |
2 ms |
1372 KB |
Output is correct |
163 |
Correct |
2 ms |
1372 KB |
Output is correct |
164 |
Correct |
11 ms |
4792 KB |
Output is correct |
165 |
Correct |
204 ms |
41812 KB |
Output is correct |
166 |
Correct |
208 ms |
43256 KB |
Output is correct |
167 |
Correct |
250 ms |
53404 KB |
Output is correct |
168 |
Correct |
233 ms |
44244 KB |
Output is correct |
169 |
Correct |
2 ms |
1884 KB |
Output is correct |
170 |
Correct |
4 ms |
1628 KB |
Output is correct |
171 |
Correct |
2 ms |
1372 KB |
Output is correct |
172 |
Correct |
2 ms |
1628 KB |
Output is correct |
173 |
Correct |
1 ms |
1372 KB |
Output is correct |
174 |
Correct |
1 ms |
1372 KB |
Output is correct |
175 |
Correct |
1 ms |
1420 KB |
Output is correct |
176 |
Correct |
1 ms |
1372 KB |
Output is correct |
177 |
Correct |
150 ms |
67720 KB |
Output is correct |
178 |
Correct |
1419 ms |
45908 KB |
Output is correct |
179 |
Correct |
159 ms |
43040 KB |
Output is correct |
180 |
Correct |
6 ms |
4444 KB |
Output is correct |
181 |
Correct |
63 ms |
37336 KB |
Output is correct |
182 |
Correct |
5 ms |
4188 KB |
Output is correct |
183 |
Correct |
5 ms |
4444 KB |
Output is correct |
184 |
Correct |
5 ms |
4332 KB |
Output is correct |
185 |
Correct |
5 ms |
4188 KB |
Output is correct |
186 |
Correct |
71 ms |
37800 KB |
Output is correct |
187 |
Correct |
56 ms |
35448 KB |
Output is correct |
188 |
Correct |
81 ms |
37004 KB |
Output is correct |
189 |
Correct |
56 ms |
35412 KB |
Output is correct |
190 |
Correct |
58 ms |
35856 KB |
Output is correct |
191 |
Correct |
50 ms |
39604 KB |
Output is correct |
192 |
Correct |
5 ms |
4188 KB |
Output is correct |
193 |
Correct |
71 ms |
36048 KB |
Output is correct |
194 |
Correct |
121 ms |
48108 KB |
Output is correct |
195 |
Correct |
0 ms |
600 KB |
Output is correct |
196 |
Correct |
0 ms |
604 KB |
Output is correct |
197 |
Correct |
0 ms |
604 KB |
Output is correct |
198 |
Correct |
0 ms |
604 KB |
Output is correct |