#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)
template<typename T>
void amin(T &a, T b) {
a = min(a,b);
}
template<typename T>
void amax(T &a, T b) {
a = max(a,b);
}
#ifdef LOCAL
#include "debug.h"
#else
#define debug(x) 42
#endif
/*
refs:
https://codeforces.com/blog/entry/114003?#comment-1015100
*/
const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;
vector<int> adj1[N];
struct lca_algo {
// LCA template (for graphs with 1-based indexing)
int LOG = 1;
vector<int> depth;
vector<vector<int>> up;
vector<int> tin, tout;
int timer = 1;
lca_algo() {
}
lca_algo(int n) {
lca_init(n);
}
void lca_init(int n) {
while ((1 << LOG) < n) LOG++;
up = vector<vector<int>>(n + 1, vector<int>(LOG, 1));
depth = vector<int>(n + 1);
tin = vector<int>(n + 1);
tout = vector<int>(n + 1);
lca_dfs(1, -1);
}
void lca_dfs(int node, int par) {
tin[node] = timer++;
trav(child, adj1[node]) {
if (child == par) conts;
up[child][0] = node;
rep1(j, LOG - 1) {
up[child][j] = up[up[child][j - 1]][j - 1];
}
depth[child] = depth[node] + 1;
lca_dfs(child, node);
}
tout[node] = timer-1;
}
int lift(int u, int k) {
rep(j, LOG) {
if (k & (1 << j)) {
u = up[u][j];
}
}
return u;
}
int query(int u, int v) {
if (depth[u] < depth[v]) swap(u, v);
int k = depth[u] - depth[v];
u = lift(u, k);
if (u == v) return u;
rev(j, LOG - 1, 0) {
if (up[u][j] != up[v][j]) {
u = up[u][j];
v = up[v][j];
}
}
u = up[u][0];
return u;
}
int get_dis(int u, int v) {
int lca = query(u, v);
return depth[u] + depth[v] - 2 * depth[lca];
}
bool is_ances(int u, int v){
return tin[u] <= tin[v] and tout[u] >= tout[v];
}
};
template<typename T>
struct fenwick {
int siz;
vector<T> tree;
fenwick() {
}
fenwick(int n) {
siz = n;
tree = vector<T>(n + 1);
}
int lsb(int x) {
return x & -x;
}
void build(vector<T> &a, int n) {
for (int i = 1; i <= n; ++i) {
int par = i + lsb(i);
tree[i] += a[i];
if (par <= siz) {
tree[par] += tree[i];
}
}
}
void pupd(int i, T v) {
while (i <= siz) {
tree[i] += v;
i += lsb(i);
}
}
T sum(int i) {
T res = 0;
while (i) {
res += tree[i];
i -= lsb(i);
}
return res;
}
T query(int l, int r) {
if (l > r) return 0;
T res = sum(r) - sum(l - 1);
return res;
}
};
lca_algo LCA;
vector<int> a(N);
vector<pii> adj2[N];
vector<int> mxl(N), mnr(N);
vector<array<int,3>> edge_contrib;
void dfs1(int u, int p){
for(auto [v,d] : adj2[u]){
if(v == p) conts;
dfs1(v,u);
amax(mxl[u],mxl[v]);
amin(mnr[u],mnr[v]);
edge_contrib.pb({mxl[v],mnr[v],d});
}
}
vector<int> ans(N);
vector<array<int,3>> here[N];
fenwick<int> fenw(N);
void go(int l, int r, vector<array<int,3>> queries){
if(l > r) return;
int mid = (l+r) >> 1;
vector<array<int,3>> queries_left, queries_right, queries_curr;
for(auto [ql,qr,id] : queries){
if(qr < mid){
queries_left.pb({ql,qr,id});
}
else if(ql > mid){
queries_right.pb({ql,qr,id});
}
else{
queries_curr.pb({ql,qr,id});
}
}
vector<pii> nodes;
for(int i = l; i <= r; ++i){
int u = a[i];
nodes.pb({LCA.tin[u],u});
}
sort(all(nodes));
int siz = sz(nodes);
rep(i,siz-1){
int lca = LCA.query(nodes[i].ss,nodes[i+1].ss);
nodes.pb({LCA.tin[lca],lca});
}
sort(all(nodes));
nodes.resize(unique(all(nodes))-nodes.begin());
siz = sz(nodes);
stack<int> stk;
stk.push(nodes[0].ss);
rep1(i,siz-1){
auto [ti,u] = nodes[i];
while(!LCA.is_ances(stk.top(),u)){
stk.pop();
}
assert(!stk.empty());
int p = stk.top();
int d = LCA.get_dis(p,u);
adj2[p].pb({u,d}), adj2[u].pb({p,d});
stk.push(u);
}
for(auto [ti,u] : nodes){
mxl[u] = 0;
mnr[u] = r+1;
}
for(int i = l; i < mid; ++i){
int u = a[i];
amax(mxl[u],i);
}
for(int i = mid+1; i <= r; ++i){
int u = a[i];
amin(mnr[u],i);
}
edge_contrib.clear();
int root = a[mid];
dfs1(root,-1);
for(auto [ql,qr,id] : queries_curr){
here[ql].pb({qr,id,1});
}
for(auto [lx,rx,w] : edge_contrib){
here[lx].pb({rx,w,2});
}
int sum = 0;
for(auto [lx,rx,w] : edge_contrib){
if(lx >= l){
sum += w;
}
else{
fenw.pupd(rx,w);
}
}
for(int ql = l; ql <= mid; ++ql){
trav(ar,here[ql]){
if(ar[2] == 1){
auto [qr,id,t] = ar;
int res = sum+fenw.query(1,qr)+1;
ans[id] = res;
}
else{
auto [rx,w,t] = ar;
sum -= w;
fenw.pupd(rx,w);
}
}
}
// reset
for(auto [ql,qr,id] : queries_curr){
here[ql].clear();
}
for(auto [lx,rx,w] : edge_contrib){
here[lx].clear();
}
for(auto [ti,u] : nodes){
adj2[u].clear();
}
for(auto [lx,rx,w] : edge_contrib){
fenw.pupd(rx,-w);
}
go(l,mid-1,queries_left);
go(mid+1,r,queries_right);
}
void solve(int test_case)
{
int n,m,q; cin >> n >> m >> q;
rep1(i,n-1){
int u,v; cin >> u >> v;
adj1[u].pb(v), adj1[v].pb(u);
}
rep1(i,m) cin >> a[i];
LCA = lca_algo(n);
vector<array<int,3>> queries;
rep1(i,q){
int l,r; cin >> l >> r;
queries.pb({l,r,i});
}
go(1,m,queries);
rep1(i,q) cout << ans[i] << endl;
}
int main()
{
fastio;
int t = 1;
// cin >> t;
rep1(i, t) {
solve(i);
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
9304 KB |
Output is correct |
2 |
Correct |
3 ms |
9308 KB |
Output is correct |
3 |
Correct |
2 ms |
9308 KB |
Output is correct |
4 |
Correct |
3 ms |
9308 KB |
Output is correct |
5 |
Correct |
3 ms |
9308 KB |
Output is correct |
6 |
Correct |
3 ms |
9308 KB |
Output is correct |
7 |
Correct |
3 ms |
9308 KB |
Output is correct |
8 |
Correct |
3 ms |
9308 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
3 ms |
9564 KB |
Output is correct |
11 |
Correct |
3 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9416 KB |
Output is correct |
13 |
Correct |
4 ms |
9564 KB |
Output is correct |
14 |
Correct |
3 ms |
9816 KB |
Output is correct |
15 |
Correct |
3 ms |
9564 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
4 ms |
9564 KB |
Output is correct |
18 |
Correct |
4 ms |
9564 KB |
Output is correct |
19 |
Correct |
3 ms |
9564 KB |
Output is correct |
20 |
Correct |
4 ms |
9364 KB |
Output is correct |
21 |
Correct |
3 ms |
9560 KB |
Output is correct |
22 |
Correct |
3 ms |
9564 KB |
Output is correct |
23 |
Correct |
4 ms |
9564 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
3 ms |
9564 KB |
Output is correct |
26 |
Correct |
3 ms |
9564 KB |
Output is correct |
27 |
Correct |
3 ms |
9308 KB |
Output is correct |
28 |
Correct |
3 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
9304 KB |
Output is correct |
2 |
Correct |
3 ms |
9308 KB |
Output is correct |
3 |
Correct |
2 ms |
9308 KB |
Output is correct |
4 |
Correct |
3 ms |
9308 KB |
Output is correct |
5 |
Correct |
3 ms |
9308 KB |
Output is correct |
6 |
Correct |
3 ms |
9308 KB |
Output is correct |
7 |
Correct |
3 ms |
9308 KB |
Output is correct |
8 |
Correct |
3 ms |
9308 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
3 ms |
9564 KB |
Output is correct |
11 |
Correct |
3 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9416 KB |
Output is correct |
13 |
Correct |
4 ms |
9564 KB |
Output is correct |
14 |
Correct |
3 ms |
9816 KB |
Output is correct |
15 |
Correct |
3 ms |
9564 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
4 ms |
9564 KB |
Output is correct |
18 |
Correct |
4 ms |
9564 KB |
Output is correct |
19 |
Correct |
3 ms |
9564 KB |
Output is correct |
20 |
Correct |
4 ms |
9364 KB |
Output is correct |
21 |
Correct |
3 ms |
9560 KB |
Output is correct |
22 |
Correct |
3 ms |
9564 KB |
Output is correct |
23 |
Correct |
4 ms |
9564 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
3 ms |
9564 KB |
Output is correct |
26 |
Correct |
3 ms |
9564 KB |
Output is correct |
27 |
Correct |
3 ms |
9308 KB |
Output is correct |
28 |
Correct |
3 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
30 |
Correct |
7 ms |
9820 KB |
Output is correct |
31 |
Correct |
9 ms |
9956 KB |
Output is correct |
32 |
Correct |
10 ms |
10072 KB |
Output is correct |
33 |
Correct |
10 ms |
10076 KB |
Output is correct |
34 |
Correct |
9 ms |
10076 KB |
Output is correct |
35 |
Correct |
10 ms |
10072 KB |
Output is correct |
36 |
Correct |
9 ms |
10076 KB |
Output is correct |
37 |
Correct |
9 ms |
10072 KB |
Output is correct |
38 |
Correct |
9 ms |
10332 KB |
Output is correct |
39 |
Correct |
9 ms |
10332 KB |
Output is correct |
40 |
Correct |
9 ms |
10076 KB |
Output is correct |
41 |
Correct |
10 ms |
10264 KB |
Output is correct |
42 |
Correct |
10 ms |
10332 KB |
Output is correct |
43 |
Correct |
9 ms |
10076 KB |
Output is correct |
44 |
Correct |
12 ms |
10332 KB |
Output is correct |
45 |
Correct |
9 ms |
10076 KB |
Output is correct |
46 |
Correct |
10 ms |
10132 KB |
Output is correct |
47 |
Correct |
11 ms |
10076 KB |
Output is correct |
48 |
Correct |
9 ms |
10076 KB |
Output is correct |
49 |
Correct |
9 ms |
10076 KB |
Output is correct |
50 |
Correct |
7 ms |
9816 KB |
Output is correct |
51 |
Correct |
7 ms |
9820 KB |
Output is correct |
52 |
Correct |
7 ms |
10048 KB |
Output is correct |
53 |
Correct |
7 ms |
9820 KB |
Output is correct |
54 |
Correct |
7 ms |
10076 KB |
Output is correct |
55 |
Correct |
7 ms |
9820 KB |
Output is correct |
56 |
Correct |
4 ms |
9648 KB |
Output is correct |
57 |
Correct |
3 ms |
9820 KB |
Output is correct |
58 |
Correct |
10 ms |
10076 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
9308 KB |
Output is correct |
2 |
Correct |
2 ms |
9308 KB |
Output is correct |
3 |
Correct |
4 ms |
9564 KB |
Output is correct |
4 |
Correct |
524 ms |
47632 KB |
Output is correct |
5 |
Correct |
359 ms |
42980 KB |
Output is correct |
6 |
Correct |
558 ms |
53444 KB |
Output is correct |
7 |
Correct |
698 ms |
60176 KB |
Output is correct |
8 |
Correct |
740 ms |
62072 KB |
Output is correct |
9 |
Correct |
761 ms |
62692 KB |
Output is correct |
10 |
Correct |
702 ms |
62148 KB |
Output is correct |
11 |
Correct |
720 ms |
61012 KB |
Output is correct |
12 |
Correct |
417 ms |
47940 KB |
Output is correct |
13 |
Correct |
419 ms |
48000 KB |
Output is correct |
14 |
Correct |
423 ms |
48136 KB |
Output is correct |
15 |
Correct |
53 ms |
33792 KB |
Output is correct |
16 |
Correct |
775 ms |
64724 KB |
Output is correct |
17 |
Correct |
112 ms |
19424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
9308 KB |
Output is correct |
2 |
Correct |
410 ms |
25792 KB |
Output is correct |
3 |
Correct |
615 ms |
31052 KB |
Output is correct |
4 |
Correct |
523 ms |
29480 KB |
Output is correct |
5 |
Correct |
864 ms |
39364 KB |
Output is correct |
6 |
Correct |
818 ms |
39312 KB |
Output is correct |
7 |
Correct |
897 ms |
39464 KB |
Output is correct |
8 |
Correct |
912 ms |
39360 KB |
Output is correct |
9 |
Correct |
864 ms |
39688 KB |
Output is correct |
10 |
Correct |
878 ms |
39360 KB |
Output is correct |
11 |
Correct |
927 ms |
39032 KB |
Output is correct |
12 |
Correct |
902 ms |
39728 KB |
Output is correct |
13 |
Correct |
857 ms |
39604 KB |
Output is correct |
14 |
Correct |
865 ms |
40932 KB |
Output is correct |
15 |
Correct |
919 ms |
45128 KB |
Output is correct |
16 |
Correct |
954 ms |
40352 KB |
Output is correct |
17 |
Correct |
896 ms |
40620 KB |
Output is correct |
18 |
Correct |
856 ms |
40012 KB |
Output is correct |
19 |
Correct |
1083 ms |
44820 KB |
Output is correct |
20 |
Correct |
1134 ms |
45104 KB |
Output is correct |
21 |
Correct |
1223 ms |
44932 KB |
Output is correct |
22 |
Correct |
1083 ms |
44904 KB |
Output is correct |
23 |
Correct |
956 ms |
45148 KB |
Output is correct |
24 |
Correct |
1138 ms |
45176 KB |
Output is correct |
25 |
Correct |
1026 ms |
45000 KB |
Output is correct |
26 |
Correct |
1070 ms |
45008 KB |
Output is correct |
27 |
Correct |
1046 ms |
45336 KB |
Output is correct |
28 |
Correct |
1063 ms |
44864 KB |
Output is correct |
29 |
Correct |
1138 ms |
45160 KB |
Output is correct |
30 |
Correct |
1113 ms |
44988 KB |
Output is correct |
31 |
Correct |
1119 ms |
45620 KB |
Output is correct |
32 |
Correct |
1084 ms |
46364 KB |
Output is correct |
33 |
Correct |
1144 ms |
48320 KB |
Output is correct |
34 |
Correct |
1122 ms |
51304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
9304 KB |
Output is correct |
2 |
Correct |
3 ms |
9308 KB |
Output is correct |
3 |
Correct |
4 ms |
9564 KB |
Output is correct |
4 |
Correct |
593 ms |
36908 KB |
Output is correct |
5 |
Correct |
607 ms |
37400 KB |
Output is correct |
6 |
Correct |
759 ms |
43640 KB |
Output is correct |
7 |
Correct |
771 ms |
46504 KB |
Output is correct |
8 |
Correct |
794 ms |
46684 KB |
Output is correct |
9 |
Correct |
770 ms |
46432 KB |
Output is correct |
10 |
Correct |
790 ms |
46860 KB |
Output is correct |
11 |
Correct |
771 ms |
46376 KB |
Output is correct |
12 |
Correct |
776 ms |
46768 KB |
Output is correct |
13 |
Correct |
804 ms |
46528 KB |
Output is correct |
14 |
Correct |
118 ms |
19456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
9304 KB |
Output is correct |
2 |
Correct |
3 ms |
9308 KB |
Output is correct |
3 |
Correct |
2 ms |
9308 KB |
Output is correct |
4 |
Correct |
3 ms |
9308 KB |
Output is correct |
5 |
Correct |
3 ms |
9308 KB |
Output is correct |
6 |
Correct |
3 ms |
9308 KB |
Output is correct |
7 |
Correct |
3 ms |
9308 KB |
Output is correct |
8 |
Correct |
3 ms |
9308 KB |
Output is correct |
9 |
Correct |
3 ms |
9564 KB |
Output is correct |
10 |
Correct |
3 ms |
9564 KB |
Output is correct |
11 |
Correct |
3 ms |
9564 KB |
Output is correct |
12 |
Correct |
3 ms |
9416 KB |
Output is correct |
13 |
Correct |
4 ms |
9564 KB |
Output is correct |
14 |
Correct |
3 ms |
9816 KB |
Output is correct |
15 |
Correct |
3 ms |
9564 KB |
Output is correct |
16 |
Correct |
3 ms |
9564 KB |
Output is correct |
17 |
Correct |
4 ms |
9564 KB |
Output is correct |
18 |
Correct |
4 ms |
9564 KB |
Output is correct |
19 |
Correct |
3 ms |
9564 KB |
Output is correct |
20 |
Correct |
4 ms |
9364 KB |
Output is correct |
21 |
Correct |
3 ms |
9560 KB |
Output is correct |
22 |
Correct |
3 ms |
9564 KB |
Output is correct |
23 |
Correct |
4 ms |
9564 KB |
Output is correct |
24 |
Correct |
3 ms |
9564 KB |
Output is correct |
25 |
Correct |
3 ms |
9564 KB |
Output is correct |
26 |
Correct |
3 ms |
9564 KB |
Output is correct |
27 |
Correct |
3 ms |
9308 KB |
Output is correct |
28 |
Correct |
3 ms |
9308 KB |
Output is correct |
29 |
Correct |
3 ms |
9564 KB |
Output is correct |
30 |
Correct |
7 ms |
9820 KB |
Output is correct |
31 |
Correct |
9 ms |
9956 KB |
Output is correct |
32 |
Correct |
10 ms |
10072 KB |
Output is correct |
33 |
Correct |
10 ms |
10076 KB |
Output is correct |
34 |
Correct |
9 ms |
10076 KB |
Output is correct |
35 |
Correct |
10 ms |
10072 KB |
Output is correct |
36 |
Correct |
9 ms |
10076 KB |
Output is correct |
37 |
Correct |
9 ms |
10072 KB |
Output is correct |
38 |
Correct |
9 ms |
10332 KB |
Output is correct |
39 |
Correct |
9 ms |
10332 KB |
Output is correct |
40 |
Correct |
9 ms |
10076 KB |
Output is correct |
41 |
Correct |
10 ms |
10264 KB |
Output is correct |
42 |
Correct |
10 ms |
10332 KB |
Output is correct |
43 |
Correct |
9 ms |
10076 KB |
Output is correct |
44 |
Correct |
12 ms |
10332 KB |
Output is correct |
45 |
Correct |
9 ms |
10076 KB |
Output is correct |
46 |
Correct |
10 ms |
10132 KB |
Output is correct |
47 |
Correct |
11 ms |
10076 KB |
Output is correct |
48 |
Correct |
9 ms |
10076 KB |
Output is correct |
49 |
Correct |
9 ms |
10076 KB |
Output is correct |
50 |
Correct |
7 ms |
9816 KB |
Output is correct |
51 |
Correct |
7 ms |
9820 KB |
Output is correct |
52 |
Correct |
7 ms |
10048 KB |
Output is correct |
53 |
Correct |
7 ms |
9820 KB |
Output is correct |
54 |
Correct |
7 ms |
10076 KB |
Output is correct |
55 |
Correct |
7 ms |
9820 KB |
Output is correct |
56 |
Correct |
4 ms |
9648 KB |
Output is correct |
57 |
Correct |
3 ms |
9820 KB |
Output is correct |
58 |
Correct |
10 ms |
10076 KB |
Output is correct |
59 |
Correct |
3 ms |
9308 KB |
Output is correct |
60 |
Correct |
2 ms |
9308 KB |
Output is correct |
61 |
Correct |
4 ms |
9564 KB |
Output is correct |
62 |
Correct |
524 ms |
47632 KB |
Output is correct |
63 |
Correct |
359 ms |
42980 KB |
Output is correct |
64 |
Correct |
558 ms |
53444 KB |
Output is correct |
65 |
Correct |
698 ms |
60176 KB |
Output is correct |
66 |
Correct |
740 ms |
62072 KB |
Output is correct |
67 |
Correct |
761 ms |
62692 KB |
Output is correct |
68 |
Correct |
702 ms |
62148 KB |
Output is correct |
69 |
Correct |
720 ms |
61012 KB |
Output is correct |
70 |
Correct |
417 ms |
47940 KB |
Output is correct |
71 |
Correct |
419 ms |
48000 KB |
Output is correct |
72 |
Correct |
423 ms |
48136 KB |
Output is correct |
73 |
Correct |
53 ms |
33792 KB |
Output is correct |
74 |
Correct |
775 ms |
64724 KB |
Output is correct |
75 |
Correct |
112 ms |
19424 KB |
Output is correct |
76 |
Correct |
3 ms |
9308 KB |
Output is correct |
77 |
Correct |
410 ms |
25792 KB |
Output is correct |
78 |
Correct |
615 ms |
31052 KB |
Output is correct |
79 |
Correct |
523 ms |
29480 KB |
Output is correct |
80 |
Correct |
864 ms |
39364 KB |
Output is correct |
81 |
Correct |
818 ms |
39312 KB |
Output is correct |
82 |
Correct |
897 ms |
39464 KB |
Output is correct |
83 |
Correct |
912 ms |
39360 KB |
Output is correct |
84 |
Correct |
864 ms |
39688 KB |
Output is correct |
85 |
Correct |
878 ms |
39360 KB |
Output is correct |
86 |
Correct |
927 ms |
39032 KB |
Output is correct |
87 |
Correct |
902 ms |
39728 KB |
Output is correct |
88 |
Correct |
857 ms |
39604 KB |
Output is correct |
89 |
Correct |
865 ms |
40932 KB |
Output is correct |
90 |
Correct |
919 ms |
45128 KB |
Output is correct |
91 |
Correct |
954 ms |
40352 KB |
Output is correct |
92 |
Correct |
896 ms |
40620 KB |
Output is correct |
93 |
Correct |
856 ms |
40012 KB |
Output is correct |
94 |
Correct |
1083 ms |
44820 KB |
Output is correct |
95 |
Correct |
1134 ms |
45104 KB |
Output is correct |
96 |
Correct |
1223 ms |
44932 KB |
Output is correct |
97 |
Correct |
1083 ms |
44904 KB |
Output is correct |
98 |
Correct |
956 ms |
45148 KB |
Output is correct |
99 |
Correct |
1138 ms |
45176 KB |
Output is correct |
100 |
Correct |
1026 ms |
45000 KB |
Output is correct |
101 |
Correct |
1070 ms |
45008 KB |
Output is correct |
102 |
Correct |
1046 ms |
45336 KB |
Output is correct |
103 |
Correct |
1063 ms |
44864 KB |
Output is correct |
104 |
Correct |
1138 ms |
45160 KB |
Output is correct |
105 |
Correct |
1113 ms |
44988 KB |
Output is correct |
106 |
Correct |
1119 ms |
45620 KB |
Output is correct |
107 |
Correct |
1084 ms |
46364 KB |
Output is correct |
108 |
Correct |
1144 ms |
48320 KB |
Output is correct |
109 |
Correct |
1122 ms |
51304 KB |
Output is correct |
110 |
Correct |
3 ms |
9304 KB |
Output is correct |
111 |
Correct |
3 ms |
9308 KB |
Output is correct |
112 |
Correct |
4 ms |
9564 KB |
Output is correct |
113 |
Correct |
593 ms |
36908 KB |
Output is correct |
114 |
Correct |
607 ms |
37400 KB |
Output is correct |
115 |
Correct |
759 ms |
43640 KB |
Output is correct |
116 |
Correct |
771 ms |
46504 KB |
Output is correct |
117 |
Correct |
794 ms |
46684 KB |
Output is correct |
118 |
Correct |
770 ms |
46432 KB |
Output is correct |
119 |
Correct |
790 ms |
46860 KB |
Output is correct |
120 |
Correct |
771 ms |
46376 KB |
Output is correct |
121 |
Correct |
776 ms |
46768 KB |
Output is correct |
122 |
Correct |
804 ms |
46528 KB |
Output is correct |
123 |
Correct |
118 ms |
19456 KB |
Output is correct |
124 |
Correct |
765 ms |
41460 KB |
Output is correct |
125 |
Correct |
588 ms |
36732 KB |
Output is correct |
126 |
Correct |
1012 ms |
44060 KB |
Output is correct |
127 |
Correct |
947 ms |
43968 KB |
Output is correct |
128 |
Correct |
940 ms |
44344 KB |
Output is correct |
129 |
Correct |
951 ms |
43848 KB |
Output is correct |
130 |
Correct |
958 ms |
43776 KB |
Output is correct |
131 |
Correct |
940 ms |
59988 KB |
Output is correct |
132 |
Correct |
955 ms |
59792 KB |
Output is correct |
133 |
Correct |
984 ms |
62660 KB |
Output is correct |
134 |
Correct |
1230 ms |
49764 KB |
Output is correct |
135 |
Correct |
1160 ms |
49768 KB |
Output is correct |
136 |
Correct |
1263 ms |
49740 KB |
Output is correct |
137 |
Correct |
567 ms |
39232 KB |
Output is correct |
138 |
Correct |
574 ms |
39304 KB |
Output is correct |
139 |
Correct |
576 ms |
39312 KB |
Output is correct |
140 |
Correct |
604 ms |
39428 KB |
Output is correct |
141 |
Correct |
533 ms |
39276 KB |
Output is correct |
142 |
Correct |
609 ms |
39748 KB |
Output is correct |
143 |
Correct |
68 ms |
29712 KB |
Output is correct |
144 |
Correct |
1000 ms |
45656 KB |
Output is correct |