Submission #683883

# Submission time Handle Problem Language Result Execution time Memory
683883 2023-01-19T14:29:26 Z kym Painting Walls (APIO20_paint) C++14
63 / 100
1500 ms 23916 KB
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,s,e) for(int i = s; i <= (int)e; ++i)
#define DEC(i,s,e) for(int i = s; i >= (int)e; --i)
#define IAMSPEED ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef LOCAL
#define db(x) cerr << #x << "=" << x << "\n"
#define db2(x, y) cerr << #x << "=" << x << " , " << #y << "=" << y << "\n"
#define db3(a,b,c) cerr<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"\n"
#define dbv(v) cerr << #v << ":"; for (auto ite : v) cerr << ite << ' '; cerr <<"\n"
#define dbvp(v) cerr << #v << ":"; for (auto ite : v) cerr << "{"  << ite.f << ',' << ite.s << "} "; cerr << "\n"
#define dba(a,ss,ee) cerr << #a << ":"; FOR(ite,ss,ee) cerr << a[ite] << ' '; cerr << "\n"
#define reach cerr << "LINE: " << __LINE__ << "\n";
#else
#define reach 
#define db(x)
#define db2(x,y)
#define db3(a,b,c)
#define dbv(v)
#define dbvp(v)
#define dba(a,ss,ee)
#endif
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define f first 
#define s second
#define g0(x) get<0>(x)
#define g1(x) get<1>(x)
#define g2(x) get<2>(x)
#define g3(x) get<3>(x)
typedef pair <int, int> pi;
typedef tuple<int,int,int> ti3;
typedef tuple<int,int,int,int> ti4;
int rand(int a, int b) { return a + rng() % (b-a+1); }
const int MOD = 1e9 + 7;
const int inf = (int)1e9 + 500;
const long long oo = (long long)1e18 + 500;
template <typename T> bool chmax(T& a, const T b) { return a<b ? a = b, 1 : 0; }
template <typename T> bool chmin(T& a, const T b) { return a>b ? a = b, 1 : 0; }
const int MAXN = 100005;
int D[MAXN];
unordered_map<int,int> dp[2];
int store[MAXN];
vector<int> V[MAXN]; // contractors of this colour
bool can[MAXN];
struct node {
    int s,e,m,val;
    node *l, *r;
    node(int _s, int _e) {
        s=_s;e=_e;
        m=(s+e)/2;
        val=inf;
        if(s!=e) {
            l=new node(s,m);
            r=new node(m+1,e);
        }
    }
    void update(int x, int nval) {
        if(s==e) {
            val=nval;
            return;
        }
        if(x>m)r->update(x,nval);
        else l->update(x,nval);
        val=min(l->val,r->val);
    }
    int query(int x, int y) {
        if(s==x&&e==y) return val;
        if(x>m) return r->query(x,y);
        else if(y<=m) return l->query(x,y);
        else return min(l->query(x,m), r->query(m+1,y));
    }
} *seg;

int minimumInstructions(
    int n, int m, int k, std::vector<int> C,
    std::vector<int> A, std::vector<std::vector<int>> B) {
    seg=new node(0,n);
    
    FOR(i,0,m-1) { // this contractor
        int y=A[i];
        FOR(j,0,y-1) { // V[i] -> the indices of contractors of this index.
            V[B[i][j]].pb(i);
        }
    } 
    FOR(i,1,MAXN)D[i]=inf;
    D[0]=0;
    bool alt;
    FOR(i,0,n-1) {
        alt=i%2;
        dp[alt].clear();
        for(auto x:V[C[i]]) {
            // index of contractor that can paint this place
            // for continuous segment, all V values are the same
            // store longest segment of this same value
            int V=i-x;
            chmax(dp[alt][V],dp[1-alt][V]+1);
        }
        //dp[alt] has a size of f(i)
        store[i]=dp[alt][i-(m-1)];

        //now check if i can cover from [i-m+1 to i]
        int st=i-m+1;
        if(st<0)continue;
        for(auto x:dp[alt]) {//f(i)
            int idx=-(x.f-i); // idx of the contractor
            int len=min(x.s,idx+1);
            if(idx == m-1) {
                if(len>=m){
                    can[i]=1;
                    break;
                }
            }
            if(idx>=len)continue;
            //idx<len
            int curidx=i-len;
            if(curidx<0){
                continue;
            }
            int req=m-len;
            
            if(store[curidx]>=req){
                can[i]=1;
                break;
            }
        }
    
    }
    seg->update(0,0);
    FOR(i,m,n) { // this is thing should be one indexed
        if(!can[i-1])continue;
        chmin(D[i], seg->query(i-m, i-1) + 1);
        seg->update(i, D[i]);
    }
    if(D[n]>=inf)return -1;
    else return D[n];


}

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:88:22: warning: iteration 100004 invokes undefined behavior [-Waggressive-loop-optimizations]
   88 |     FOR(i,1,MAXN)D[i]=inf;
      |                  ~~~~^~~~
