Submission #1099844

# Submission time Handle Problem Language Result Execution time Memory
1099844 2024-10-12T05:35:24 Z model_code Hieroglyphs (IOI24_hieroglyphs) C++17
100 / 100
423 ms 20216 KB
// correct/author-full.cpp

#include "hieroglyphs.h"
#include<bits/stdc++.h>

using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;

//erases non-common elements
void clean(vi& a, vi& b) {
    vi ap;
    vi bp;
    set<int> as;
    set<int> bs;
    for (int x : a) as.insert(x);
    for (int x : b) bs.insert(x);
    for (int x : a) if (bs.count(x)) ap.push_back(x);
    for (int x : b) if (as.count(x)) bp.push_back(x);
    swap(a, ap);
    swap(b, bp);
}

map<int, int> coordinate_compress(vi& a, vi& b) {
    int cc = 0;
    map<int, int> mp;
    map<int, int> rmp;
    for (int& x : a) {
        if (!mp.count(x)) {
            mp[x] = cc++;
            rmp[mp[x]] = x;
        }
        x = mp[x];
    }
    for (int& x : b) {
        if (!mp.count(x)) {
            mp[x] = cc++;
            rmp[mp[x]] = x;
        }
        x = mp[x];
    }
    return rmp;
}

bool is_subsequence(const vi& a, const vi& b) {
    int j = 0;
    for (int x : a) {
        if (j < (int)b.size() && b[j] == x) {
            j++;
        }
    }
    return j == (int)b.size();
}

vector<int> get_candidate(vector<int> a, vector<int> b) {
    int n = a.size();
    int m = b.size();

    vi occ_a(max(n, m)+1, 0);
    vi occ_b(max(n, m)+1, 0);
    for (int i=0; i < n; ++i) {
        occ_a[a[i]]++;
    }
    for (int i=0; i < m; ++i) {
        occ_b[b[i]]++;
    }

    vi c;
    queue<int> qa;
    queue<int> qb;

    for (int i=0; i < n; ++i) {
        if (occ_a[a[i]] <= occ_b[a[i]]) {
            qa.push(i);
        }
    }
    for (int i=0; i < m; ++i) {
        if (occ_a[b[i]] > occ_b[b[i]]) {
            qb.push(i);
        }
    }

    int i_a_curr = 0;
    int i_b_curr = 0;
    int i_a_next = 0;
    int i_b_next = 0;
    vi occ_a_curr = vi(occ_a);
    vi occ_a_next = vi(occ_a);
    vi occ_b_curr = vi(occ_b);
    vi occ_b_next = vi(occ_b);

    while(!qa.empty() && !qb.empty()) {
        while(i_a_next < qa.front()) {
            occ_a_next[a[i_a_next]]--;
            i_a_next++;
        }
        while(i_b_next < qb.front()) {
            occ_b_next[b[i_b_next]]--;
            i_b_next++;
        }

        int x = a[i_a_next];
        int y = b[i_b_next];

        int occ_x = occ_a_next[x];
        int occ_y = occ_b_next[y];

        bool a_good = (occ_a_next[y] >= occ_y && occ_b_curr[x] > occ_b_next[x]);
        bool b_good = (occ_b_next[x] >= occ_x && occ_a_curr[y] > occ_a_next[y]);

        if (a_good && b_good) return vi();
        if (!a_good && !b_good) return vi();

        if(a_good) {
            c.push_back(x);
            qa.pop();
            while(i_a_curr <= i_a_next) {
                occ_a_curr[a[i_a_curr]]--;
                i_a_curr++;
            }
            while(b[i_b_curr] != x) {
                occ_b_curr[b[i_b_curr]]--;
                i_b_curr++;
            }
            occ_b_curr[b[i_b_curr]]--;
            i_b_curr++;
        }
        else {
            c.push_back(y);
            qb.pop();
            while(i_b_curr <= i_b_next) {
                occ_b_curr[b[i_b_curr]]--;
                i_b_curr++;
            }
            while(a[i_a_curr] != y) {
                occ_a_curr[a[i_a_curr]]--;
                i_a_curr++;
            }
            occ_a_curr[a[i_a_curr]]--;
            i_a_curr++;
        }
    }

    while(!qa.empty()) {
        c.push_back(a[qa.front()]);
        qa.pop();
    }
    while(!qb.empty()) {
        c.push_back(b[qb.front()]);
        qb.pop();
    }

    return ((is_subsequence(a, c) && is_subsequence(b, c)) ? c : vi());
}




