Submission #1070385

# Submission time Handle Problem Language Result Execution time Memory
1070385 2024-08-22T13:49:47 Z jerzyk Radio Towers (IOI22_towers) C++17
100 / 100
1180 ms 28356 KB
#include <bits/stdc++.h>
#include "towers.h"

using namespace std;
#define pb push_back
#define st first
#define nd second
typedef long long ll;
typedef long double ld;
const ll I = 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL;
const int II = 2 * 1000 * 1000 * 1000;
const ll M = 1000LL * 1000LL * 1000LL + 7LL;
const int N = 1<<17;
int drz[2 * N], drz2[2 * N], drz3[2 * N], drz4[2 * N];
int drzmi[2 * N], drzma[2 * N];
vector<int> mrg[2 * N];

int tab[N], ml[N], mr[N], cdi[N], tim[N];
set<int> cur;
set<int>::iterator it;
set<pair<int, int>> dif;


int FindL(int v, int a, int b, int pz, int kz, int x)
{
    if(a > kz || b < pz || drzma[v] < x) return N;
    if(v >= N) return v - N;
    int ans = FindL(v * 2, a, (a + b) / 2, pz, kz, x);
    if(ans < N) return ans;
    ans = FindL(v * 2 + 1, (a + b) / 2 + 1, b, pz, kz, x);
    return ans;
}

int FindR(int v, int a, int b, int pz, int kz, int x)
{
    if(a > kz || b < pz || drzma[v] < x) return 0;
    if(v >= N) return v - N;
    int ans = FindR(v * 2 + 1, (a + b) / 2 + 1, b, pz, kz, x);
    if(ans != 0) return ans;
    ans = FindR(v * 2, a, (a + b) / 2, pz, kz, x);
    return ans;
}

int FindXD(int a, int b, int k)
{
    vector<int> x, y;
    a += N - 1; b += N + 1;
    while(a / 2 != b / 2)
    {
        if(a % 2 == 0) x.pb(a + 1);
        if(b % 2 == 1) y.pb(b - 1);
        a /= 2; b /= 2;
    }
    reverse(y.begin(), y.end());
    for(int j = 0; j < (int)y.size(); ++j) x.pb(y[j]);
    int curmi = II;
    for(int i = 0; i < (int)x.size(); ++i)
    {
        if(drz3[x[i]] >= k || drz[x[i]] - curmi >= k)
        {
            int v = x[i];
            while(v < N)
            {
                v *= 2;
                if(!(drz3[v] >= k || drz[v] - curmi >= k))
                {
                    curmi = min(curmi, drz2[v]);
                    ++v;
                }
            }
            return v - N;
        }
        curmi = min(curmi, drz2[x[i]]);
    }
    return -1;
}

int FindXD2(int a, int b, int k)
{
    vector<int> x, y;
    a += N - 1; b += N + 1;
    while(a / 2 != b / 2)
    {
        if(a % 2 == 0) x.pb(a + 1);
        if(b % 2 == 1) y.pb(b - 1);
        a /= 2; b /= 2;
    }
    reverse(y.begin(), y.end());
    for(int j = 0; j < (int)y.size(); ++j) x.pb(y[j]);
    reverse(x.begin(), x.end());
    int curmi = II;
    for(int i = 0; i < (int)x.size(); ++i)
    {
        if(drz4[x[i]] >= k || drz[x[i]] - curmi >= k)
        {
            int v = x[i];
            while(v < N)
            {
                v = v * 2 + 1;
                if(!(drz4[v] >= k || drz[v] - curmi >= k))
                {
                    curmi = min(curmi, drz2[v]);
                    --v;
                }
            }
            return v - N;
        }
        curmi = min(curmi, drz2[x[i]]);
    }
    return -1;
}

bool ChkL(int a, int b, int k)
{
    //cerr << "Chkl: " << a << " " << b << "\n";
    vector<int> x, y;
    a += N - 1; b += N + 1;
    while(a / 2 != b / 2)
    {
        if(a % 2 == 0) x.pb(a + 1);
        if(b % 2 == 1) y.pb(b - 1);
        a /= 2; b /= 2;
    }
    reverse(y.begin(), y.end());
    for(int j = 0; j < (int)y.size(); ++j) x.pb(y[j]);
    int curmi = II;
    for(int i = 0; i < (int)x.size(); ++i)
    {
        if(drz3[x[i]] >= k) return true;
        if(drz[x[i]] - curmi >= k) return true;
        curmi = min(curmi, drz2[x[i]]);
    }
    return false;
}

