Submission #735498

# Submission time Handle Problem Language Result Execution time Memory
735498 2023-05-04T08:24:54 Z Nahian9696 Painting Walls (APIO20_paint) C++17
63 / 100
1500 ms 205736 KB
#include "paint.h"

#include <iostream>
#include <iomanip>
#include <chrono>

#include <cmath>
#include <cstring>
#include <algorithm>


#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <string>
#include <vector>
#include <bitset>



using std::min;
using std::max;
using std::sort;
using std::swap;
using std::fixed;
using std::to_string;
using std::make_pair;
using std::upper_bound;
using std::lower_bound;
using std::setprecision;

using std::cin;
using std::cout;

using std::set;
using std::map;
using std::list;
using std::pair;
using std::less;
using std::tuple;
using std::stack;
using std::queue;
using std::deque;
using std::string;
using std::vector;
using std::bitset;
using std::greater;
using std::priority_queue;





typedef long double                         ld;
typedef unsigned                            ui;
typedef long long                           lli;
typedef unsigned long long                  ulli;
typedef vector<int32_t>                     vi;
typedef vector<ld>                          vld;
typedef vector<ui>                          vui;
typedef vector<lli>                         vlli;
typedef vector<ulli>                        vulli;
typedef list<int32_t>                       lsi;
typedef list<ld>                            lsld;
typedef list<ui>                            lsui;
typedef list<lli>                           lslli;
typedef list<ulli>                          lsulli;
typedef set<int32_t>                        si;
typedef set<ld>                             sld;
typedef set<ui>                             sui;
typedef set<lli>                            slli;
typedef set<ulli>                           sulli;

typedef pair<int32_t, int32_t>              pii;
typedef pair<lli, lli>                      pll;



// #define int                                 int64_t

#define endl                                "\n"
#define inp(n)                              int n; cin >> n
#define Inp(n)                              lli n; cin >> n
#define inpstr(s)                           string s; cin >> s
#define inp2(a,b)                           int a,b; cin >> a >> b
#define Inp2(a,b)                           lli a,b; cin >> a >> b
#define inparr(arr,n)                       int arr[n]; f0(t_ind, n) cin >> arr[t_ind]
#define Inparr(arr,n)                       lli arr[n]; f0(t_ind, n) cin >> arr[t_ind]

#define f0(i,n)                             for(int32_t i = 0; i <  (n); i++)
#define f1(i,n)                             for(int32_t i = 1; i <= (n); i++)
#define rep0(i,l,r)                         for(int32_t i=(l); i <  (r); i++)
#define rep1(i,l,r)                         for(int32_t i=(l); i <= (r); i++)

#define testIn                              cin >> test
#define tests                               for(int32_t testNo=1; testNo <= (test); testNo++)

#define all(x)                              (x).begin(), (x).end()
#define rall(x)                             (x).rbegin(), (x).rend()
#define asrt(v)                             sort(all(v))
#define dsrt(v)                             sort(rall(v))
#define revStr(str)                         string(rall(str))
#define len(a)                              ((int64_t)(a).size())
#define front_zero(n)                       __builtin_clzll(n)
#define back_zero(n)                        __builtin_ctzll(n)
#define total_one(n)                        __builtin_popcountll(n)
#define lcm(a, b)                           (((a)*(b))/gcd(a,b))
#define mem(a, b)                           memset(a, b, sizeof(a))

#define pb                                  push_back
#define pf                                  push_front
#define mp                                  make_pair
#define ff                                  first
#define ss                                  second

#define yes                                 cout << "yes" << endl
#define no                                  cout << "no" << endl
#define Yes                                 cout << "Yes" << endl
#define No                                  cout << "No" << endl
#define YES                                 cout << "YES" << endl
#define NO                                  cout << "NO" << endl
#define finish                              return 0
#define clean                               fflush(stdout)

#define Inf                                 (int32_t)(1e9)
#define INF                                 (lli)(1e18)
#define Eps                                 (ld)(1e-9)
#define EPS                                 (ld)(1e-18)
#define PI                                  (ld)(3.141592653589793238462643383279502884197169L)
#define MOD                                 (int32_t)(1e9+7)
#define MXN                                 (int32_t)(1e5+7)
#define antihash                            likedby

int likedby[100005];
int likedby2[100005];

bool likes[100005][2005];
vi hash;