//returns v of size |b|
//v[i] = smallest index so that there exists a common subsequence of a[0..v[i]] and b[0..i] that is not
// a common subsequence of a[0..v[i]] and b[0..i-1]. if such index does not exist, v[i] = |a|
vector<int> index_vector(const vi& a, const vi& b) {
    int n = a.size();
    int m = b.size();
    vi v(m);
    int max_v = 0;
    for (int x : a) max_v = max(x, max_v);
    for (int x : b) max_v = max(x, max_v);
    vi prev_occ_b(max_v+1, -1);
    vvi a_occ(max_v+1);
    for (int i=0; i < n; ++i) {
        a_occ[a[i]].push_back(i);
    }
    for (int i=0; i <= max_v; ++i) {
        a_occ[i].push_back(n);
    }
    vector<pair<int, int>> min_stack;
    for (int i=0; i < m; ++i) {
        if (prev_occ_b[b[i]] == -1) {
            v[i] = a_occ[b[i]][0];
        }
        else {
            int min_val = lower_bound(min_stack.begin(), min_stack.end(), pair<int, int>(prev_occ_b[b[i]], -1))->second;
            if (min_val < n) v[i] = *lower_bound(a_occ[b[i]].begin(), a_occ[b[i]].end(), min_val+1);
            else v[i] = n;
        }
        while(!min_stack.empty() && min_stack.back().second >= v[i]) {
            min_stack.pop_back();
        }
        min_stack.emplace_back(i, v[i]);
        prev_occ_b[b[i]] = i;
    }
    return v; 
}

// RMQ template from KACTL
template<class T>
struct RMQ {
	vector<vector<T>> jmp;
	RMQ(const vector<T>& V) : jmp(1, V) {
		for (int pw = 1, k = 1; pw * 2 <= (int)V.size(); pw *= 2, ++k) {
			jmp.emplace_back((int)V.size() - pw * 2 + 1);
			for (int j=0; j < (int)jmp[k].size(); ++j)
				jmp[k][j] = min(jmp[k - 1][j], jmp[k - 1][j + pw]);
		}
	}
	T query(int a, int b) {
		int dep = 31 - __builtin_clz(b - a);
		return min(jmp[dep][a], jmp[dep][b - (1 << dep)]);
	}
};

bool no_single_crossing(const vi& a, const vi& b, const vi& c) {
    int n = a.size();
    int m = b.size();
    int l = c.size(); 

    vi rb = vi(b);
    reverse(rb.begin(), rb.end());

    vi rc = vi(c);
    reverse(rc.begin(), rc.end());

    vi v_ab = index_vector(a, b);
    vi v_rbc = index_vector(rb, rc);
    
    RMQ<int> v_rbc_rmq = RMQ<int>(v_rbc);

    vi v_max_rc_i(n+1);
    v_max_rc_i[n] = 0;
    for (int i=n-1; i >= 0; --i) {
        v_max_rc_i[i] = v_max_rc_i[i+1];
        if (a[i] == rc[v_max_rc_i[i+1]]) {
            v_max_rc_i[i]++;
        }
        if (v_max_rc_i[i] > l) v_max_rc_i[i] = l;
    }
    vi v_min_rc_i(m+1);
    v_min_rc_i[0] = l-1;
    for (int i=0; i < m; ++i) {
        v_min_rc_i[i+1] = v_min_rc_i[i];
        if (b[i] == rc[v_min_rc_i[i]]) {
            v_min_rc_i[i+1]--;
        }
        if (v_min_rc_i[i] < -1) v_min_rc_i[i] = -1;
    }

    for (int j=0; j < m; ++j) {
        int ai = v_ab[j];
        if (ai == n) continue;
        int min_rc_i = v_min_rc_i[j+1];
        int max_rc_i = v_max_rc_i[ai+1];
        if (min_rc_i+1 < max_rc_i && v_rbc_rmq.query(min_rc_i+1, max_rc_i) + j < m-1) return false;
    }
    return true;
}