bool ChkR(int a, int b, int k)
{
    vector<int> x, y;
    a += N - 1; b += N + 1;
    while(a / 2 != b / 2)
    {
        if(a % 2 == 0) x.pb(a + 1);
        if(b % 2 == 1) y.pb(b - 1);
        a /= 2; b /= 2;
    }
    reverse(y.begin(), y.end());
    for(int j = 0; j < (int)y.size(); ++j) x.pb(y[j]);
    int curma = 0;
    for(int i = 0; i < (int)x.size(); ++i)
    {
        if(drz4[x[i]] >= k) return true;
        if(curma - drz2[x[i]] >= k) return true;
        curma = max(curma, drz[x[i]]);
    }
    return false;
}

void DoT(int n)
{
    drz2[N] = II; drzmi[N] = II;
    for(int i = N; i < 2 * N; ++i)
    {
        drz3[i] = -II / 2;
        drz4[i] = -II / 2;
    }
    for(int i = 1; i <= n; ++i)
    {
        drzmi[i + N] = tim[i]; drzma[i + N] = tim[i];
        drz[i + N] = tab[i]; drz2[i + N] = tab[i];
        mrg[i + N] = {tim[i]};
    }
    for(int i = n + 1; i < N; ++i)
    {drzmi[i + N] = II; drz2[i + N] = II;}

    for(int i = N - 1; i >= 1; --i)
    {
        drzma[i] = max(drzma[2 * i], drzma[2 * i + 1]);
        drzmi[i] = min(drzmi[2 * i], drzmi[2 * i + 1]);

        drz[i] = max(drz[2 * i], drz[2 * i + 1]);
        drz2[i] = min(drz2[2 * i], drz2[2 * i + 1]);

        drz3[i] = max(drz3[i * 2], drz3[i * 2 + 1]);
        drz3[i] = max(drz3[i], drz[i * 2 + 1] - drz2[i * 2]);

        drz4[i] = max(drz4[i * 2], drz4[i * 2 + 1]);
        drz4[i] = max(drz4[i], drz[i * 2] - drz2[i * 2 + 1]);

        mrg[i] = mrg[i * 2];
        for(int j = 0; j < (int)mrg[i * 2 + 1].size(); ++j)
            mrg[i].pb(mrg[i * 2 + 1][j]);
        sort(mrg[i].begin(), mrg[i].end());
    }
}

inline int Il(int v, int x)
{
    return (mrg[v].end() - lower_bound(mrg[v].begin(), mrg[v].end(), x));
}

int Query(int a, int b, int x)
{
    a += N - 1; b += N + 1;
    int ans = 0;
    while(a / 2 != b / 2)
    {
        if(a % 2 == 0) ans += Il(a + 1, x);
        if(b % 2 == 1) ans += Il(b - 1, x);
        a /= 2; b /= 2;
    }

    return ans;
}

int GetL(int v)
{
    it = cur.lower_bound(v);
    if(it == cur.begin()) return 0;
    --it; return *it;
}

int GetR(int v)
{
    it = cur.upper_bound(v);
    if(it == cur.end()) return 0;
    return *it;
}

void init(int _N, vector<int> _H)
{
    int n = _N;
    for(int i = 1; i <= n; ++i) tab[i] = _H[i - 1];
    for(int i = 1; i <= n; ++i)
    {
        ml[i] = 0LL; mr[i] = 0LL;
        cur.insert(i);
    }
    ml[1] = II; mr[n] = II;
    for(int i = 1; i <= n; ++i)
    {
        cdi[i] = min(ml[i], mr[i]) - tab[i];
        dif.insert(make_pair(cdi[i], i));
    }
    while((int)cur.size() > 1)
    {
        int v = (*dif.begin()).nd;
        dif.erase(dif.begin());
        cur.erase(v);
        tim[v] = cdi[v];
        int l = GetL(v), r = GetR(v);
        int xd = max(tab[v], max(mr[v], ml[v]));
        if(l != 0)
        {
            dif.erase(make_pair(cdi[l], l));
            mr[l] = max(mr[l], xd);
            cdi[l] = min(ml[l], mr[l]) - tab[l];
            dif.insert(make_pair(cdi[l], l));
        }
        if(r != 0)
        {
            dif.erase(make_pair(cdi[r], r));
            ml[r] = max(ml[r], xd);
            cdi[r] = min(ml[r], mr[r]) - tab[r];
            dif.insert(make_pair(cdi[r], r));
        }
    }
    for(int i = 1; i <= n; ++i)
        tim[i] = max(tim[i], 0);
    tim[*cur.begin()] = II;
    DoT(n);
    //for(int i = 1; i <= n; ++i)
        //cerr << tim[i] << " ";
    //cerr << "\n";
}