int minimumInstructions(
    int N, int M, int K, std::vector<int> C,
    std::vector<int> A, std::vector<std::vector<int>> B) {

    bool valid[N] = {0};    
    int lstvalid[N];
    int cur = -1, ans = 0;
    bool sbtsk1 = true;
    f0(i, 100005) f0(j, 2005) likes[i][j] = 0;


    f0(i, 100005) likedby[i] = -1, likedby2[i] = 0;
    f0(i, M) {
        f0(j, A[i]) {
            likedby[B[i][j]] = i;
            likedby2[B[i][j]]++;
            if(likedby2[B[i][j]] == 2) sbtsk1 = false;
        }
    }


    if(sbtsk1){f0(i, N) {
            if(likedby[C[i]] == -1) return -1;
            if(i % M != 0) {
                int df = likedby[C[i]] - likedby[C[i-1]];
                df %= M;
                df += M;
                df %= M;
                if(df != 1) {
                    return -1;
                }
            }
        }
    
        // cur = 0;
        // while(cur < N) {
        //     if(lstvalid[cur] == -1) return -1;
        //     if(lstvalid[cur] < cur - M + 1) return -1;
        //     ans++;
        //     cur = lstvalid[cur] + M;
        // }
        if(N % M == 0) {
            return N/M;
        }
        int i = N/M;
        i *= M;
        int df = likedby[C[i]] - likedby[C[i-1]];
        df %= M;
        df += M;
        df %= M;
        if(df != 1) {
            return -1;
        }
    
        return (int)((N+M-1)/M);}


    f0(i, 100005) antihash[i] = -1;
    si s;
    int nn = 0;
    f0(i, N) {
        s.insert(C[i]);
        if(len(s) > nn) {
            hash.pb(C[i]);
            antihash[C[i]] = nn;
            nn++;
        }
    }

    f0(i, M) {
        f0(j, A[i]) {
            if(antihash[B[i][j]] != -1) {
                likes[antihash[B[i][j]]][i] = true;
            }
        }
    }


    // vector<si> B(M);
    // f0(i, M) {
    //     for(int c: bbb[i]) B[i].insert(c);
    // }
    
    // bool valid[N] = {0};    
    // int lstvalid[N];

    f0(st, M) {
        int lstbreak = -1;
        f0(i, N) {
            // int color = C[i];

            if(!likes[antihash[C[i]]][(st+i)%M]) {
                lstbreak = i;
            }

            // auto it = lower_bound(B[(st+i)%M].begin(), B[(st+i)%M].end(), C[i]);
            // if (it == B[(st+i)%M].end()) {
            //     lstbreak = i;
            // } else if ((*it) != C[i]) {
            //     lstbreak = i;
            // }
            if(i - lstbreak >= M) {
                valid[i - M + 1] = true;
            }
        }
    }


    cur = -1, ans = 0;

    f0(i, N) {
        if(valid[i]) {
            cur = i;
        }
        lstvalid[i] = cur;
    }

    cur = 0;
    while(cur < N) {
        if(lstvalid[cur] == -1) return -1;
        if(lstvalid[cur] < cur - M + 1) return -1;
        ans++;
        cur = lstvalid[cur] + M;
    }

    return ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 77 ms 197168 KB Output is correct
2 Correct 79 ms 197276 KB Output is correct
3 Correct 78 ms 197200 KB Output is correct
4 Correct 80 ms 197248 KB Output is correct
5 Correct 79 ms 197180 KB Output is correct
6 Correct 78 ms 197204 KB Output is correct
7 Correct 79 ms 197196 KB Output is correct
8 Correct 79 ms 197236 KB Output is correct
9 Correct 78 ms 197136 KB Output is correct
10 Correct 76 ms 197236 KB Output is correct
11 Correct 87 ms 197212 KB Output is correct
12 Correct 77 ms 197192 KB Output is correct
13 Correct 79 ms 197196 KB Output is correct
14 Correct 82 ms 197228 KB Output is correct
15 Correct 79 ms 197252 KB Output is correct
16 Correct 78 ms 197192 KB Output is correct
17 Correct 78 ms 197276 KB Output is correct
18 Correct 80 ms 197324 KB Output is correct
19 Correct 82 ms 197228 KB Output is correct
20 Correct 126 ms 197208 KB Output is correct
21 Correct 85 ms 197196 KB Output is correct
22 Correct 93 ms 198632 KB Output is correct
23 Correct 98 ms 198604 KB Output is correct
24 Correct 96 ms 198568 KB Output is correct
25 Correct 84 ms 197536 KB Output is correct
26 Correct 86 ms 197520 KB Output is correct
27 Correct 84 ms 197512 KB Output is correct
28 Correct 81 ms 197480 KB Output is correct
29 Correct 81 ms 197448 KB Output is correct
30 Correct 82 ms 197440 KB Output is correct
31 Correct 89 ms 197944 KB Output is correct
32 Correct 83 ms 197912 KB Output is correct
33 Correct 89 ms 197964 KB Output is correct
34 Correct 88 ms 197980 KB Output is correct
35 Correct 84 ms 198024 KB Output is correct
36 Correct 94 ms 198020 KB Output is correct
37 Correct 90 ms 199048 KB Output is correct
38 Correct 91 ms 199056 KB Output is correct
39 Correct 92 ms 199112 KB Output is correct
40 Correct 92 ms 198560 KB Output is correct
41 Correct 91 ms 198060 KB Output is correct
42 Correct 94 ms 198692 KB Output is correct
43 Correct 87 ms 198140 KB Output is correct
44 Correct 85 ms 198020 KB Output is correct
45 Correct 90 ms 198628 KB Output is correct
46 Correct 115 ms 205088 KB Output is correct
47 Correct 102 ms 201468 KB Output is correct
48 Correct 104 ms 203980 KB Output is correct
49 Correct 111 ms 203440 KB Output is correct
50 Correct 110 ms 203148 KB Output is correct
51 Correct 102 ms 201344 KB Output is correct
52 Correct 92 ms 198744 KB Output is correct
53 Correct 87 ms 198732 KB Output is correct
54 Correct 92 ms 198604 KB Output is correct
55 Correct 89 ms 198600 KB Output is correct
56 Correct 91 ms 198652 KB Output is correct
57 Correct 96 ms 198616 KB Output is correct
58 Correct 113 ms 205616 KB Output is correct
59 Correct 113 ms 205616 KB Output is correct
60 Correct 112 ms 205568 KB Output is correct
61 Correct 122 ms 205736 KB Output is correct
62 Correct 116 ms 205640 KB Output is correct
63 Correct 118 ms 205552 KB Output is correct
64 Correct 113 ms 204816 KB Output is correct
65 Correct 110 ms 204880 KB Output is correct
66 Correct 116 ms 204844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 197168 KB Output is correct
2 Correct 79 ms 197276 KB Output is correct
3 Correct 78 ms 197200 KB Output is correct
4 Correct 80 ms 197248 KB Output is correct
5 Correct 79 ms 197180 KB Output is correct
6 Correct 78 ms 197204 KB Output is correct
7 Correct 79 ms 197196 KB Output is correct
8 Correct 79 ms 197236 KB Output is correct
9 Correct 78 ms 197136 KB Output is correct
10 Correct 76 ms 197236 KB Output is correct
11 Correct 87 ms 197212 KB Output is correct
12 Correct 77 ms 197192 KB Output is correct
13 Correct 79 ms 197196 KB Output is correct
14 Correct 82 ms 197228 KB Output is correct
15 Correct 79 ms 197252 KB Output is correct
16 Correct 78 ms 197192 KB Output is correct
17 Correct 78 ms 197276 KB Output is correct
18 Correct 80 ms 197324 KB Output is correct
19 Correct 82 ms 197228 KB Output is correct
20 Correct 126 ms 197208 KB Output is correct
21 Correct 85 ms 197196 KB Output is correct
22 Correct 86 ms 197196 KB Output is correct
23 Correct 88 ms 197224 KB Output is correct
24 Correct 79 ms 197196 KB Output is correct
25 Correct 97 ms 197180 KB Output is correct
26 Correct 85 ms 197164 KB Output is correct
27 Correct 85 ms 197216 KB Output is correct
28 Correct 83 ms 197200 KB Output is correct
29 Correct 80 ms 197208 KB Output is correct
30 Correct 80 ms 197152 KB Output is correct
31 Correct 84 ms 197196 KB Output is correct
32 Correct 80 ms 197148 KB Output is correct
33 Correct 101 ms 197332 KB Output is correct
34 Correct 81 ms 197244 KB Output is correct
35 Correct 93 ms 197176 KB Output is correct
36 Correct 81 ms 197196 KB Output is correct
37 Correct 91 ms 197196 KB Output is correct
38 Correct 91 ms 197200 KB Output is correct
39 Correct 81 ms 197208 KB Output is correct
40 Correct 84 ms 197320 KB Output is correct
41 Correct 86 ms 197220 KB Output is correct
42 Correct 95 ms 197216 KB Output is correct
43 Correct 90 ms 197272 KB Output is correct
44 Correct 91 ms 197292 KB Output is correct
45 Correct 99 ms 197264 KB Output is correct
46 Correct 99 ms 197248 KB Output is correct
47 Correct 93 ms 197240 KB Output is correct
48 Correct 86 ms 197252 KB Output is correct
49 Correct 84 ms 197216 KB Output is correct
50 Correct 93 ms 197284 KB Output is correct
51 Correct 85 ms 197224 KB Output is correct
52 Correct 85 ms 197196 KB Output is correct
53 Correct 89 ms 197252 KB Output is correct
54 Correct 89 ms 197248 KB Output is correct
55 Correct 86 ms 197204 KB Output is correct
56 Correct 86 ms 197272 KB Output is correct
57 Correct 88 ms 197272 KB Output is correct
58 Correct 87 ms 197280 KB Output is correct
59 Correct 88 ms 197232 KB Output is correct
60 Correct 90 ms 197324 KB Output is correct
61 Correct 91 ms 197240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 197196 KB Output is correct
2 Correct 88 ms 197224 KB Output is correct
3 Correct 77 ms 197168 KB Output is correct
4 Correct 79 ms 197276 KB Output is correct
5 Correct 78 ms 197200 KB Output is correct
6 Correct 80 ms 197248 KB Output is correct
7 Correct 79 ms 197180 KB Output is correct
8 Correct 78 ms 197204 KB Output is correct
9 Correct 79 ms 197196 KB Output is correct
10 Correct 79 ms 197236 KB Output is correct
11 Correct 78 ms 197136 KB Output is correct
12 Correct 76 ms 197236 KB Output is correct
13 Correct 87 ms 197212 KB Output is correct
14 Correct 77 ms 197192 KB Output is correct
15 Correct 79 ms 197196 KB Output is correct
16 Correct 82 ms 197228 KB Output is correct
17 Correct 79 ms 197252 KB Output is correct
18 Correct 78 ms 197192 KB Output is correct
19 Correct 78 ms 197276 KB Output is correct
20 Correct 80 ms 197324 KB Output is correct
21 Correct 82 ms 197228 KB Output is correct
22 Correct 126 ms 197208 KB Output is correct
23 Correct 85 ms 197196 KB Output is correct
24 Correct 93 ms 198632 KB Output is correct
25 Correct 98 ms 198604 KB Output is correct
26 Correct 96 ms 198568 KB Output is correct
27 Correct 79 ms 197196 KB Output is correct
28 Correct 97 ms 197180 KB Output is correct
29 Correct 85 ms 197164 KB Output is correct
30 Correct 85 ms 197216 KB Output is correct
31 Correct 83 ms 197200 KB Output is correct
32 Correct 80 ms 197208 KB Output is correct
33 Correct 80 ms 197152 KB Output is correct
34 Correct 84 ms 197196 KB Output is correct
35 Correct 80 ms 197148 KB Output is correct
36 Correct 101 ms 197332 KB Output is correct
37 Correct 81 ms 197244 KB Output is correct
38 Correct 93 ms 197176 KB Output is correct
39 Correct 81 ms 197196 KB Output is correct
40 Correct 91 ms 197196 KB Output is correct
41 Correct 91 ms 197200 KB Output is correct
42 Correct 81 ms 197208 KB Output is correct
43 Correct 84 ms 197320 KB Output is correct
44 Correct 86 ms 197220 KB Output is correct
45 Correct 95 ms 197216 KB Output is correct
46 Correct 90 ms 197272 KB Output is correct
47 Correct 91 ms 197292 KB Output is correct
48 Correct 99 ms 197264 KB Output is correct
49 Correct 99 ms 197248 KB Output is correct
50 Correct 93 ms 197240 KB Output is correct
51 Correct 86 ms 197252 KB Output is correct
52 Correct 84 ms 197216 KB Output is correct
53 Correct 93 ms 197284 KB Output is correct
54 Correct 85 ms 197224 KB Output is correct
55 Correct 85 ms 197196 KB Output is correct
56 Correct 89 ms 197252 KB Output is correct
57 Correct 89 ms 197248 KB Output is correct
58 Correct 86 ms 197204 KB Output is correct
59 Correct 86 ms 197272 KB Output is correct
60 Correct 88 ms 197272 KB Output is correct
61 Correct 87 ms 197280 KB Output is correct
62 Correct 88 ms 197232 KB Output is correct
63 Correct 90 ms 197324 KB Output is correct
64 Correct 91 ms 197240 KB Output is correct
65 Correct 91 ms 197196 KB Output is correct
66 Correct 89 ms 197256 KB Output is correct
67 Correct 84 ms 197156 KB Output is correct
68 Correct 84 ms 197228 KB Output is correct
69 Correct 84 ms 197256 KB Output is correct
70 Correct 87 ms 197256 KB Output is correct
71 Correct 92 ms 197376 KB Output is correct
72 Correct 88 ms 197248 KB Output is correct
73 Correct 90 ms 197316 KB Output is correct
74 Correct 98 ms 197364 KB Output is correct
75 Correct 86 ms 197272 KB Output is correct
76 Correct 97 ms 198088 KB Output is correct
77 Correct 105 ms 198224 KB Output is correct
78 Correct 99 ms 198332 KB Output is correct
79 Correct 85 ms 197192 KB Output is correct
80 Correct 93 ms 197272 KB Output is correct
81 Correct 97 ms 197212 KB Output is correct
82 Correct 91 ms 197200 KB Output is correct
83 Correct 97 ms 197280 KB Output is correct
84 Correct 98 ms 197308 KB Output is correct
85 Correct 97 ms 197368 KB Output is correct
86 Correct 90 ms 197372 KB Output is correct
87 Correct 88 ms 197344 KB Output is correct
88 Correct 98 ms 197396 KB Output is correct
89 Correct 87 ms 197400 KB Output is correct
90 Correct 108 ms 198464 KB Output is correct
91 Correct 112 ms 198416 KB Output is correct
92 Correct 105 ms 198500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 197196 KB Output is correct
2 Correct 88 ms 197224 KB Output is correct
3 Correct 77 ms 197168 KB Output is correct
4 Correct 79 ms 197276 KB Output is correct
5 Correct 78 ms 197200 KB Output is correct
6 Correct 80 ms 197248 KB Output is correct
7 Correct 79 ms 197180 KB Output is correct
8 Correct 78 ms 197204 KB Output is correct
9 Correct 79 ms 197196 KB Output is correct
10 Correct 79 ms 197236 KB Output is correct
11 Correct 78 ms 197136 KB Output is correct
12 Correct 76 ms 197236 KB Output is correct
13 Correct 87 ms 197212 KB Output is correct
14 Correct 77 ms 197192 KB Output is correct
15 Correct 79 ms 197196 KB Output is correct
16 Correct 82 ms 197228 KB Output is correct
17 Correct 79 ms 197252 KB Output is correct
18 Correct 78 ms 197192 KB Output is correct
19 Correct 78 ms 197276 KB Output is correct
20 Correct 80 ms 197324 KB Output is correct
21 Correct 82 ms 197228 KB Output is correct
22 Correct 126 ms 197208 KB Output is correct
23 Correct 85 ms 197196 KB Output is correct
24 Correct 93 ms 198632 KB Output is correct
25 Correct 98 ms 198604 KB Output is correct
26 Correct 96 ms 198568 KB Output is correct
27 Correct 84 ms 197536 KB Output is correct
28 Correct 86 ms 197520 KB Output is correct
29 Correct 84 ms 197512 KB Output is correct
30 Correct 81 ms 197480 KB Output is correct
31 Correct 81 ms 197448 KB Output is correct
32 Correct 82 ms 197440 KB Output is correct
33 Correct 89 ms 197944 KB Output is correct
34 Correct 83 ms 197912 KB Output is correct
35 Correct 89 ms 197964 KB Output is correct
36 Correct 88 ms 197980 KB Output is correct
37 Correct 84 ms 198024 KB Output is correct
38 Correct 94 ms 198020 KB Output is correct
39 Correct 90 ms 199048 KB Output is correct
40 Correct 91 ms 199056 KB Output is correct
41 Correct 92 ms 199112 KB Output is correct
42 Correct 79 ms 197196 KB Output is correct
43 Correct 97 ms 197180 KB Output is correct
44 Correct 85 ms 197164 KB Output is correct
45 Correct 85 ms 197216 KB Output is correct
46 Correct 83 ms 197200 KB Output is correct
47 Correct 80 ms 197208 KB Output is correct
48 Correct 80 ms 197152 KB Output is correct
49 Correct 84 ms 197196 KB Output is correct
50 Correct 80 ms 197148 KB Output is correct
51 Correct 101 ms 197332 KB Output is correct
52 Correct 81 ms 197244 KB Output is correct
53 Correct 93 ms 197176 KB Output is correct
54 Correct 81 ms 197196 KB Output is correct
55 Correct 91 ms 197196 KB Output is correct
56 Correct 91 ms 197200 KB Output is correct
57 Correct 81 ms 197208 KB Output is correct
58 Correct 84 ms 197320 KB Output is correct
59 Correct 86 ms 197220 KB Output is correct
60 Correct 95 ms 197216 KB Output is correct
61 Correct 90 ms 197272 KB Output is correct
62 Correct 91 ms 197292 KB Output is correct
63 Correct 99 ms 197264 KB Output is correct
64 Correct 99 ms 197248 KB Output is correct
65 Correct 93 ms 197240 KB Output is correct
66 Correct 86 ms 197252 KB Output is correct
67 Correct 84 ms 197216 KB Output is correct
68 Correct 93 ms 197284 KB Output is correct
69 Correct 85 ms 197224 KB Output is correct
70 Correct 85 ms 197196 KB Output is correct
71 Correct 89 ms 197252 KB Output is correct
72 Correct 89 ms 197248 KB Output is correct
73 Correct 86 ms 197204 KB Output is correct
74 Correct 86 ms 197272 KB Output is correct
75 Correct 88 ms 197272 KB Output is correct
76 Correct 87 ms 197280 KB Output is correct
77 Correct 88 ms 197232 KB Output is correct
78 Correct 90 ms 197324 KB Output is correct
79 Correct 91 ms 197240 KB Output is correct
80 Correct 91 ms 197196 KB Output is correct
81 Correct 89 ms 197256 KB Output is correct
82 Correct 84 ms 197156 KB Output is correct
83 Correct 84 ms 197228 KB Output is correct
84 Correct 84 ms 197256 KB Output is correct
85 Correct 87 ms 197256 KB Output is correct
86 Correct 92 ms 197376 KB Output is correct
87 Correct 88 ms 197248 KB Output is correct
88 Correct 90 ms 197316 KB Output is correct
89 Correct 98 ms 197364 KB Output is correct
90 Correct 86 ms 197272 KB Output is correct
91 Correct 97 ms 198088 KB Output is correct
92 Correct 105 ms 198224 KB Output is correct
93 Correct 99 ms 198332 KB Output is correct
94 Correct 85 ms 197192 KB Output is correct
95 Correct 93 ms 197272 KB Output is correct
96 Correct 97 ms 197212 KB Output is correct
97 Correct 91 ms 197200 KB Output is correct
98 Correct 97 ms 197280 KB Output is correct
99 Correct 98 ms 197308 KB Output is correct
100 Correct 97 ms 197368 KB Output is correct
101 Correct 90 ms 197372 KB Output is correct
102 Correct 88 ms 197344 KB Output is correct
103 Correct 98 ms 197396 KB Output is correct
104 Correct 87 ms 197400 KB Output is correct
105 Correct 108 ms 198464 KB Output is correct
106 Correct 112 ms 198416 KB Output is correct
107 Correct 105 ms 198500 KB Output is correct
108 Correct 94 ms 197404 KB Output is correct
109 Correct 145 ms 197444 KB Output is correct
110 Correct 163 ms 197580 KB Output is correct
111 Correct 174 ms 197392 KB Output is correct
112 Correct 193 ms 197528 KB Output is correct
113 Correct 172 ms 197596 KB Output is correct
114 Correct 159 ms 198480 KB Output is correct
115 Correct 120 ms 198264 KB Output is correct
116 Correct 181 ms 199048 KB Output is correct
117 Correct 135 ms 198348 KB Output is correct
118 Correct 98 ms 198484 KB Output is correct
119 Correct 219 ms 198624 KB Output is correct
120 Correct 221 ms 198812 KB Output is correct
121 Correct 207 ms 197964 KB Output is correct
122 Correct 132 ms 198888 KB Output is correct
123 Correct 125 ms 197880 KB Output is correct
124 Correct 114 ms 199372 KB Output is correct
125 Correct 107 ms 198248 KB Output is correct
126 Correct 93 ms 198476 KB Output is correct
127 Correct 146 ms 198796 KB Output is correct
128 Correct 101 ms 198184 KB Output is correct
129 Correct 106 ms 198316 KB Output is correct
130 Correct 85 ms 197452 KB Output is correct
131 Correct 149 ms 197576 KB Output is correct
132 Correct 238 ms 197592 KB Output is correct
133 Correct 255 ms 197700 KB Output is correct
134 Correct 249 ms 197628 KB Output is correct
135 Correct 242 ms 197632 KB Output is correct
136 Correct 311 ms 199392 KB Output is correct
137 Correct 344 ms 199404 KB Output is correct
138 Correct 352 ms 199356 KB Output is correct
139 Correct 333 ms 199332 KB Output is correct
140 Correct 363 ms 199252 KB Output is correct
141 Correct 331 ms 199332 KB Output is correct
142 Correct 411 ms 199768 KB Output is correct
143 Correct 359 ms 198552 KB Output is correct
144 Correct 369 ms 199764 KB Output is correct
145 Correct 348 ms 198376 KB Output is correct
146 Correct 335 ms 199744 KB Output is correct
147 Correct 337 ms 198448 KB Output is correct
148 Correct 317 ms 198880 KB Output is correct
149 Correct 235 ms 198912 KB Output is correct
150 Correct 177 ms 198876 KB Output is correct
151 Correct 155 ms 198800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 197196 KB Output is correct
2 Correct 88 ms 197224 KB Output is correct
3 Correct 77 ms 197168 KB Output is correct
4 Correct 79 ms 197276 KB Output is correct
5 Correct 78 ms 197200 KB Output is correct
6 Correct 80 ms 197248 KB Output is correct
7 Correct 79 ms 197180 KB Output is correct
8 Correct 78 ms 197204 KB Output is correct
9 Correct 79 ms 197196 KB Output is correct
10 Correct 79 ms 197236 KB Output is correct
11 Correct 78 ms 197136 KB Output is correct
12 Correct 76 ms 197236 KB Output is correct
13 Correct 87 ms 197212 KB Output is correct
14 Correct 77 ms 197192 KB Output is correct
15 Correct 79 ms 197196 KB Output is correct
16 Correct 82 ms 197228 KB Output is correct
17 Correct 79 ms 197252 KB Output is correct
18 Correct 78 ms 197192 KB Output is correct
19 Correct 78 ms 197276 KB Output is correct
20 Correct 80 ms 197324 KB Output is correct
21 Correct 82 ms 197228 KB Output is correct
22 Correct 126 ms 197208 KB Output is correct
23 Correct 85 ms 197196 KB Output is correct
24 Correct 93 ms 198632 KB Output is correct
25 Correct 98 ms 198604 KB Output is correct
26 Correct 96 ms 198568 KB Output is correct
27 Correct 84 ms 197536 KB Output is correct
28 Correct 86 ms 197520 KB Output is correct
29 Correct 84 ms 197512 KB Output is correct
30 Correct 81 ms 197480 KB Output is correct
31 Correct 81 ms 197448 KB Output is correct
32 Correct 82 ms 197440 KB Output is correct
33 Correct 89 ms 197944 KB Output is correct
34 Correct 83 ms 197912 KB Output is correct
35 Correct 89 ms 197964 KB Output is correct
36 Correct 88 ms 197980 KB Output is correct
37 Correct 84 ms 198024 KB Output is correct
38 Correct 94 ms 198020 KB Output is correct
39 Correct 90 ms 199048 KB Output is correct
40 Correct 91 ms 199056 KB Output is correct
41 Correct 92 ms 199112 KB Output is correct
42 Correct 92 ms 198560 KB Output is correct
43 Correct 91 ms 198060 KB Output is correct
44 Correct 94 ms 198692 KB Output is correct
45 Correct 87 ms 198140 KB Output is correct
46 Correct 85 ms 198020 KB Output is correct
47 Correct 90 ms 198628 KB Output is correct
48 Correct 115 ms 205088 KB Output is correct
49 Correct 102 ms 201468 KB Output is correct
50 Correct 104 ms 203980 KB Output is correct
51 Correct 111 ms 203440 KB Output is correct
52 Correct 110 ms 203148 KB Output is correct
53 Correct 102 ms 201344 KB Output is correct
54 Correct 92 ms 198744 KB Output is correct
55 Correct 87 ms 198732 KB Output is correct
56 Correct 92 ms 198604 KB Output is correct
57 Correct 89 ms 198600 KB Output is correct
58 Correct 91 ms 198652 KB Output is correct
59 Correct 96 ms 198616 KB Output is correct
60 Correct 113 ms 205616 KB Output is correct
61 Correct 113 ms 205616 KB Output is correct
62 Correct 112 ms 205568 KB Output is correct
63 Correct 122 ms 205736 KB Output is correct
64 Correct 116 ms 205640 KB Output is correct
65 Correct 118 ms 205552 KB Output is correct
66 Correct 113 ms 204816 KB Output is correct
67 Correct 110 ms 204880 KB Output is correct
68 Correct 116 ms 204844 KB Output is correct
69 Correct 79 ms 197196 KB Output is correct
70 Correct 97 ms 197180 KB Output is correct
71 Correct 85 ms 197164 KB Output is correct
72 Correct 85 ms 197216 KB Output is correct
73 Correct 83 ms 197200 KB Output is correct
74 Correct 80 ms 197208 KB Output is correct
75 Correct 80 ms 197152 KB Output is correct
76 Correct 84 ms 197196 KB Output is correct
77 Correct 80 ms 197148 KB Output is correct
78 Correct 101 ms 197332 KB Output is correct
79 Correct 81 ms 197244 KB Output is correct
80 Correct 93 ms 197176 KB Output is correct
81 Correct 81 ms 197196 KB Output is correct
82 Correct 91 ms 197196 KB Output is correct
83 Correct 91 ms 197200 KB Output is correct
84 Correct 81 ms 197208 KB Output is correct
85 Correct 84 ms 197320 KB Output is correct
86 Correct 86 ms 197220 KB Output is correct
87 Correct 95 ms 197216 KB Output is correct
88 Correct 90 ms 197272 KB Output is correct
89 Correct 91 ms 197292 KB Output is correct
90 Correct 99 ms 197264 KB Output is correct
91 Correct 99 ms 197248 KB Output is correct
92 Correct 93 ms 197240 KB Output is correct
93 Correct 86 ms 197252 KB Output is correct
94 Correct 84 ms 197216 KB Output is correct
95 Correct 93 ms 197284 KB Output is correct
96 Correct 85 ms 197224 KB Output is correct
97 Correct 85 ms 197196 KB Output is correct
98 Correct 89 ms 197252 KB Output is correct
99 Correct 89 ms 197248 KB Output is correct
100 Correct 86 ms 197204 KB Output is correct
101 Correct 86 ms 197272 KB Output is correct
102 Correct 88 ms 197272 KB Output is correct
103 Correct 87 ms 197280 KB Output is correct
104 Correct 88 ms 197232 KB Output is correct
105 Correct 90 ms 197324 KB Output is correct
106 Correct 91 ms 197240 KB Output is correct
107 Correct 91 ms 197196 KB Output is correct
108 Correct 89 ms 197256 KB Output is correct
109 Correct 84 ms 197156 KB Output is correct
110 Correct 84 ms 197228 KB Output is correct
111 Correct 84 ms 197256 KB Output is correct
112 Correct 87 ms 197256 KB Output is correct
113 Correct 92 ms 197376 KB Output is correct
114 Correct 88 ms 197248 KB Output is correct
115 Correct 90 ms 197316 KB Output is correct
116 Correct 98 ms 197364 KB Output is correct
117 Correct 86 ms 197272 KB Output is correct
118 Correct 97 ms 198088 KB Output is correct
119 Correct 105 ms 198224 KB Output is correct
120 Correct 99 ms 198332 KB Output is correct
121 Correct 85 ms 197192 KB Output is correct
122 Correct 93 ms 197272 KB Output is correct
123 Correct 97 ms 197212 KB Output is correct
124 Correct 91 ms 197200 KB Output is correct
125 Correct 97 ms 197280 KB Output is correct
126 Correct 98 ms 197308 KB Output is correct
127 Correct 97 ms 197368 KB Output is correct
128 Correct 90 ms 197372 KB Output is correct
129 Correct 88 ms 197344 KB Output is correct
130 Correct 98 ms 197396 KB Output is correct
131 Correct 87 ms 197400 KB Output is correct
132 Correct 108 ms 198464 KB Output is correct
133 Correct 112 ms 198416 KB Output is correct
134 Correct 105 ms 198500 KB Output is correct
135 Correct 94 ms 197404 KB Output is correct
136 Correct 145 ms 197444 KB Output is correct
137 Correct 163 ms 197580 KB Output is correct
138 Correct 174 ms 197392 KB Output is correct
139 Correct 193 ms 197528 KB Output is correct
140 Correct 172 ms 197596 KB Output is correct
141 Correct 159 ms 198480 KB Output is correct
142 Correct 120 ms 198264 KB Output is correct
143 Correct 181 ms 199048 KB Output is correct
144 Correct 135 ms 198348 KB Output is correct
145 Correct 98 ms 198484 KB Output is correct
146 Correct 219 ms 198624 KB Output is correct
147 Correct 221 ms 198812 KB Output is correct
148 Correct 207 ms 197964 KB Output is correct
149 Correct 132 ms 198888 KB Output is correct
150 Correct 125 ms 197880 KB Output is correct
151 Correct 114 ms 199372 KB Output is correct
152 Correct 107 ms 198248 KB Output is correct
153 Correct 93 ms 198476 KB Output is correct
154 Correct 146 ms 198796 KB Output is correct
155 Correct 101 ms 198184 KB Output is correct
156 Correct 106 ms 198316 KB Output is correct
157 Correct 85 ms 197452 KB Output is correct
158 Correct 149 ms 197576 KB Output is correct
159 Correct 238 ms 197592 KB Output is correct
160 Correct 255 ms 197700 KB Output is correct
161 Correct 249 ms 197628 KB Output is correct
162 Correct 242 ms 197632 KB Output is correct
163 Correct 311 ms 199392 KB Output is correct
164 Correct 344 ms 199404 KB Output is correct
165 Correct 352 ms 199356 KB Output is correct
166 Correct 333 ms 199332 KB Output is correct
167 Correct 363 ms 199252 KB Output is correct
168 Correct 331 ms 199332 KB Output is correct
169 Correct 411 ms 199768 KB Output is correct
170 Correct 359 ms 198552 KB Output is correct
171 Correct 369 ms 199764 KB Output is correct
172 Correct 348 ms 198376 KB Output is correct
173 Correct 335 ms 199744 KB Output is correct
174 Correct 337 ms 198448 KB Output is correct
175 Correct 317 ms 198880 KB Output is correct
176 Correct 235 ms 198912 KB Output is correct
177 Correct 177 ms 198876 KB Output is correct
178 Correct 155 ms 198800 KB Output is correct
179 Correct 85 ms 198032 KB Output is correct
180 Correct 228 ms 198028 KB Output is correct
181 Correct 631 ms 198312 KB Output is correct
182 Correct 913 ms 198632 KB Output is correct
183 Correct 600 ms 198224 KB Output is correct
184 Correct 599 ms 198184 KB Output is correct
185 Execution timed out 1582 ms 201768 KB Time limit exceeded
186 Halted 0 ms 0 KB -