paint.cpp:3:37: note: within this loop
    3 | #define FOR(i,s,e) for(int i = s; i <= (int)e; ++i)
......
   88 |     FOR(i,1,MAXN)D[i]=inf;
      |         ~~~~~~~~                     
paint.cpp:88:5: note: in expansion of macro 'FOR'
   88 |     FOR(i,1,MAXN)D[i]=inf;
      |     ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3028 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3052 KB Output is correct
4 Correct 2 ms 3028 KB Output is correct
5 Correct 2 ms 3028 KB Output is correct
6 Correct 2 ms 3052 KB Output is correct
7 Correct 2 ms 3048 KB Output is correct
8 Correct 2 ms 3028 KB Output is correct
9 Correct 2 ms 3052 KB Output is correct
10 Correct 2 ms 3048 KB Output is correct
11 Correct 3 ms 3052 KB Output is correct
12 Correct 3 ms 3052 KB Output is correct
13 Correct 2 ms 3156 KB Output is correct
14 Correct 3 ms 3052 KB Output is correct
15 Correct 3 ms 3076 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 3 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 3156 KB Output is correct
20 Correct 2 ms 3156 KB Output is correct
21 Correct 3 ms 3156 KB Output is correct
22 Correct 22 ms 7500 KB Output is correct
23 Correct 25 ms 7544 KB Output is correct
24 Correct 20 ms 7600 KB Output is correct
25 Correct 10 ms 5204 KB Output is correct
26 Correct 10 ms 5216 KB Output is correct
27 Correct 10 ms 5228 KB Output is correct
28 Correct 8 ms 5204 KB Output is correct
29 Correct 8 ms 5108 KB Output is correct
30 Correct 7 ms 5116 KB Output is correct
31 Correct 20 ms 6272 KB Output is correct
32 Correct 16 ms 6304 KB Output is correct
33 Correct 18 ms 6300 KB Output is correct
34 Correct 18 ms 6292 KB Output is correct
35 Correct 16 ms 6312 KB Output is correct
36 Correct 17 ms 6228 KB Output is correct
37 Correct 29 ms 9888 KB Output is correct
38 Correct 28 ms 9892 KB Output is correct
39 Correct 26 ms 9804 KB Output is correct
40 Correct 36 ms 12884 KB Output is correct
41 Correct 24 ms 9172 KB Output is correct
42 Correct 35 ms 13664 KB Output is correct
43 Correct 21 ms 10060 KB Output is correct
44 Correct 17 ms 9428 KB Output is correct
45 Correct 28 ms 13800 KB Output is correct
46 Correct 63 ms 21668 KB Output is correct
47 Correct 41 ms 14124 KB Output is correct
48 Correct 39 ms 16672 KB Output is correct
49 Correct 51 ms 17472 KB Output is correct
50 Correct 54 ms 18168 KB Output is correct
51 Correct 41 ms 16124 KB Output is correct
52 Correct 40 ms 13888 KB Output is correct
53 Correct 39 ms 13908 KB Output is correct
54 Correct 36 ms 13772 KB Output is correct
55 Correct 30 ms 13880 KB Output is correct
56 Correct 37 ms 13772 KB Output is correct
57 Correct 27 ms 13864 KB Output is correct
58 Correct 73 ms 23868 KB Output is correct
59 Correct 79 ms 23872 KB Output is correct
60 Correct 73 ms 23912 KB Output is correct
61 Correct 84 ms 23836 KB Output is correct
62 Correct 71 ms 23884 KB Output is correct
63 Correct 72 ms 23916 KB Output is correct
64 Correct 66 ms 22968 KB Output is correct
65 Correct 71 ms 23012 KB Output is correct
66 Correct 74 ms 23072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3028 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3052 KB Output is correct
4 Correct 2 ms 3028 KB Output is correct
5 Correct 2 ms 3028 KB Output is correct
6 Correct 2 ms 3052 KB Output is correct
7 Correct 2 ms 3048 KB Output is correct
8 Correct 2 ms 3028 KB Output is correct
9 Correct 2 ms 3052 KB Output is correct
10 Correct 2 ms 3048 KB Output is correct
11 Correct 3 ms 3052 KB Output is correct
12 Correct 3 ms 3052 KB Output is correct
13 Correct 2 ms 3156 KB Output is correct
14 Correct 3 ms 3052 KB Output is correct
15 Correct 3 ms 3076 KB Output is correct
16 Correct 2 ms 3028 KB Output is correct
17 Correct 3 ms 3028 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 2 ms 3156 KB Output is correct
20 Correct 2 ms 3156 KB Output is correct
21 Correct 3 ms 3156 KB Output is correct
22 Correct 2 ms 3052 KB Output is correct
23 Correct 2 ms 3028 KB Output is correct
24 Correct 1 ms 3028 KB Output is correct
25 Correct 2 ms 3028 KB Output is correct
26 Correct 2 ms 3056 KB Output is correct
27 Correct 2 ms 3056 KB Output is correct
28 Correct 2 ms 3028 KB Output is correct
29 Correct 2 ms 3052 KB Output is correct
30 Correct 2 ms 3028 KB Output is correct
31 Correct 2 ms 3028 KB Output is correct
32 Correct 2 ms 3048 KB Output is correct
33 Correct 2 ms 3052 KB Output is correct
34 Correct 2 ms 3028 KB Output is correct
35 Correct 2 ms 3028 KB Output is correct
36 Correct 3 ms 3076 KB Output is correct
37 Correct 2 ms 3052 KB Output is correct
38 Correct 3 ms 3052 KB Output is correct
39 Correct 2 ms 3028 KB Output is correct
40 Correct 2 ms 3028 KB Output is correct
41 Correct 2 ms 3028 KB Output is correct
42 Correct 2 ms 3028 KB Output is correct
43 Correct 2 ms 3028 KB Output is correct
44 Correct 2 ms 3028 KB Output is correct
45 Correct 2 ms 3052 KB Output is correct
46 Correct 2 ms 3028 KB Output is correct
47 Correct 3 ms 3028 KB Output is correct
48 Correct 2 ms 3028 KB Output is correct
49 Correct 2 ms 3028 KB Output is correct
50 Correct 2 ms 3056 KB Output is correct
51 Correct 2 ms 3056 KB Output is correct
52 Correct 2 ms 3156 KB Output is correct
53 Correct 2 ms 3056 KB Output is correct
54 Correct 2 ms 3156 KB Output is correct
55 Correct 2 ms 3156 KB Output is correct
56 Correct 2 ms 3060 KB Output is correct
57 Correct 2 ms 3040 KB Output is correct
58 Correct 3 ms 3064 KB Output is correct
59 Correct 2 ms 3028 KB Output is correct
60 Correct 2 ms 3156 KB Output is correct
61 Correct 2 ms 3028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3052 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 3028 KB Output is correct
5 Correct 2 ms 3052 KB Output is correct
6 Correct 2 ms 3028 KB Output is correct
7 Correct 2 ms 3028 KB Output is correct
8 Correct 2 ms 3052 KB Output is correct
9 Correct 2 ms 3048 KB Output is correct
10 Correct 2 ms 3028 KB Output is correct
11 Correct 2 ms 3052 KB Output is correct
12 Correct 2 ms 3048 KB Output is correct
13 Correct 3 ms 3052 KB Output is correct
14 Correct 3 ms 3052 KB Output is correct
15 Correct 2 ms 3156 KB Output is correct
16 Correct 3 ms 3052 KB Output is correct
17 Correct 3 ms 3076 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 3 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 3156 KB Output is correct
22 Correct 2 ms 3156 KB Output is correct
23 Correct 3 ms 3156 KB Output is correct
24 Correct 22 ms 7500 KB Output is correct
25 Correct 25 ms 7544 KB Output is correct
26 Correct 20 ms 7600 KB Output is correct
27 Correct 1 ms 3028 KB Output is correct
28 Correct 2 ms 3028 KB Output is correct
29 Correct 2 ms 3056 KB Output is correct
30 Correct 2 ms 3056 KB Output is correct
31 Correct 2 ms 3028 KB Output is correct
32 Correct 2 ms 3052 KB Output is correct
33 Correct 2 ms 3028 KB Output is correct
34 Correct 2 ms 3028 KB Output is correct
35 Correct 2 ms 3048 KB Output is correct
36 Correct 2 ms 3052 KB Output is correct
37 Correct 2 ms 3028 KB Output is correct
38 Correct 2 ms 3028 KB Output is correct
39 Correct 3 ms 3076 KB Output is correct
40 Correct 2 ms 3052 KB Output is correct
41 Correct 3 ms 3052 KB Output is correct
42 Correct 2 ms 3028 KB Output is correct
43 Correct 2 ms 3028 KB Output is correct
44 Correct 2 ms 3028 KB Output is correct
45 Correct 2 ms 3028 KB Output is correct
46 Correct 2 ms 3028 KB Output is correct
47 Correct 2 ms 3028 KB Output is correct
48 Correct 2 ms 3052 KB Output is correct
49 Correct 2 ms 3028 KB Output is correct
50 Correct 3 ms 3028 KB Output is correct
51 Correct 2 ms 3028 KB Output is correct
52 Correct 2 ms 3028 KB Output is correct
53 Correct 2 ms 3056 KB Output is correct
54 Correct 2 ms 3056 KB Output is correct
55 Correct 2 ms 3156 KB Output is correct
56 Correct 2 ms 3056 KB Output is correct
57 Correct 2 ms 3156 KB Output is correct
58 Correct 2 ms 3156 KB Output is correct
59 Correct 2 ms 3060 KB Output is correct
60 Correct 2 ms 3040 KB Output is correct
61 Correct 3 ms 3064 KB Output is correct
62 Correct 2 ms 3028 KB Output is correct
63 Correct 2 ms 3156 KB Output is correct
64 Correct 2 ms 3028 KB Output is correct
65 Correct 4 ms 3028 KB Output is correct
66 Correct 3 ms 3028 KB Output is correct
67 Correct 5 ms 3028 KB Output is correct
68 Correct 3 ms 3028 KB Output is correct
69 Correct 4 ms 3028 KB Output is correct
70 Correct 4 ms 3324 KB Output is correct
71 Correct 4 ms 3376 KB Output is correct
72 Correct 4 ms 3284 KB Output is correct
73 Correct 3 ms 3188 KB Output is correct
74 Correct 4 ms 3256 KB Output is correct
75 Correct 3 ms 3288 KB Output is correct
76 Correct 21 ms 6292 KB Output is correct
77 Correct 19 ms 6904 KB Output is correct
78 Correct 24 ms 7336 KB Output is correct
79 Correct 6 ms 3028 KB Output is correct
80 Correct 8 ms 3144 KB Output is correct
81 Correct 6 ms 3052 KB Output is correct
82 Correct 6 ms 3156 KB Output is correct
83 Correct 7 ms 3156 KB Output is correct
84 Correct 4 ms 3408 KB Output is correct
85 Correct 4 ms 3412 KB Output is correct
86 Correct 5 ms 3448 KB Output is correct
87 Correct 4 ms 3400 KB Output is correct
88 Correct 5 ms 3412 KB Output is correct
89 Correct 4 ms 3400 KB Output is correct
90 Correct 28 ms 7632 KB Output is correct
91 Correct 30 ms 7660 KB Output is correct
92 Correct 30 ms 7724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3052 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 3028 KB Output is correct
5 Correct 2 ms 3052 KB Output is correct
6 Correct 2 ms 3028 KB Output is correct
7 Correct 2 ms 3028 KB Output is correct
8 Correct 2 ms 3052 KB Output is correct
9 Correct 2 ms 3048 KB Output is correct
10 Correct 2 ms 3028 KB Output is correct
11 Correct 2 ms 3052 KB Output is correct
12 Correct 2 ms 3048 KB Output is correct
13 Correct 3 ms 3052 KB Output is correct
14 Correct 3 ms 3052 KB Output is correct
15 Correct 2 ms 3156 KB Output is correct
16 Correct 3 ms 3052 KB Output is correct
17 Correct 3 ms 3076 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 3 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 3156 KB Output is correct
22 Correct 2 ms 3156 KB Output is correct
23 Correct 3 ms 3156 KB Output is correct
24 Correct 22 ms 7500 KB Output is correct
25 Correct 25 ms 7544 KB Output is correct
26 Correct 20 ms 7600 KB Output is correct
27 Correct 10 ms 5204 KB Output is correct
28 Correct 10 ms 5216 KB Output is correct
29 Correct 10 ms 5228 KB Output is correct
30 Correct 8 ms 5204 KB Output is correct
31 Correct 8 ms 5108 KB Output is correct
32 Correct 7 ms 5116 KB Output is correct
33 Correct 20 ms 6272 KB Output is correct
34 Correct 16 ms 6304 KB Output is correct
35 Correct 18 ms 6300 KB Output is correct
36 Correct 18 ms 6292 KB Output is correct
37 Correct 16 ms 6312 KB Output is correct
38 Correct 17 ms 6228 KB Output is correct
39 Correct 29 ms 9888 KB Output is correct
40 Correct 28 ms 9892 KB Output is correct
41 Correct 26 ms 9804 KB Output is correct
42 Correct 1 ms 3028 KB Output is correct
43 Correct 2 ms 3028 KB Output is correct
44 Correct 2 ms 3056 KB Output is correct
45 Correct 2 ms 3056 KB Output is correct
46 Correct 2 ms 3028 KB Output is correct
47 Correct 2 ms 3052 KB Output is correct
48 Correct 2 ms 3028 KB Output is correct
49 Correct 2 ms 3028 KB Output is correct
50 Correct 2 ms 3048 KB Output is correct
51 Correct 2 ms 3052 KB Output is correct
52 Correct 2 ms 3028 KB Output is correct
53 Correct 2 ms 3028 KB Output is correct
54 Correct 3 ms 3076 KB Output is correct
55 Correct 2 ms 3052 KB Output is correct
56 Correct 3 ms 3052 KB Output is correct
57 Correct 2 ms 3028 KB Output is correct
58 Correct 2 ms 3028 KB Output is correct
59 Correct 2 ms 3028 KB Output is correct
60 Correct 2 ms 3028 KB Output is correct
61 Correct 2 ms 3028 KB Output is correct
62 Correct 2 ms 3028 KB Output is correct
63 Correct 2 ms 3052 KB Output is correct
64 Correct 2 ms 3028 KB Output is correct
65 Correct 3 ms 3028 KB Output is correct
66 Correct 2 ms 3028 KB Output is correct
67 Correct 2 ms 3028 KB Output is correct
68 Correct 2 ms 3056 KB Output is correct
69 Correct 2 ms 3056 KB Output is correct
70 Correct 2 ms 3156 KB Output is correct
71 Correct 2 ms 3056 KB Output is correct
72 Correct 2 ms 3156 KB Output is correct
73 Correct 2 ms 3156 KB Output is correct
74 Correct 2 ms 3060 KB Output is correct
75 Correct 2 ms 3040 KB Output is correct
76 Correct 3 ms 3064 KB Output is correct
77 Correct 2 ms 3028 KB Output is correct
78 Correct 2 ms 3156 KB Output is correct
79 Correct 2 ms 3028 KB Output is correct
80 Correct 4 ms 3028 KB Output is correct
81 Correct 3 ms 3028 KB Output is correct
82 Correct 5 ms 3028 KB Output is correct
83 Correct 3 ms 3028 KB Output is correct
84 Correct 4 ms 3028 KB Output is correct
85 Correct 4 ms 3324 KB Output is correct
86 Correct 4 ms 3376 KB Output is correct
87 Correct 4 ms 3284 KB Output is correct
88 Correct 3 ms 3188 KB Output is correct
89 Correct 4 ms 3256 KB Output is correct
90 Correct 3 ms 3288 KB Output is correct
91 Correct 21 ms 6292 KB Output is correct
92 Correct 19 ms 6904 KB Output is correct
93 Correct 24 ms 7336 KB Output is correct
94 Correct 6 ms 3028 KB Output is correct
95 Correct 8 ms 3144 KB Output is correct
96 Correct 6 ms 3052 KB Output is correct
97 Correct 6 ms 3156 KB Output is correct
98 Correct 7 ms 3156 KB Output is correct
99 Correct 4 ms 3408 KB Output is correct
100 Correct 4 ms 3412 KB Output is correct
101 Correct 5 ms 3448 KB Output is correct
102 Correct 4 ms 3400 KB Output is correct
103 Correct 5 ms 3412 KB Output is correct
104 Correct 4 ms 3400 KB Output is correct
105 Correct 28 ms 7632 KB Output is correct
106 Correct 30 ms 7660 KB Output is correct
107 Correct 30 ms 7724 KB Output is correct
108 Correct 12 ms 5204 KB Output is correct
109 Correct 380 ms 4748 KB Output is correct
110 Correct 318 ms 4436 KB Output is correct
111 Correct 267 ms 4404 KB Output is correct
112 Correct 312 ms 4868 KB Output is correct
113 Correct 227 ms 4320 KB Output is correct
114 Correct 21 ms 5716 KB Output is correct
115 Correct 18 ms 5496 KB Output is correct
116 Correct 30 ms 6612 KB Output is correct
117 Correct 18 ms 5588 KB Output is correct
118 Correct 21 ms 6024 KB Output is correct
119 Correct 17 ms 5752 KB Output is correct
120 Correct 20 ms 7152 KB Output is correct
121 Correct 10 ms 4792 KB Output is correct
122 Correct 29 ms 7508 KB Output is correct
123 Correct 10 ms 4692 KB Output is correct
124 Correct 28 ms 8744 KB Output is correct
125 Correct 17 ms 5716 KB Output is correct
126 Correct 12 ms 5460 KB Output is correct
127 Correct 11 ms 6100 KB Output is correct
128 Correct 9 ms 5248 KB Output is correct
129 Correct 9 ms 5344 KB Output is correct
130 Correct 9 ms 5144 KB Output is correct
131 Correct 538 ms 5256 KB Output is correct
132 Correct 611 ms 5324 KB Output is correct
133 Correct 517 ms 5424 KB Output is correct
134 Correct 474 ms 5300 KB Output is correct
135 Correct 465 ms 5344 KB Output is correct
136 Correct 27 ms 7124 KB Output is correct
137 Correct 32 ms 7152 KB Output is correct
138 Correct 26 ms 7124 KB Output is correct
139 Correct 27 ms 7080 KB Output is correct
140 Correct 28 ms 7160 KB Output is correct
141 Correct 25 ms 7148 KB Output is correct
142 Correct 34 ms 10008 KB Output is correct
143 Correct 17 ms 6100 KB Output is correct
144 Correct 42 ms 9972 KB Output is correct
145 Correct 17 ms 6052 KB Output is correct
146 Correct 41 ms 10060 KB Output is correct
147 Correct 18 ms 6100 KB Output is correct
148 Correct 14 ms 6528 KB Output is correct
149 Correct 14 ms 6472 KB Output is correct
150 Correct 14 ms 6400 KB Output is correct
151 Correct 14 ms 6352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3052 KB Output is correct
2 Correct 2 ms 3028 KB Output is correct
3 Correct 2 ms 3028 KB Output is correct
4 Correct 2 ms 3028 KB Output is correct
5 Correct 2 ms 3052 KB Output is correct
6 Correct 2 ms 3028 KB Output is correct
7 Correct 2 ms 3028 KB Output is correct
8 Correct 2 ms 3052 KB Output is correct
9 Correct 2 ms 3048 KB Output is correct
10 Correct 2 ms 3028 KB Output is correct
11 Correct 2 ms 3052 KB Output is correct
12 Correct 2 ms 3048 KB Output is correct
13 Correct 3 ms 3052 KB Output is correct
14 Correct 3 ms 3052 KB Output is correct
15 Correct 2 ms 3156 KB Output is correct
16 Correct 3 ms 3052 KB Output is correct
17 Correct 3 ms 3076 KB Output is correct
18 Correct 2 ms 3028 KB Output is correct
19 Correct 3 ms 3028 KB Output is correct
20 Correct 2 ms 3028 KB Output is correct
21 Correct 2 ms 3156 KB Output is correct
22 Correct 2 ms 3156 KB Output is correct
23 Correct 3 ms 3156 KB Output is correct
24 Correct 22 ms 7500 KB Output is correct
25 Correct 25 ms 7544 KB Output is correct
26 Correct 20 ms 7600 KB Output is correct
27 Correct 10 ms 5204 KB Output is correct
28 Correct 10 ms 5216 KB Output is correct
29 Correct 10 ms 5228 KB Output is correct
30 Correct 8 ms 5204 KB Output is correct
31 Correct 8 ms 5108 KB Output is correct
32 Correct 7 ms 5116 KB Output is correct
33 Correct 20 ms 6272 KB Output is correct
34 Correct 16 ms 6304 KB Output is correct
35 Correct 18 ms 6300 KB Output is correct
36 Correct 18 ms 6292 KB Output is correct
37 Correct 16 ms 6312 KB Output is correct
38 Correct 17 ms 6228 KB Output is correct
39 Correct 29 ms 9888 KB Output is correct
40 Correct 28 ms 9892 KB Output is correct
41 Correct 26 ms 9804 KB Output is correct
42 Correct 36 ms 12884 KB Output is correct
43 Correct 24 ms 9172 KB Output is correct
44 Correct 35 ms 13664 KB Output is correct
45 Correct 21 ms 10060 KB Output is correct
46 Correct 17 ms 9428 KB Output is correct
47 Correct 28 ms 13800 KB Output is correct
48 Correct 63 ms 21668 KB Output is correct
49 Correct 41 ms 14124 KB Output is correct
50 Correct 39 ms 16672 KB Output is correct
51 Correct 51 ms 17472 KB Output is correct
52 Correct 54 ms 18168 KB Output is correct
53 Correct 41 ms 16124 KB Output is correct
54 Correct 40 ms 13888 KB Output is correct
55 Correct 39 ms 13908 KB Output is correct
56 Correct 36 ms 13772 KB Output is correct
57 Correct 30 ms 13880 KB Output is correct
58 Correct 37 ms 13772 KB Output is correct
59 Correct 27 ms 13864 KB Output is correct
60 Correct 73 ms 23868 KB Output is correct
61 Correct 79 ms 23872 KB Output is correct
62 Correct 73 ms 23912 KB Output is correct
63 Correct 84 ms 23836 KB Output is correct
64 Correct 71 ms 23884 KB Output is correct
65 Correct 72 ms 23916 KB Output is correct
66 Correct 66 ms 22968 KB Output is correct
67 Correct 71 ms 23012 KB Output is correct
68 Correct 74 ms 23072 KB Output is correct
69 Correct 1 ms 3028 KB Output is correct
70 Correct 2 ms 3028 KB Output is correct
71 Correct 2 ms 3056 KB Output is correct
72 Correct 2 ms 3056 KB Output is correct
73 Correct 2 ms 3028 KB Output is correct
74 Correct 2 ms 3052 KB Output is correct
75 Correct 2 ms 3028 KB Output is correct
76 Correct 2 ms 3028 KB Output is correct
77 Correct 2 ms 3048 KB Output is correct
78 Correct 2 ms 3052 KB Output is correct
79 Correct 2 ms 3028 KB Output is correct
80 Correct 2 ms 3028 KB Output is correct
81 Correct 3 ms 3076 KB Output is correct
82 Correct 2 ms 3052 KB Output is correct
83 Correct 3 ms 3052 KB Output is correct
84 Correct 2 ms 3028 KB Output is correct
85 Correct 2 ms 3028 KB Output is correct
86 Correct 2 ms 3028 KB Output is correct
87 Correct 2 ms 3028 KB Output is correct
88 Correct 2 ms 3028 KB Output is correct
89 Correct 2 ms 3028 KB Output is correct
90 Correct 2 ms 3052 KB Output is correct
91 Correct 2 ms 3028 KB Output is correct
92 Correct 3 ms 3028 KB Output is correct
93 Correct 2 ms 3028 KB Output is correct
94 Correct 2 ms 3028 KB Output is correct
95 Correct 2 ms 3056 KB Output is correct
96 Correct 2 ms 3056 KB Output is correct
97 Correct 2 ms 3156 KB Output is correct
98 Correct 2 ms 3056 KB Output is correct
99 Correct 2 ms 3156 KB Output is correct
100 Correct 2 ms 3156 KB Output is correct
101 Correct 2 ms 3060 KB Output is correct
102 Correct 2 ms 3040 KB Output is correct
103 Correct 3 ms 3064 KB Output is correct
104 Correct 2 ms 3028 KB Output is correct
105 Correct 2 ms 3156 KB Output is correct
106 Correct 2 ms 3028 KB Output is correct
107 Correct 4 ms 3028 KB Output is correct
108 Correct 3 ms 3028 KB Output is correct
109 Correct 5 ms 3028 KB Output is correct
110 Correct 3 ms 3028 KB Output is correct
111 Correct 4 ms 3028 KB Output is correct
112 Correct 4 ms 3324 KB Output is correct
113 Correct 4 ms 3376 KB Output is correct
114 Correct 4 ms 3284 KB Output is correct
115 Correct 3 ms 3188 KB Output is correct
116 Correct 4 ms 3256 KB Output is correct
117 Correct 3 ms 3288 KB Output is correct
118 Correct 21 ms 6292 KB Output is correct
119 Correct 19 ms 6904 KB Output is correct
120 Correct 24 ms 7336 KB Output is correct
121 Correct 6 ms 3028 KB Output is correct
122 Correct 8 ms 3144 KB Output is correct
123 Correct 6 ms 3052 KB Output is correct
124 Correct 6 ms 3156 KB Output is correct
125 Correct 7 ms 3156 KB Output is correct
126 Correct 4 ms 3408 KB Output is correct
127 Correct 4 ms 3412 KB Output is correct
128 Correct 5 ms 3448 KB Output is correct
129 Correct 4 ms 3400 KB Output is correct
130 Correct 5 ms 3412 KB Output is correct
131 Correct 4 ms 3400 KB Output is correct
132 Correct 28 ms 7632 KB Output is correct
133 Correct 30 ms 7660 KB Output is correct
134 Correct 30 ms 7724 KB Output is correct
135 Correct 12 ms 5204 KB Output is correct
136 Correct 380 ms 4748 KB Output is correct
137 Correct 318 ms 4436 KB Output is correct
138 Correct 267 ms 4404 KB Output is correct
139 Correct 312 ms 4868 KB Output is correct
140 Correct 227 ms 4320 KB Output is correct
141 Correct 21 ms 5716 KB Output is correct
142 Correct 18 ms 5496 KB Output is correct
143 Correct 30 ms 6612 KB Output is correct
144 Correct 18 ms 5588 KB Output is correct
145 Correct 21 ms 6024 KB Output is correct
146 Correct 17 ms 5752 KB Output is correct
147 Correct 20 ms 7152 KB Output is correct
148 Correct 10 ms 4792 KB Output is correct
149 Correct 29 ms 7508 KB Output is correct
150 Correct 10 ms 4692 KB Output is correct
151 Correct 28 ms 8744 KB Output is correct
152 Correct 17 ms 5716 KB Output is correct
153 Correct 12 ms 5460 KB Output is correct
154 Correct 11 ms 6100 KB Output is correct
155 Correct 9 ms 5248 KB Output is correct
156 Correct 9 ms 5344 KB Output is correct
157 Correct 9 ms 5144 KB Output is correct
158 Correct 538 ms 5256 KB Output is correct
159 Correct 611 ms 5324 KB Output is correct
160 Correct 517 ms 5424 KB Output is correct
161 Correct 474 ms 5300 KB Output is correct
162 Correct 465 ms 5344 KB Output is correct
163 Correct 27 ms 7124 KB Output is correct
164 Correct 32 ms 7152 KB Output is correct
165 Correct 26 ms 7124 KB Output is correct
166 Correct 27 ms 7080 KB Output is correct
167 Correct 28 ms 7160 KB Output is correct
168 Correct 25 ms 7148 KB Output is correct
169 Correct 34 ms 10008 KB Output is correct
170 Correct 17 ms 6100 KB Output is correct
171 Correct 42 ms 9972 KB Output is correct
172 Correct 17 ms 6052 KB Output is correct
173 Correct 41 ms 10060 KB Output is correct
174 Correct 18 ms 6100 KB Output is correct
175 Correct 14 ms 6528 KB Output is correct
176 Correct 14 ms 6472 KB Output is correct
177 Correct 14 ms 6400 KB Output is correct
178 Correct 14 ms 6352 KB Output is correct
179 Correct 28 ms 9684 KB Output is correct
180 Correct 1094 ms 8736 KB Output is correct
181 Execution timed out 1593 ms 11212 KB Time limit exceeded
182 Halted 0 ms 0 KB -