bool verify(const vi& a, const vi& b, const vi& c) {
    if (c.empty()) return false;
    return no_single_crossing(a, b, c) && no_single_crossing(b, a, c);    
}

vector<int> ucs(vector<int> a, vector<int> b) {
    clean(a, b);
    if (a.empty() || b.empty()) {
		return vector<int>();
    }
    map<int, int> mp = coordinate_compress(a, b);
    vi c = get_candidate(a, b);
    if (verify(a, b, c)) {
        for (int& x : c) x = mp[x];

		return c;
    }
    return vector<int>({-1});
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 367 ms 20216 KB Output is correct
6 Correct 283 ms 15620 KB Output is correct
7 Correct 278 ms 15572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 367 ms 20216 KB Output is correct
6 Correct 283 ms 15620 KB Output is correct
7 Correct 278 ms 15572 KB Output is correct
8 Correct 264 ms 13092 KB Output is correct
9 Correct 248 ms 13196 KB Output is correct
10 Correct 207 ms 12968 KB Output is correct
11 Correct 202 ms 13212 KB Output is correct
12 Correct 213 ms 13080 KB Output is correct
13 Correct 208 ms 12960 KB Output is correct
14 Correct 196 ms 13116 KB Output is correct
15 Correct 214 ms 13132 KB Output is correct
16 Correct 201 ms 13184 KB Output is correct
17 Correct 256 ms 13104 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 4 ms 604 KB Output is correct
22 Correct 89 ms 7240 KB Output is correct
23 Correct 195 ms 11928 KB Output is correct
24 Correct 179 ms 11776 KB Output is correct
25 Correct 171 ms 11828 KB Output is correct
26 Correct 130 ms 6508 KB Output is correct
27 Correct 290 ms 12996 KB Output is correct
28 Correct 306 ms 12992 KB Output is correct
29 Correct 222 ms 13004 KB Output is correct
30 Correct 224 ms 12972 KB Output is correct
31 Correct 218 ms 13040 KB Output is correct
32 Correct 256 ms 12960 KB Output is correct
33 Correct 215 ms 13012 KB Output is correct
34 Correct 222 ms 11916 KB Output is correct
35 Correct 194 ms 13080 KB Output is correct
36 Correct 219 ms 13028 KB Output is correct
37 Correct 202 ms 13124 KB Output is correct
38 Correct 167 ms 13112 KB Output is correct
39 Correct 174 ms 13096 KB Output is correct
40 Correct 337 ms 13100 KB Output is correct
41 Correct 205 ms 13076 KB Output is correct
42 Correct 174 ms 13204 KB Output is correct
43 Correct 334 ms 13104 KB Output is correct
44 Correct 242 ms 13104 KB Output is correct
45 Correct 165 ms 13076 KB Output is correct
46 Correct 179 ms 13168 KB Output is correct
47 Correct 173 ms 13180 KB Output is correct
48 Correct 167 ms 13212 KB Output is correct
49 Correct 193 ms 13084 KB Output is correct
50 Correct 241 ms 13076 KB Output is correct
51 Correct 242 ms 13140 KB Output is correct
52 Correct 212 ms 13068 KB Output is correct
53 Correct 386 ms 12972 KB Output is correct
54 Correct 170 ms 13096 KB Output is correct
55 Correct 192 ms 12984 KB Output is correct
56 Correct 423 ms 13096 KB Output is correct
57 Correct 169 ms 12996 KB Output is correct
58 Correct 168 ms 13112 KB Output is correct
59 Correct 168 ms 13052 KB Output is correct
60 Correct 202 ms 13332 KB Output is correct
61 Correct 207 ms 13064 KB Output is correct
62 Correct 170 ms 13156 KB Output is correct
63 Correct 159 ms 13100 KB Output is correct
64 Correct 195 ms 13160 KB Output is correct
65 Correct 199 ms 13076 KB Output is correct
66 Correct 208 ms 13088 KB Output is correct
67 Correct 249 ms 13188 KB Output is correct
68 Correct 198 ms 13100 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 10828 KB Output is correct
2 Correct 71 ms 11112 KB Output is correct
3 Correct 52 ms 6972 KB Output is correct
4 Correct 48 ms 6792 KB Output is correct
5 Correct 63 ms 10048 KB Output is correct
6 Correct 19 ms 4104 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 58 ms 9876 KB Output is correct
17 Correct 33 ms 5552 KB Output is correct
18 Correct 34 ms 5632 KB Output is correct
19 Correct 14 ms 4872 KB Output is correct
20 Correct 52 ms 7828 KB Output is correct
21 Correct 18 ms 5044 KB Output is correct
22 Correct 16 ms 5444 KB Output is correct
23 Correct 31 ms 10932 KB Output is correct
24 Correct 32 ms 10912 KB Output is correct
25 Correct 16 ms 6468 KB Output is correct
26 Correct 36 ms 10916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 264 ms 13092 KB Output is correct
2 Correct 248 ms 13196 KB Output is correct
3 Correct 207 ms 12968 KB Output is correct
4 Correct 202 ms 13212 KB Output is correct
5 Correct 213 ms 13080 KB Output is correct
6 Correct 208 ms 12960 KB Output is correct
7 Correct 196 ms 13116 KB Output is correct
8 Correct 214 ms 13132 KB Output is correct
9 Correct 201 ms 13184 KB Output is correct
10 Correct 256 ms 13104 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 4 ms 604 KB Output is correct
15 Correct 89 ms 7240 KB Output is correct
16 Correct 195 ms 11928 KB Output is correct
17 Correct 179 ms 11776 KB Output is correct
18 Correct 171 ms 11828 KB Output is correct
19 Correct 130 ms 6508 KB Output is correct
20 Correct 69 ms 10828 KB Output is correct
21 Correct 71 ms 11112 KB Output is correct
22 Correct 52 ms 6972 KB Output is correct
23 Correct 48 ms 6792 KB Output is correct
24 Correct 63 ms 10048 KB Output is correct
25 Correct 19 ms 4104 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 12 ms 2412 KB Output is correct
35 Correct 50 ms 10008 KB Output is correct
36 Correct 71 ms 10984 KB Output is correct
37 Correct 54 ms 11012 KB Output is correct
38 Correct 65 ms 10804 KB Output is correct
39 Correct 60 ms 11072 KB Output is correct
40 Correct 177 ms 12168 KB Output is correct
41 Correct 104 ms 9284 KB Output is correct
42 Correct 27 ms 4932 KB Output is correct
43 Correct 31 ms 5036 KB Output is correct
44 Correct 28 ms 5044 KB Output is correct
45 Correct 34 ms 4668 KB Output is correct
46 Correct 165 ms 9460 KB Output is correct
47 Correct 220 ms 9528 KB Output is correct
48 Correct 154 ms 9440 KB Output is correct
49 Correct 184 ms 8868 KB Output is correct
50 Correct 167 ms 8868 KB Output is correct
51 Correct 137 ms 8872 KB Output is correct
52 Correct 183 ms 8392 KB Output is correct
53 Correct 166 ms 8368 KB Output is correct
54 Correct 144 ms 8404 KB Output is correct
55 Correct 17 ms 2500 KB Output is correct
56 Correct 88 ms 10984 KB Output is correct
57 Correct 69 ms 9856 KB Output is correct
58 Correct 85 ms 11560 KB Output is correct
59 Correct 117 ms 10976 KB Output is correct
60 Correct 190 ms 10340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 2 ms 604 KB Output is correct
16 Correct 2 ms 604 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 5 ms 604 KB Output is correct
19 Correct 5 ms 604 KB Output is correct
20 Correct 4 ms 604 KB Output is correct
21 Correct 6 ms 716 KB Output is correct
22 Correct 4 ms 604 KB Output is correct
23 Correct 4 ms 604 KB Output is correct
24 Correct 4 ms 604 KB Output is correct
25 Correct 5 ms 668 KB Output is correct
26 Correct 3 ms 604 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 5 ms 720 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 2 ms 728 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 2 ms 348 KB Output is correct
38 Correct 2 ms 344 KB Output is correct
39 Correct 2 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 2 ms 604 KB Output is correct
43 Correct 1 ms 604 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 367 ms 20216 KB Output is correct
9 Correct 283 ms 15620 KB Output is correct
10 Correct 278 ms 15572 KB Output is correct
11 Correct 264 ms 13092 KB Output is correct
12 Correct 248 ms 13196 KB Output is correct
13 Correct 207 ms 12968 KB Output is correct
14 Correct 202 ms 13212 KB Output is correct
15 Correct 213 ms 13080 KB Output is correct
16 Correct 208 ms 12960 KB Output is correct
17 Correct 196 ms 13116 KB Output is correct
18 Correct 214 ms 13132 KB Output is correct
19 Correct 201 ms 13184 KB Output is correct
20 Correct 256 ms 13104 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 4 ms 604 KB Output is correct
25 Correct 89 ms 7240 KB Output is correct
26 Correct 195 ms 11928 KB Output is correct
27 Correct 179 ms 11776 KB Output is correct
28 Correct 171 ms 11828 KB Output is correct
29 Correct 130 ms 6508 KB Output is correct
30 Correct 290 ms 12996 KB Output is correct
31 Correct 306 ms 12992 KB Output is correct
32 Correct 222 ms 13004 KB Output is correct
33 Correct 224 ms 12972 KB Output is correct
34 Correct 218 ms 13040 KB Output is correct
35 Correct 256 ms 12960 KB Output is correct
36 Correct 215 ms 13012 KB Output is correct
37 Correct 222 ms 11916 KB Output is correct
38 Correct 194 ms 13080 KB Output is correct
39 Correct 219 ms 13028 KB Output is correct
40 Correct 202 ms 13124 KB Output is correct
41 Correct 167 ms 13112 KB Output is correct
42 Correct 174 ms 13096 KB Output is correct
43 Correct 337 ms 13100 KB Output is correct
44 Correct 205 ms 13076 KB Output is correct
45 Correct 174 ms 13204 KB Output is correct
46 Correct 334 ms 13104 KB Output is correct
47 Correct 242 ms 13104 KB Output is correct
48 Correct 165 ms 13076 KB Output is correct
49 Correct 179 ms 13168 KB Output is correct
50 Correct 173 ms 13180 KB Output is correct
51 Correct 167 ms 13212 KB Output is correct
52 Correct 193 ms 13084 KB Output is correct
53 Correct 241 ms 13076 KB Output is correct
54 Correct 242 ms 13140 KB Output is correct
55 Correct 212 ms 13068 KB Output is correct
56 Correct 386 ms 12972 KB Output is correct
57 Correct 170 ms 13096 KB Output is correct
58 Correct 192 ms 12984 KB Output is correct
59 Correct 423 ms 13096 KB Output is correct
60 Correct 169 ms 12996 KB Output is correct
61 Correct 168 ms 13112 KB Output is correct
62 Correct 168 ms 13052 KB Output is correct
63 Correct 202 ms 13332 KB Output is correct
64 Correct 207 ms 13064 KB Output is correct
65 Correct 170 ms 13156 KB Output is correct
66 Correct 159 ms 13100 KB Output is correct
67 Correct 195 ms 13160 KB Output is correct
68 Correct 199 ms 13076 KB Output is correct
69 Correct 208 ms 13088 KB Output is correct
70 Correct 249 ms 13188 KB Output is correct
71 Correct 198 ms 13100 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 69 ms 10828 KB Output is correct
75 Correct 71 ms 11112 KB Output is correct
76 Correct 52 ms 6972 KB Output is correct
77 Correct 48 ms 6792 KB Output is correct
78 Correct 63 ms 10048 KB Output is correct
79 Correct 19 ms 4104 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 348 KB Output is correct
86 Correct 1 ms 344 KB Output is correct
87 Correct 1 ms 348 KB Output is correct
88 Correct 1 ms 344 KB Output is correct
89 Correct 58 ms 9876 KB Output is correct
90 Correct 33 ms 5552 KB Output is correct
91 Correct 34 ms 5632 KB Output is correct
92 Correct 14 ms 4872 KB Output is correct
93 Correct 52 ms 7828 KB Output is correct
94 Correct 18 ms 5044 KB Output is correct
95 Correct 16 ms 5444 KB Output is correct
96 Correct 31 ms 10932 KB Output is correct
97 Correct 32 ms 10912 KB Output is correct
98 Correct 16 ms 6468 KB Output is correct
99 Correct 36 ms 10916 KB Output is correct
100 Correct 1 ms 600 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 2 ms 348 KB Output is correct
103 Correct 1 ms 348 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 2 ms 604 KB Output is correct
106 Correct 2 ms 604 KB Output is correct
107 Correct 2 ms 604 KB Output is correct
108 Correct 12 ms 2412 KB Output is correct
109 Correct 50 ms 10008 KB Output is correct
110 Correct 71 ms 10984 KB Output is correct
111 Correct 54 ms 11012 KB Output is correct
112 Correct 65 ms 10804 KB Output is correct
113 Correct 60 ms 11072 KB Output is correct
114 Correct 177 ms 12168 KB Output is correct
115 Correct 104 ms 9284 KB Output is correct
116 Correct 27 ms 4932 KB Output is correct
117 Correct 31 ms 5036 KB Output is correct
118 Correct 28 ms 5044 KB Output is correct
119 Correct 34 ms 4668 KB Output is correct
120 Correct 165 ms 9460 KB Output is correct
121 Correct 220 ms 9528 KB Output is correct
122 Correct 154 ms 9440 KB Output is correct
123 Correct 184 ms 8868 KB Output is correct
124 Correct 167 ms 8868 KB Output is correct
125 Correct 137 ms 8872 KB Output is correct
126 Correct 183 ms 8392 KB Output is correct
127 Correct 166 ms 8368 KB Output is correct
128 Correct 144 ms 8404 KB Output is correct
129 Correct 17 ms 2500 KB Output is correct
130 Correct 88 ms 10984 KB Output is correct
131 Correct 69 ms 9856 KB Output is correct
132 Correct 85 ms 11560 KB Output is correct
133 Correct 117 ms 10976 KB Output is correct
134 Correct 190 ms 10340 KB Output is correct
135 Correct 5 ms 604 KB Output is correct
136 Correct 5 ms 604 KB Output is correct
137 Correct 4 ms 604 KB Output is correct
138 Correct 6 ms 716 KB Output is correct
139 Correct 4 ms 604 KB Output is correct
140 Correct 4 ms 604 KB Output is correct
141 Correct 4 ms 604 KB Output is correct
142 Correct 5 ms 668 KB Output is correct
143 Correct 3 ms 604 KB Output is correct
144 Correct 2 ms 604 KB Output is correct
145 Correct 5 ms 720 KB Output is correct
146 Correct 3 ms 604 KB Output is correct
147 Correct 2 ms 728 KB Output is correct
148 Correct 2 ms 604 KB Output is correct
149 Correct 2 ms 604 KB Output is correct
150 Correct 0 ms 348 KB Output is correct
151 Correct 1 ms 348 KB Output is correct
152 Correct 1 ms 348 KB Output is correct
153 Correct 1 ms 348 KB Output is correct
154 Correct 2 ms 348 KB Output is correct
155 Correct 2 ms 344 KB Output is correct
156 Correct 2 ms 348 KB Output is correct
157 Correct 0 ms 348 KB Output is correct
158 Correct 1 ms 348 KB Output is correct
159 Correct 2 ms 604 KB Output is correct
160 Correct 1 ms 604 KB Output is correct
161 Correct 1 ms 604 KB Output is correct
162 Correct 109 ms 9960 KB Output is correct
163 Correct 8 ms 1116 KB Output is correct
164 Correct 15 ms 1744 KB Output is correct
165 Correct 32 ms 3284 KB Output is correct
166 Correct 61 ms 5116 KB Output is correct
167 Correct 99 ms 8092 KB Output is correct
168 Correct 18 ms 4932 KB Output is correct
169 Correct 27 ms 4960 KB Output is correct
170 Correct 30 ms 4928 KB Output is correct
171 Correct 24 ms 4660 KB Output is correct
172 Correct 10 ms 1360 KB Output is correct
173 Correct 10 ms 1300 KB Output is correct
174 Correct 12 ms 1520 KB Output is correct
175 Correct 9 ms 1256 KB Output is correct
176 Correct 10 ms 1496 KB Output is correct
177 Correct 13 ms 1616 KB Output is correct
178 Correct 114 ms 10240 KB Output is correct
179 Correct 124 ms 10196 KB Output is correct
180 Correct 127 ms 9412 KB Output is correct
181 Correct 112 ms 9512 KB Output is correct
182 Correct 114 ms 9312 KB Output is correct
183 Correct 118 ms 9408 KB Output is correct
184 Correct 122 ms 8612 KB Output is correct
185 Correct 131 ms 8764 KB Output is correct
186 Correct 121 ms 8800 KB Output is correct
187 Correct 107 ms 8748 KB Output is correct
188 Correct 115 ms 8240 KB Output is correct
189 Correct 135 ms 8336 KB Output is correct
190 Correct 111 ms 8268 KB Output is correct
191 Correct 104 ms 8396 KB Output is correct
192 Correct 133 ms 9372 KB Output is correct
193 Correct 167 ms 9520 KB Output is correct
194 Correct 123 ms 9508 KB Output is correct
195 Correct 121 ms 9416 KB Output is correct
196 Correct 158 ms 8768 KB Output is correct
197 Correct 116 ms 8892 KB Output is correct
198 Correct 121 ms 8868 KB Output is correct
199 Correct 108 ms 8876 KB Output is correct
200 Correct 113 ms 8412 KB Output is correct
201 Correct 109 ms 8272 KB Output is correct
202 Correct 106 ms 8360 KB Output is correct
203 Correct 95 ms 8368 KB Output is correct
204 Correct 179 ms 9552 KB Output is correct
205 Correct 127 ms 9332 KB Output is correct
206 Correct 151 ms 9428 KB Output is correct
207 Correct 113 ms 9432 KB Output is correct
208 Correct 119 ms 8628 KB Output is correct
209 Correct 115 ms 8816 KB Output is correct
210 Correct 106 ms 8872 KB Output is correct
211 Correct 104 ms 8864 KB Output is correct
212 Correct 127 ms 8204 KB Output is correct
213 Correct 111 ms 8332 KB Output is correct
214 Correct 99 ms 8332 KB Output is correct
215 Correct 95 ms 8232 KB Output is correct
216 Correct 16 ms 2380 KB Output is correct
217 Correct 40 ms 11068 KB Output is correct
218 Correct 38 ms 9744 KB Output is correct
219 Correct 72 ms 11676 KB Output is correct
220 Correct 76 ms 10992 KB Output is correct
221 Correct 104 ms 10216 KB Output is correct