int max_towers(int L, int R, int D)
{
    ++L; ++R;
    int ans = Query(L, R, D);
    if(ans == 0)
    {
        int p = FindXD(L, R, D);
        int p2 = FindXD2(L, R, D);
        //cerr << "Find: " << p << " " << QueryMI(p + 1, R) << "\n";
        if(p == -1 || p2 == -1) return 1;
        if(p <= p2) return 2;
        return 1;
    }
    int l = FindL(1, 0, N - 1, L, R, D);
    int r = FindR(1, 0, N - 1, L, R, D);
    //cerr << "Que: " << l << " " << r << "\n";
    if(l != L && ChkL(L, l - 1, D)) ++ans;
    if(r != R && ChkR(r + 1, R, D)) ++ans;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 453 ms 22572 KB Output is correct
2 Correct 946 ms 28108 KB Output is correct
3 Correct 997 ms 28104 KB Output is correct
4 Correct 875 ms 28104 KB Output is correct
5 Correct 908 ms 28064 KB Output is correct
6 Correct 979 ms 28100 KB Output is correct
7 Correct 912 ms 28104 KB Output is correct
8 Correct 3 ms 14680 KB Output is correct
9 Correct 4 ms 14936 KB Output is correct
10 Correct 4 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14680 KB Output is correct
2 Correct 6 ms 15184 KB Output is correct
3 Correct 7 ms 15192 KB Output is correct
4 Correct 6 ms 15192 KB Output is correct
5 Correct 8 ms 15036 KB Output is correct
6 Correct 5 ms 15192 KB Output is correct
7 Correct 7 ms 15192 KB Output is correct
8 Correct 4 ms 14936 KB Output is correct
9 Correct 4 ms 14936 KB Output is correct
10 Correct 4 ms 15072 KB Output is correct
11 Correct 4 ms 15104 KB Output is correct
12 Correct 3 ms 14680 KB Output is correct
13 Correct 4 ms 14936 KB Output is correct
14 Correct 4 ms 14936 KB Output is correct
15 Correct 5 ms 15192 KB Output is correct
16 Correct 6 ms 15100 KB Output is correct
17 Correct 6 ms 15192 KB Output is correct
18 Correct 4 ms 14936 KB Output is correct
19 Correct 5 ms 15028 KB Output is correct
20 Correct 7 ms 15192 KB Output is correct
21 Correct 6 ms 15004 KB Output is correct
22 Correct 6 ms 15192 KB Output is correct
23 Correct 5 ms 14936 KB Output is correct
24 Correct 5 ms 14936 KB Output is correct
25 Correct 4 ms 14936 KB Output is correct
26 Correct 5 ms 15192 KB Output is correct
27 Correct 5 ms 15120 KB Output is correct
28 Correct 6 ms 15192 KB Output is correct
29 Correct 6 ms 15192 KB Output is correct
30 Correct 6 ms 15192 KB Output is correct
31 Correct 6 ms 15192 KB Output is correct
32 Correct 4 ms 14936 KB Output is correct
33 Correct 7 ms 14932 KB Output is correct
34 Correct 4 ms 14936 KB Output is correct
35 Correct 4 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14680 KB Output is correct
2 Correct 6 ms 15184 KB Output is correct
3 Correct 7 ms 15192 KB Output is correct
4 Correct 6 ms 15192 KB Output is correct
5 Correct 8 ms 15036 KB Output is correct
6 Correct 5 ms 15192 KB Output is correct
7 Correct 7 ms 15192 KB Output is correct
8 Correct 4 ms 14936 KB Output is correct
9 Correct 4 ms 14936 KB Output is correct
10 Correct 4 ms 15072 KB Output is correct
11 Correct 4 ms 15104 KB Output is correct
12 Correct 3 ms 14680 KB Output is correct
13 Correct 4 ms 14936 KB Output is correct
14 Correct 4 ms 14936 KB Output is correct
15 Correct 5 ms 15192 KB Output is correct
16 Correct 6 ms 15100 KB Output is correct
17 Correct 6 ms 15192 KB Output is correct
18 Correct 4 ms 14936 KB Output is correct
19 Correct 5 ms 15028 KB Output is correct
20 Correct 7 ms 15192 KB Output is correct
21 Correct 6 ms 15004 KB Output is correct
22 Correct 6 ms 15192 KB Output is correct
23 Correct 5 ms 14936 KB Output is correct
24 Correct 5 ms 14936 KB Output is correct
25 Correct 4 ms 14936 KB Output is correct
26 Correct 5 ms 15192 KB Output is correct
27 Correct 5 ms 15120 KB Output is correct
28 Correct 6 ms 15192 KB Output is correct
29 Correct 6 ms 15192 KB Output is correct
30 Correct 6 ms 15192 KB Output is correct
31 Correct 6 ms 15192 KB Output is correct
32 Correct 4 ms 14936 KB Output is correct
33 Correct 7 ms 14932 KB Output is correct
34 Correct 4 ms 14936 KB Output is correct
35 Correct 4 ms 14936 KB Output is correct
36 Correct 136 ms 23232 KB Output is correct
37 Correct 225 ms 28052 KB Output is correct
38 Correct 210 ms 28060 KB Output is correct
39 Correct 248 ms 27908 KB Output is correct
40 Correct 232 ms 27972 KB Output is correct
41 Correct 222 ms 27916 KB Output is correct
42 Correct 225 ms 28064 KB Output is correct
43 Correct 76 ms 28104 KB Output is correct
44 Correct 78 ms 27928 KB Output is correct
45 Correct 90 ms 28104 KB Output is correct
46 Correct 108 ms 27984 KB Output is correct
47 Correct 218 ms 28064 KB Output is correct
48 Correct 230 ms 28060 KB Output is correct
49 Correct 223 ms 28100 KB Output is correct
50 Correct 100 ms 28104 KB Output is correct
51 Correct 91 ms 27916 KB Output is correct
52 Correct 214 ms 28216 KB Output is correct
53 Correct 224 ms 28100 KB Output is correct
54 Correct 226 ms 28060 KB Output is correct
55 Correct 96 ms 28060 KB Output is correct
56 Correct 85 ms 27884 KB Output is correct
57 Correct 207 ms 27528 KB Output is correct
58 Correct 211 ms 28104 KB Output is correct
59 Correct 211 ms 28104 KB Output is correct
60 Correct 221 ms 28108 KB Output is correct
61 Correct 218 ms 28048 KB Output is correct
62 Correct 238 ms 27964 KB Output is correct
63 Correct 221 ms 28104 KB Output is correct
64 Correct 77 ms 28104 KB Output is correct
65 Correct 78 ms 28104 KB Output is correct
66 Correct 86 ms 28104 KB Output is correct
67 Correct 96 ms 28104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 800 ms 27848 KB Output is correct
2 Correct 1004 ms 27892 KB Output is correct
3 Correct 982 ms 28356 KB Output is correct
4 Correct 965 ms 28104 KB Output is correct
5 Correct 996 ms 28104 KB Output is correct
6 Correct 863 ms 27916 KB Output is correct
7 Correct 850 ms 27924 KB Output is correct
8 Correct 864 ms 27908 KB Output is correct
9 Correct 887 ms 28104 KB Output is correct
10 Correct 923 ms 28108 KB Output is correct
11 Correct 889 ms 28108 KB Output is correct
12 Correct 878 ms 28104 KB Output is correct
13 Correct 928 ms 27952 KB Output is correct
14 Correct 3 ms 14680 KB Output is correct
15 Correct 5 ms 14936 KB Output is correct
16 Correct 4 ms 14936 KB Output is correct
17 Correct 249 ms 28060 KB Output is correct
18 Correct 227 ms 28104 KB Output is correct
19 Correct 226 ms 28104 KB Output is correct
20 Correct 76 ms 28104 KB Output is correct
21 Correct 90 ms 28104 KB Output is correct
22 Correct 213 ms 28104 KB Output is correct
23 Correct 234 ms 28060 KB Output is correct
24 Correct 225 ms 28036 KB Output is correct
25 Correct 78 ms 28108 KB Output is correct
26 Correct 89 ms 28104 KB Output is correct
27 Correct 6 ms 15192 KB Output is correct
28 Correct 6 ms 15192 KB Output is correct
29 Correct 5 ms 15192 KB Output is correct
30 Correct 4 ms 14936 KB Output is correct
31 Correct 4 ms 14936 KB Output is correct
32 Correct 6 ms 15192 KB Output is correct
33 Correct 5 ms 15192 KB Output is correct
34 Correct 5 ms 15192 KB Output is correct
35 Correct 4 ms 14936 KB Output is correct
36 Correct 4 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 265 ms 18000 KB Output is correct
2 Correct 1024 ms 28104 KB Output is correct
3 Correct 1006 ms 28104 KB Output is correct
4 Correct 1064 ms 28104 KB Output is correct
5 Correct 1060 ms 28104 KB Output is correct
6 Correct 1032 ms 27904 KB Output is correct
7 Correct 1049 ms 28104 KB Output is correct
8 Correct 845 ms 28104 KB Output is correct
9 Correct 757 ms 28104 KB Output is correct
10 Correct 769 ms 27952 KB Output is correct
11 Correct 756 ms 28056 KB Output is correct
12 Correct 236 ms 28116 KB Output is correct
13 Correct 243 ms 28064 KB Output is correct
14 Correct 246 ms 27972 KB Output is correct
15 Correct 74 ms 28104 KB Output is correct
16 Correct 85 ms 27908 KB Output is correct
17 Correct 213 ms 27452 KB Output is correct
18 Correct 247 ms 28064 KB Output is correct
19 Correct 257 ms 28052 KB Output is correct
20 Correct 253 ms 28060 KB Output is correct
21 Correct 239 ms 27896 KB Output is correct
22 Correct 240 ms 28104 KB Output is correct
23 Correct 240 ms 28032 KB Output is correct
24 Correct 88 ms 28104 KB Output is correct
25 Correct 90 ms 28100 KB Output is correct
26 Correct 107 ms 28100 KB Output is correct
27 Correct 101 ms 28104 KB Output is correct
28 Correct 6 ms 15004 KB Output is correct
29 Correct 6 ms 15192 KB Output is correct
30 Correct 7 ms 15192 KB Output is correct
31 Correct 4 ms 14936 KB Output is correct
32 Correct 5 ms 14936 KB Output is correct
33 Correct 5 ms 14936 KB Output is correct
34 Correct 8 ms 15192 KB Output is correct
35 Correct 6 ms 15076 KB Output is correct
36 Correct 6 ms 15192 KB Output is correct
37 Correct 5 ms 15192 KB Output is correct
38 Correct 5 ms 15192 KB Output is correct
39 Correct 5 ms 15108 KB Output is correct
40 Correct 4 ms 14936 KB Output is correct
41 Correct 3 ms 14936 KB Output is correct
42 Correct 6 ms 14936 KB Output is correct
43 Correct 5 ms 14936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 14680 KB Output is correct
2 Correct 6 ms 15184 KB Output is correct
3 Correct 7 ms 15192 KB Output is correct
4 Correct 6 ms 15192 KB Output is correct
5 Correct 8 ms 15036 KB Output is correct
6 Correct 5 ms 15192 KB Output is correct
7 Correct 7 ms 15192 KB Output is correct
8 Correct 4 ms 14936 KB Output is correct
9 Correct 4 ms 14936 KB Output is correct
10 Correct 4 ms 15072 KB Output is correct
11 Correct 4 ms 15104 KB Output is correct
12 Correct 3 ms 14680 KB Output is correct
13 Correct 4 ms 14936 KB Output is correct
14 Correct 4 ms 14936 KB Output is correct
15 Correct 5 ms 15192 KB Output is correct
16 Correct 6 ms 15100 KB Output is correct
17 Correct 6 ms 15192 KB Output is correct
18 Correct 4 ms 14936 KB Output is correct
19 Correct 5 ms 15028 KB Output is correct
20 Correct 7 ms 15192 KB Output is correct
21 Correct 6 ms 15004 KB Output is correct
22 Correct 6 ms 15192 KB Output is correct
23 Correct 5 ms 14936 KB Output is correct
24 Correct 5 ms 14936 KB Output is correct
25 Correct 4 ms 14936 KB Output is correct
26 Correct 5 ms 15192 KB Output is correct
27 Correct 5 ms 15120 KB Output is correct
28 Correct 6 ms 15192 KB Output is correct
29 Correct 6 ms 15192 KB Output is correct
30 Correct 6 ms 15192 KB Output is correct
31 Correct 6 ms 15192 KB Output is correct
32 Correct 4 ms 14936 KB Output is correct
33 Correct 7 ms 14932 KB Output is correct
34 Correct 4 ms 14936 KB Output is correct
35 Correct 4 ms 14936 KB Output is correct
36 Correct 136 ms 23232 KB Output is correct
37 Correct 225 ms 28052 KB Output is correct
38 Correct 210 ms 28060 KB Output is correct
39 Correct 248 ms 27908 KB Output is correct
40 Correct 232 ms 27972 KB Output is correct
41 Correct 222 ms 27916 KB Output is correct
42 Correct 225 ms 28064 KB Output is correct
43 Correct 76 ms 28104 KB Output is correct
44 Correct 78 ms 27928 KB Output is correct
45 Correct 90 ms 28104 KB Output is correct
46 Correct 108 ms 27984 KB Output is correct
47 Correct 218 ms 28064 KB Output is correct
48 Correct 230 ms 28060 KB Output is correct
49 Correct 223 ms 28100 KB Output is correct
50 Correct 100 ms 28104 KB Output is correct
51 Correct 91 ms 27916 KB Output is correct
52 Correct 214 ms 28216 KB Output is correct
53 Correct 224 ms 28100 KB Output is correct
54 Correct 226 ms 28060 KB Output is correct
55 Correct 96 ms 28060 KB Output is correct
56 Correct 85 ms 27884 KB Output is correct
57 Correct 207 ms 27528 KB Output is correct
58 Correct 211 ms 28104 KB Output is correct
59 Correct 211 ms 28104 KB Output is correct
60 Correct 221 ms 28108 KB Output is correct
61 Correct 218 ms 28048 KB Output is correct
62 Correct 238 ms 27964 KB Output is correct
63 Correct 221 ms 28104 KB Output is correct
64 Correct 77 ms 28104 KB Output is correct
65 Correct 78 ms 28104 KB Output is correct
66 Correct 86 ms 28104 KB Output is correct
67 Correct 96 ms 28104 KB Output is correct
68 Correct 800 ms 27848 KB Output is correct
69 Correct 1004 ms 27892 KB Output is correct
70 Correct 982 ms 28356 KB Output is correct
71 Correct 965 ms 28104 KB Output is correct
72 Correct 996 ms 28104 KB Output is correct
73 Correct 863 ms 27916 KB Output is correct
74 Correct 850 ms 27924 KB Output is correct
75 Correct 864 ms 27908 KB Output is correct
76 Correct 887 ms 28104 KB Output is correct
77 Correct 923 ms 28108 KB Output is correct
78 Correct 889 ms 28108 KB Output is correct
79 Correct 878 ms 28104 KB Output is correct
80 Correct 928 ms 27952 KB Output is correct
81 Correct 3 ms 14680 KB Output is correct
82 Correct 5 ms 14936 KB Output is correct
83 Correct 4 ms 14936 KB Output is correct
84 Correct 249 ms 28060 KB Output is correct
85 Correct 227 ms 28104 KB Output is correct
86 Correct 226 ms 28104 KB Output is correct
87 Correct 76 ms 28104 KB Output is correct
88 Correct 90 ms 28104 KB Output is correct
89 Correct 213 ms 28104 KB Output is correct
90 Correct 234 ms 28060 KB Output is correct
91 Correct 225 ms 28036 KB Output is correct
92 Correct 78 ms 28108 KB Output is correct
93 Correct 89 ms 28104 KB Output is correct
94 Correct 6 ms 15192 KB Output is correct
95 Correct 6 ms 15192 KB Output is correct
96 Correct 5 ms 15192 KB Output is correct
97 Correct 4 ms 14936 KB Output is correct
98 Correct 4 ms 14936 KB Output is correct
99 Correct 6 ms 15192 KB Output is correct
100 Correct 5 ms 15192 KB Output is correct
101 Correct 5 ms 15192 KB Output is correct
102 Correct 4 ms 14936 KB Output is correct
103 Correct 4 ms 14936 KB Output is correct
104 Correct 852 ms 26572 KB Output is correct
105 Correct 1052 ms 27940 KB Output is correct
106 Correct 986 ms 28100 KB Output is correct
107 Correct 1047 ms 28104 KB Output is correct
108 Correct 1109 ms 28076 KB Output is correct
109 Correct 952 ms 28104 KB Output is correct
110 Correct 909 ms 28064 KB Output is correct
111 Correct 871 ms 28112 KB Output is correct
112 Correct 866 ms 28104 KB Output is correct
113 Correct 962 ms 28092 KB Output is correct
114 Correct 900 ms 27944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 453 ms 22572 KB Output is correct
2 Correct 946 ms 28108 KB Output is correct
3 Correct 997 ms 28104 KB Output is correct
4 Correct 875 ms 28104 KB Output is correct
5 Correct 908 ms 28064 KB Output is correct
6 Correct 979 ms 28100 KB Output is correct
7 Correct 912 ms 28104 KB Output is correct
8 Correct 3 ms 14680 KB Output is correct
9 Correct 4 ms 14936 KB Output is correct
10 Correct 4 ms 14936 KB Output is correct
11 Correct 3 ms 14680 KB Output is correct
12 Correct 6 ms 15184 KB Output is correct
13 Correct 7 ms 15192 KB Output is correct
14 Correct 6 ms 15192 KB Output is correct
15 Correct 8 ms 15036 KB Output is correct
16 Correct 5 ms 15192 KB Output is correct
17 Correct 7 ms 15192 KB Output is correct
18 Correct 4 ms 14936 KB Output is correct
19 Correct 4 ms 14936 KB Output is correct
20 Correct 4 ms 15072 KB Output is correct
21 Correct 4 ms 15104 KB Output is correct
22 Correct 3 ms 14680 KB Output is correct
23 Correct 4 ms 14936 KB Output is correct
24 Correct 4 ms 14936 KB Output is correct
25 Correct 5 ms 15192 KB Output is correct
26 Correct 6 ms 15100 KB Output is correct
27 Correct 6 ms 15192 KB Output is correct
28 Correct 4 ms 14936 KB Output is correct
29 Correct 5 ms 15028 KB Output is correct
30 Correct 7 ms 15192 KB Output is correct
31 Correct 6 ms 15004 KB Output is correct
32 Correct 6 ms 15192 KB Output is correct
33 Correct 5 ms 14936 KB Output is correct
34 Correct 5 ms 14936 KB Output is correct
35 Correct 4 ms 14936 KB Output is correct
36 Correct 5 ms 15192 KB Output is correct
37 Correct 5 ms 15120 KB Output is correct
38 Correct 6 ms 15192 KB Output is correct
39 Correct 6 ms 15192 KB Output is correct
40 Correct 6 ms 15192 KB Output is correct
41 Correct 6 ms 15192 KB Output is correct
42 Correct 4 ms 14936 KB Output is correct
43 Correct 7 ms 14932 KB Output is correct
44 Correct 4 ms 14936 KB Output is correct
45 Correct 4 ms 14936 KB Output is correct
46 Correct 136 ms 23232 KB Output is correct
47 Correct 225 ms 28052 KB Output is correct
48 Correct 210 ms 28060 KB Output is correct
49 Correct 248 ms 27908 KB Output is correct
50 Correct 232 ms 27972 KB Output is correct
51 Correct 222 ms 27916 KB Output is correct
52 Correct 225 ms 28064 KB Output is correct
53 Correct 76 ms 28104 KB Output is correct
54 Correct 78 ms 27928 KB Output is correct
55 Correct 90 ms 28104 KB Output is correct
56 Correct 108 ms 27984 KB Output is correct
57 Correct 218 ms 28064 KB Output is correct
58 Correct 230 ms 28060 KB Output is correct
59 Correct 223 ms 28100 KB Output is correct
60 Correct 100 ms 28104 KB Output is correct
61 Correct 91 ms 27916 KB Output is correct
62 Correct 214 ms 28216 KB Output is correct
63 Correct 224 ms 28100 KB Output is correct
64 Correct 226 ms 28060 KB Output is correct
65 Correct 96 ms 28060 KB Output is correct
66 Correct 85 ms 27884 KB Output is correct
67 Correct 207 ms 27528 KB Output is correct
68 Correct 211 ms 28104 KB Output is correct
69 Correct 211 ms 28104 KB Output is correct
70 Correct 221 ms 28108 KB Output is correct
71 Correct 218 ms 28048 KB Output is correct
72 Correct 238 ms 27964 KB Output is correct
73 Correct 221 ms 28104 KB Output is correct
74 Correct 77 ms 28104 KB Output is correct
75 Correct 78 ms 28104 KB Output is correct
76 Correct 86 ms 28104 KB Output is correct
77 Correct 96 ms 28104 KB Output is correct
78 Correct 800 ms 27848 KB Output is correct
79 Correct 1004 ms 27892 KB Output is correct
80 Correct 982 ms 28356 KB Output is correct
81 Correct 965 ms 28104 KB Output is correct
82 Correct 996 ms 28104 KB Output is correct
83 Correct 863 ms 27916 KB Output is correct
84 Correct 850 ms 27924 KB Output is correct
85 Correct 864 ms 27908 KB Output is correct
86 Correct 887 ms 28104 KB Output is correct
87 Correct 923 ms 28108 KB Output is correct
88 Correct 889 ms 28108 KB Output is correct
89 Correct 878 ms 28104 KB Output is correct
90 Correct 928 ms 27952 KB Output is correct
91 Correct 3 ms 14680 KB Output is correct
92 Correct 5 ms 14936 KB Output is correct
93 Correct 4 ms 14936 KB Output is correct
94 Correct 249 ms 28060 KB Output is correct
95 Correct 227 ms 28104 KB Output is correct
96 Correct 226 ms 28104 KB Output is correct
97 Correct 76 ms 28104 KB Output is correct
98 Correct 90 ms 28104 KB Output is correct
99 Correct 213 ms 28104 KB Output is correct
100 Correct 234 ms 28060 KB Output is correct
101 Correct 225 ms 28036 KB Output is correct
102 Correct 78 ms 28108 KB Output is correct
103 Correct 89 ms 28104 KB Output is correct
104 Correct 6 ms 15192 KB Output is correct
105 Correct 6 ms 15192 KB Output is correct
106 Correct 5 ms 15192 KB Output is correct
107 Correct 4 ms 14936 KB Output is correct
108 Correct 4 ms 14936 KB Output is correct
109 Correct 6 ms 15192 KB Output is correct
110 Correct 5 ms 15192 KB Output is correct
111 Correct 5 ms 15192 KB Output is correct
112 Correct 4 ms 14936 KB Output is correct
113 Correct 4 ms 14936 KB Output is correct
114 Correct 265 ms 18000 KB Output is correct
115 Correct 1024 ms 28104 KB Output is correct
116 Correct 1006 ms 28104 KB Output is correct
117 Correct 1064 ms 28104 KB Output is correct
118 Correct 1060 ms 28104 KB Output is correct
119 Correct 1032 ms 27904 KB Output is correct
120 Correct 1049 ms 28104 KB Output is correct
121 Correct 845 ms 28104 KB Output is correct
122 Correct 757 ms 28104 KB Output is correct
123 Correct 769 ms 27952 KB Output is correct
124 Correct 756 ms 28056 KB Output is correct
125 Correct 236 ms 28116 KB Output is correct
126 Correct 243 ms 28064 KB Output is correct
127 Correct 246 ms 27972 KB Output is correct
128 Correct 74 ms 28104 KB Output is correct
129 Correct 85 ms 27908 KB Output is correct
130 Correct 213 ms 27452 KB Output is correct
131 Correct 247 ms 28064 KB Output is correct
132 Correct 257 ms 28052 KB Output is correct
133 Correct 253 ms 28060 KB Output is correct
134 Correct 239 ms 27896 KB Output is correct
135 Correct 240 ms 28104 KB Output is correct
136 Correct 240 ms 28032 KB Output is correct
137 Correct 88 ms 28104 KB Output is correct
138 Correct 90 ms 28100 KB Output is correct
139 Correct 107 ms 28100 KB Output is correct
140 Correct 101 ms 28104 KB Output is correct
141 Correct 6 ms 15004 KB Output is correct
142 Correct 6 ms 15192 KB Output is correct
143 Correct 7 ms 15192 KB Output is correct
144 Correct 4 ms 14936 KB Output is correct
145 Correct 5 ms 14936 KB Output is correct
146 Correct 5 ms 14936 KB Output is correct
147 Correct 8 ms 15192 KB Output is correct
148 Correct 6 ms 15076 KB Output is correct
149 Correct 6 ms 15192 KB Output is correct
150 Correct 5 ms 15192 KB Output is correct
151 Correct 5 ms 15192 KB Output is correct
152 Correct 5 ms 15108 KB Output is correct
153 Correct 4 ms 14936 KB Output is correct
154 Correct 3 ms 14936 KB Output is correct
155 Correct 6 ms 14936 KB Output is correct
156 Correct 5 ms 14936 KB Output is correct
157 Correct 852 ms 26572 KB Output is correct
158 Correct 1052 ms 27940 KB Output is correct
159 Correct 986 ms 28100 KB Output is correct
160 Correct 1047 ms 28104 KB Output is correct
161 Correct 1109 ms 28076 KB Output is correct
162 Correct 952 ms 28104 KB Output is correct
163 Correct 909 ms 28064 KB Output is correct
164 Correct 871 ms 28112 KB Output is correct
165 Correct 866 ms 28104 KB Output is correct
166 Correct 962 ms 28092 KB Output is correct
167 Correct 900 ms 27944 KB Output is correct
168 Correct 3 ms 14680 KB Output is correct
169 Correct 598 ms 19408 KB Output is correct
170 Correct 1056 ms 28104 KB Output is correct
171 Correct 1180 ms 28104 KB Output is correct
172 Correct 1093 ms 27944 KB Output is correct
173 Correct 1122 ms 27884 KB Output is correct
174 Correct 1140 ms 28104 KB Output is correct
175 Correct 1164 ms 27968 KB Output is correct
176 Correct 986 ms 28100 KB Output is correct
177 Correct 939 ms 28064 KB Output is correct
178 Correct 980 ms 28104 KB Output is correct
179 Correct 888 ms 28104 KB Output is correct