Submission #580320

# Submission time Handle Problem Language Result Execution time Memory
580320 2022-06-21T05:19:58 Z haojiandan Uplifting Excursion (BOI22_vault) C++14
100 / 100
1501 ms 7172 KB
// wygzgyw
#include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
    t=0; char ch=getchar(); int f=1;
    while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
    do { (t*=10)+=ch-'0'; ch=getchar(); } while ('0'<=ch&&ch<='9'); t*=f;
}
template <typename T> void write(T t) {
    if (t<0) { putchar('-'); write(-t); return; }
    if (t>9) write(t/10);
    putchar('0'+t%10);
}
template <typename T> void writeln(T t) { write(t); puts(""); }
#define MP make_pair
typedef long long ll;
const int maxn=300*300+10;
const ll INF=1e18;
int m;
ll rub[maxn];
ll L,sum,ans;
ll *a,*b,*now=rub;
ll f[maxn*2],g[maxn*2];
int N=300*300+2;
ll l,r;
int hd,tl,q[maxn*2];
ll dp[maxn*2];
void solve(vector<int> &V,int flag) {
    for (int i=0;i<V.size();i++) g[V[i]]=-INF;
    hd=1,tl=0;
    int R=-1;
    for (int i=0;i<V.size();i++) {
        while (R+1<V.size()&&R+1<=i+r) {
            R++;
            ll tmp=f[V[R]]+(flag?-R:R);
            while (hd<=tl&&dp[tl]<tmp) tl--;
            q[++tl]=R,dp[tl]=tmp;
        }
        while (hd<=tl&&q[hd]<i+l) hd++;
        assert(hd<=tl);
        g[V[i]]=dp[hd]+(flag?i:-i);
    }/*
    for (int i=0;i<V.size();i++) {
        g[V[i]]=-INF;
        for (int j=max(0LL,i+l);j<=i+r&&j<V.size();j++) {
            g[V[i]]=max(g[V[i]],f[V[j]]+(flag?i-j:j-i));
        }
    }*/
}
int main() {
    //freopen("1.txt","r",stdin);
    read(m); read(L);
    now+=m,a=now,now+=m+1,now+=m,b=now,now+=m+1;
    for (int i=-m;i<=m;i++) read(a[i]),sum+=a[i]*i;
    if (sum<L) {
        reverse(a-m,a+m+1),sum*=-1,L*=-1;
    }
    sum=0; for (int i=-m;i<0;i++) sum+=a[i]*i,b[i]=a[i];
    if (sum>L) { puts("impossible"); return 0; }
    for (int i=0;i<=m;i++) {
        if (!i) b[i]=a[i]; else b[i]=min(a[i],(L-sum)/i);
        sum+=b[i]*i;
        //printf(" %lld\n",b[i]);
    }
    //printf("%lld %lld\n",sum,L);
    for (int i=-m;i<=m;i++) ans+=b[i];
    //printf("> %lld\n",ans);
    //N=10;
    for (int i=-N;i<=N;i++) f[i+N]=-INF;
    f[N]=0;
    for (int i=-m;i<=m;i++) if (i!=0) {
        if (i<0) l=0,r=a[i]; else l=-b[i],r=a[i]-b[i];
        //printf(" %d %lld %lld\n",i,abs(i)*l,abs(i)*r);
        l*=-1,r*=-1,swap(l,r);
        vector<int> V1;
        for (int j=0;j<abs(i);j++) {
            V1.clear();
            for (int k=j;k>=-N;k-=abs(i)) V1.push_back(k+N);
            reverse(V1.begin(),V1.end());
            for (int k=j+abs(i);k<N;k+=abs(i)) V1.push_back(k+N);
            solve(V1,(i>0?1:0));
        }
        for (int j=0;j<N*2;j++) f[j]=g[j];
    }
    //printf("> %lld %lld\n",L-sum,f[L-sum+N]);
    if (f[L-sum+N]+ans>=0) printf("%lld\n",f[L-sum+N]+ans);
    else puts("impossible");
    return 0;
}
/*
  0. Enough array size? Enough array size? Enough array size? Integer overflow?
 
  1. Think TWICE, Code ONCE!
  Are there any counterexamples to your algo?
   
  2. Be careful about the BOUNDARIES!
  N=1? P=1? Something about 0?
   
  3. Do not make STUPID MISTAKES!
  Time complexity? Memory usage? Precision error?
*/

Compilation message

vault.cpp: In function 'void solve(std::vector<int>&, int)':
vault.cpp:29:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for (int i=0;i<V.size();i++) g[V[i]]=-INF;
      |                  ~^~~~~~~~~
vault.cpp:32:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i=0;i<V.size();i++) {
      |                  ~^~~~~~~~~
vault.cpp:33:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         while (R+1<V.size()&&R+1<=i+r) {
      |                ~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 12 ms 6960 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 9 ms 6920 KB Output is correct
4 Correct 47 ms 6988 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 219 ms 6996 KB Output is correct
7 Correct 237 ms 6968 KB Output is correct
8 Correct 221 ms 6944 KB Output is correct
9 Correct 241 ms 7072 KB Output is correct
10 Correct 243 ms 6992 KB Output is correct
11 Correct 217 ms 7096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 6960 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 9 ms 6920 KB Output is correct
4 Correct 47 ms 6988 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 219 ms 6996 KB Output is correct
7 Correct 237 ms 6968 KB Output is correct
8 Correct 221 ms 6944 KB Output is correct
9 Correct 241 ms 7072 KB Output is correct
10 Correct 243 ms 6992 KB Output is correct
11 Correct 217 ms 7096 KB Output is correct
12 Correct 12 ms 6936 KB Output is correct
13 Correct 18 ms 6972 KB Output is correct
14 Correct 8 ms 6920 KB Output is correct
15 Correct 48 ms 6988 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 234 ms 6872 KB Output is correct
18 Correct 245 ms 6956 KB Output is correct
19 Correct 230 ms 6868 KB Output is correct
20 Correct 228 ms 6876 KB Output is correct
21 Correct 234 ms 6940 KB Output is correct
22 Correct 225 ms 6872 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 468 ms 6892 KB Output is correct
25 Correct 488 ms 6968 KB Output is correct
26 Correct 489 ms 6876 KB Output is correct
27 Correct 463 ms 6968 KB Output is correct
28 Correct 464 ms 6928 KB Output is correct
29 Correct 426 ms 6968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 6908 KB Output is correct
2 Correct 141 ms 6976 KB Output is correct
3 Correct 137 ms 6900 KB Output is correct
4 Correct 147 ms 6972 KB Output is correct
5 Correct 146 ms 6924 KB Output is correct
6 Correct 141 ms 5892 KB Output is correct
7 Correct 131 ms 6896 KB Output is correct
8 Correct 148 ms 6956 KB Output is correct
9 Correct 137 ms 5852 KB Output is correct
10 Correct 134 ms 6900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 6908 KB Output is correct
2 Correct 141 ms 6976 KB Output is correct
3 Correct 137 ms 6900 KB Output is correct
4 Correct 147 ms 6972 KB Output is correct
5 Correct 146 ms 6924 KB Output is correct
6 Correct 141 ms 5892 KB Output is correct
7 Correct 131 ms 6896 KB Output is correct
8 Correct 148 ms 6956 KB Output is correct
9 Correct 137 ms 5852 KB Output is correct
10 Correct 134 ms 6900 KB Output is correct
11 Correct 14 ms 6960 KB Output is correct
12 Correct 17 ms 6908 KB Output is correct
13 Correct 9 ms 6920 KB Output is correct
14 Correct 46 ms 6948 KB Output is correct
15 Correct 151 ms 7032 KB Output is correct
16 Correct 144 ms 6888 KB Output is correct
17 Correct 157 ms 6936 KB Output is correct
18 Correct 141 ms 6904 KB Output is correct
19 Correct 141 ms 5820 KB Output is correct
20 Correct 140 ms 6928 KB Output is correct
21 Correct 163 ms 6924 KB Output is correct
22 Correct 149 ms 5932 KB Output is correct
23 Correct 154 ms 7008 KB Output is correct
24 Correct 158 ms 6984 KB Output is correct
25 Correct 143 ms 6912 KB Output is correct
26 Correct 151 ms 6936 KB Output is correct
27 Correct 155 ms 6968 KB Output is correct
28 Correct 148 ms 5880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 6908 KB Output is correct
2 Correct 141 ms 6976 KB Output is correct
3 Correct 137 ms 6900 KB Output is correct
4 Correct 147 ms 6972 KB Output is correct
5 Correct 146 ms 6924 KB Output is correct
6 Correct 141 ms 5892 KB Output is correct
7 Correct 131 ms 6896 KB Output is correct
8 Correct 148 ms 6956 KB Output is correct
9 Correct 137 ms 5852 KB Output is correct
10 Correct 134 ms 6900 KB Output is correct
11 Correct 52 ms 6968 KB Output is correct
12 Correct 165 ms 6916 KB Output is correct
13 Correct 163 ms 6888 KB Output is correct
14 Correct 162 ms 6908 KB Output is correct
15 Correct 150 ms 6920 KB Output is correct
16 Correct 134 ms 5916 KB Output is correct
17 Correct 142 ms 6892 KB Output is correct
18 Correct 146 ms 6884 KB Output is correct
19 Correct 162 ms 5908 KB Output is correct
20 Correct 164 ms 6924 KB Output is correct
21 Correct 244 ms 6996 KB Output is correct
22 Correct 270 ms 6980 KB Output is correct
23 Correct 260 ms 6996 KB Output is correct
24 Correct 272 ms 6888 KB Output is correct
25 Correct 286 ms 5976 KB Output is correct
26 Correct 255 ms 6892 KB Output is correct
27 Correct 276 ms 5892 KB Output is correct
28 Correct 264 ms 6956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 6960 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 9 ms 6920 KB Output is correct
4 Correct 47 ms 6988 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 219 ms 6996 KB Output is correct
7 Correct 237 ms 6968 KB Output is correct
8 Correct 221 ms 6944 KB Output is correct
9 Correct 241 ms 7072 KB Output is correct
10 Correct 243 ms 6992 KB Output is correct
11 Correct 217 ms 7096 KB Output is correct
12 Correct 47 ms 6908 KB Output is correct
13 Correct 141 ms 6976 KB Output is correct
14 Correct 137 ms 6900 KB Output is correct
15 Correct 147 ms 6972 KB Output is correct
16 Correct 146 ms 6924 KB Output is correct
17 Correct 141 ms 5892 KB Output is correct
18 Correct 131 ms 6896 KB Output is correct
19 Correct 148 ms 6956 KB Output is correct
20 Correct 137 ms 5852 KB Output is correct
21 Correct 134 ms 6900 KB Output is correct
22 Correct 14 ms 6960 KB Output is correct
23 Correct 17 ms 6908 KB Output is correct
24 Correct 9 ms 6920 KB Output is correct
25 Correct 46 ms 6948 KB Output is correct
26 Correct 151 ms 7032 KB Output is correct
27 Correct 144 ms 6888 KB Output is correct
28 Correct 157 ms 6936 KB Output is correct
29 Correct 141 ms 6904 KB Output is correct
30 Correct 141 ms 5820 KB Output is correct
31 Correct 140 ms 6928 KB Output is correct
32 Correct 163 ms 6924 KB Output is correct
33 Correct 149 ms 5932 KB Output is correct
34 Correct 154 ms 7008 KB Output is correct
35 Correct 158 ms 6984 KB Output is correct
36 Correct 143 ms 6912 KB Output is correct
37 Correct 151 ms 6936 KB Output is correct
38 Correct 155 ms 6968 KB Output is correct
39 Correct 148 ms 5880 KB Output is correct
40 Correct 52 ms 6968 KB Output is correct
41 Correct 165 ms 6916 KB Output is correct
42 Correct 163 ms 6888 KB Output is correct
43 Correct 162 ms 6908 KB Output is correct
44 Correct 150 ms 6920 KB Output is correct
45 Correct 134 ms 5916 KB Output is correct
46 Correct 142 ms 6892 KB Output is correct
47 Correct 146 ms 6884 KB Output is correct
48 Correct 162 ms 5908 KB Output is correct
49 Correct 164 ms 6924 KB Output is correct
50 Correct 244 ms 6996 KB Output is correct
51 Correct 270 ms 6980 KB Output is correct
52 Correct 260 ms 6996 KB Output is correct
53 Correct 272 ms 6888 KB Output is correct
54 Correct 286 ms 5976 KB Output is correct
55 Correct 255 ms 6892 KB Output is correct
56 Correct 276 ms 5892 KB Output is correct
57 Correct 264 ms 6956 KB Output is correct
58 Correct 12 ms 6960 KB Output is correct
59 Correct 16 ms 6988 KB Output is correct
60 Correct 7 ms 6920 KB Output is correct
61 Correct 51 ms 7100 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 270 ms 6876 KB Output is correct
64 Correct 235 ms 6920 KB Output is correct
65 Correct 245 ms 6892 KB Output is correct
66 Correct 241 ms 6884 KB Output is correct
67 Correct 219 ms 6888 KB Output is correct
68 Correct 223 ms 7096 KB Output is correct
69 Correct 148 ms 6924 KB Output is correct
70 Correct 132 ms 6888 KB Output is correct
71 Correct 131 ms 6904 KB Output is correct
72 Correct 142 ms 6992 KB Output is correct
73 Correct 141 ms 5924 KB Output is correct
74 Correct 133 ms 6928 KB Output is correct
75 Correct 141 ms 6976 KB Output is correct
76 Correct 132 ms 5860 KB Output is correct
77 Correct 150 ms 6944 KB Output is correct
78 Correct 134 ms 6920 KB Output is correct
79 Correct 137 ms 6972 KB Output is correct
80 Correct 138 ms 6896 KB Output is correct
81 Correct 146 ms 6888 KB Output is correct
82 Correct 126 ms 5932 KB Output is correct
83 Correct 224 ms 7008 KB Output is correct
84 Correct 240 ms 6884 KB Output is correct
85 Correct 213 ms 5944 KB Output is correct
86 Correct 227 ms 6932 KB Output is correct
87 Correct 227 ms 5968 KB Output is correct
88 Correct 253 ms 7104 KB Output is correct
89 Correct 269 ms 6928 KB Output is correct
90 Correct 244 ms 7080 KB Output is correct
91 Correct 244 ms 5992 KB Output is correct
92 Correct 231 ms 5928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 6908 KB Output is correct
2 Correct 141 ms 6976 KB Output is correct
3 Correct 137 ms 6900 KB Output is correct
4 Correct 147 ms 6972 KB Output is correct
5 Correct 146 ms 6924 KB Output is correct
6 Correct 141 ms 5892 KB Output is correct
7 Correct 131 ms 6896 KB Output is correct
8 Correct 148 ms 6956 KB Output is correct
9 Correct 137 ms 5852 KB Output is correct
10 Correct 134 ms 6900 KB Output is correct
11 Correct 52 ms 6968 KB Output is correct
12 Correct 165 ms 6916 KB Output is correct
13 Correct 163 ms 6888 KB Output is correct
14 Correct 162 ms 6908 KB Output is correct
15 Correct 150 ms 6920 KB Output is correct
16 Correct 134 ms 5916 KB Output is correct
17 Correct 142 ms 6892 KB Output is correct
18 Correct 146 ms 6884 KB Output is correct
19 Correct 162 ms 5908 KB Output is correct
20 Correct 164 ms 6924 KB Output is correct
21 Correct 244 ms 6996 KB Output is correct
22 Correct 270 ms 6980 KB Output is correct
23 Correct 260 ms 6996 KB Output is correct
24 Correct 272 ms 6888 KB Output is correct
25 Correct 286 ms 5976 KB Output is correct
26 Correct 255 ms 6892 KB Output is correct
27 Correct 276 ms 5892 KB Output is correct
28 Correct 264 ms 6956 KB Output is correct
29 Correct 49 ms 6980 KB Output is correct
30 Correct 148 ms 6888 KB Output is correct
31 Correct 135 ms 7056 KB Output is correct
32 Correct 139 ms 6884 KB Output is correct
33 Correct 150 ms 7008 KB Output is correct
34 Correct 144 ms 5916 KB Output is correct
35 Correct 132 ms 6896 KB Output is correct
36 Correct 133 ms 7108 KB Output is correct
37 Correct 148 ms 5876 KB Output is correct
38 Correct 137 ms 6928 KB Output is correct
39 Correct 232 ms 6936 KB Output is correct
40 Correct 243 ms 6980 KB Output is correct
41 Correct 224 ms 6980 KB Output is correct
42 Correct 233 ms 6968 KB Output is correct
43 Correct 228 ms 5940 KB Output is correct
44 Correct 227 ms 6876 KB Output is correct
45 Correct 226 ms 5956 KB Output is correct
46 Correct 229 ms 6992 KB Output is correct
47 Correct 431 ms 6968 KB Output is correct
48 Correct 433 ms 6992 KB Output is correct
49 Correct 451 ms 5816 KB Output is correct
50 Correct 468 ms 7172 KB Output is correct
51 Correct 453 ms 5952 KB Output is correct
52 Correct 507 ms 6872 KB Output is correct
53 Correct 419 ms 5924 KB Output is correct
54 Correct 449 ms 6968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 6960 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 9 ms 6920 KB Output is correct
4 Correct 47 ms 6988 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 219 ms 6996 KB Output is correct
7 Correct 237 ms 6968 KB Output is correct
8 Correct 221 ms 6944 KB Output is correct
9 Correct 241 ms 7072 KB Output is correct
10 Correct 243 ms 6992 KB Output is correct
11 Correct 217 ms 7096 KB Output is correct
12 Correct 12 ms 6936 KB Output is correct
13 Correct 18 ms 6972 KB Output is correct
14 Correct 8 ms 6920 KB Output is correct
15 Correct 48 ms 6988 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 234 ms 6872 KB Output is correct
18 Correct 245 ms 6956 KB Output is correct
19 Correct 230 ms 6868 KB Output is correct
20 Correct 228 ms 6876 KB Output is correct
21 Correct 234 ms 6940 KB Output is correct
22 Correct 225 ms 6872 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 468 ms 6892 KB Output is correct
25 Correct 488 ms 6968 KB Output is correct
26 Correct 489 ms 6876 KB Output is correct
27 Correct 463 ms 6968 KB Output is correct
28 Correct 464 ms 6928 KB Output is correct
29 Correct 426 ms 6968 KB Output is correct
30 Correct 47 ms 6908 KB Output is correct
31 Correct 141 ms 6976 KB Output is correct
32 Correct 137 ms 6900 KB Output is correct
33 Correct 147 ms 6972 KB Output is correct
34 Correct 146 ms 6924 KB Output is correct
35 Correct 141 ms 5892 KB Output is correct
36 Correct 131 ms 6896 KB Output is correct
37 Correct 148 ms 6956 KB Output is correct
38 Correct 137 ms 5852 KB Output is correct
39 Correct 134 ms 6900 KB Output is correct
40 Correct 14 ms 6960 KB Output is correct
41 Correct 17 ms 6908 KB Output is correct
42 Correct 9 ms 6920 KB Output is correct
43 Correct 46 ms 6948 KB Output is correct
44 Correct 151 ms 7032 KB Output is correct
45 Correct 144 ms 6888 KB Output is correct
46 Correct 157 ms 6936 KB Output is correct
47 Correct 141 ms 6904 KB Output is correct
48 Correct 141 ms 5820 KB Output is correct
49 Correct 140 ms 6928 KB Output is correct
50 Correct 163 ms 6924 KB Output is correct
51 Correct 149 ms 5932 KB Output is correct
52 Correct 154 ms 7008 KB Output is correct
53 Correct 158 ms 6984 KB Output is correct
54 Correct 143 ms 6912 KB Output is correct
55 Correct 151 ms 6936 KB Output is correct
56 Correct 155 ms 6968 KB Output is correct
57 Correct 148 ms 5880 KB Output is correct
58 Correct 52 ms 6968 KB Output is correct
59 Correct 165 ms 6916 KB Output is correct
60 Correct 163 ms 6888 KB Output is correct
61 Correct 162 ms 6908 KB Output is correct
62 Correct 150 ms 6920 KB Output is correct
63 Correct 134 ms 5916 KB Output is correct
64 Correct 142 ms 6892 KB Output is correct
65 Correct 146 ms 6884 KB Output is correct
66 Correct 162 ms 5908 KB Output is correct
67 Correct 164 ms 6924 KB Output is correct
68 Correct 244 ms 6996 KB Output is correct
69 Correct 270 ms 6980 KB Output is correct
70 Correct 260 ms 6996 KB Output is correct
71 Correct 272 ms 6888 KB Output is correct
72 Correct 286 ms 5976 KB Output is correct
73 Correct 255 ms 6892 KB Output is correct
74 Correct 276 ms 5892 KB Output is correct
75 Correct 264 ms 6956 KB Output is correct
76 Correct 12 ms 6960 KB Output is correct
77 Correct 16 ms 6988 KB Output is correct
78 Correct 7 ms 6920 KB Output is correct
79 Correct 51 ms 7100 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 270 ms 6876 KB Output is correct
82 Correct 235 ms 6920 KB Output is correct
83 Correct 245 ms 6892 KB Output is correct
84 Correct 241 ms 6884 KB Output is correct
85 Correct 219 ms 6888 KB Output is correct
86 Correct 223 ms 7096 KB Output is correct
87 Correct 148 ms 6924 KB Output is correct
88 Correct 132 ms 6888 KB Output is correct
89 Correct 131 ms 6904 KB Output is correct
90 Correct 142 ms 6992 KB Output is correct
91 Correct 141 ms 5924 KB Output is correct
92 Correct 133 ms 6928 KB Output is correct
93 Correct 141 ms 6976 KB Output is correct
94 Correct 132 ms 5860 KB Output is correct
95 Correct 150 ms 6944 KB Output is correct
96 Correct 134 ms 6920 KB Output is correct
97 Correct 137 ms 6972 KB Output is correct
98 Correct 138 ms 6896 KB Output is correct
99 Correct 146 ms 6888 KB Output is correct
100 Correct 126 ms 5932 KB Output is correct
101 Correct 224 ms 7008 KB Output is correct
102 Correct 240 ms 6884 KB Output is correct
103 Correct 213 ms 5944 KB Output is correct
104 Correct 227 ms 6932 KB Output is correct
105 Correct 227 ms 5968 KB Output is correct
106 Correct 253 ms 7104 KB Output is correct
107 Correct 269 ms 6928 KB Output is correct
108 Correct 244 ms 7080 KB Output is correct
109 Correct 244 ms 5992 KB Output is correct
110 Correct 231 ms 5928 KB Output is correct
111 Correct 49 ms 6980 KB Output is correct
112 Correct 148 ms 6888 KB Output is correct
113 Correct 135 ms 7056 KB Output is correct
114 Correct 139 ms 6884 KB Output is correct
115 Correct 150 ms 7008 KB Output is correct
116 Correct 144 ms 5916 KB Output is correct
117 Correct 132 ms 6896 KB Output is correct
118 Correct 133 ms 7108 KB Output is correct
119 Correct 148 ms 5876 KB Output is correct
120 Correct 137 ms 6928 KB Output is correct
121 Correct 232 ms 6936 KB Output is correct
122 Correct 243 ms 6980 KB Output is correct
123 Correct 224 ms 6980 KB Output is correct
124 Correct 233 ms 6968 KB Output is correct
125 Correct 228 ms 5940 KB Output is correct
126 Correct 227 ms 6876 KB Output is correct
127 Correct 226 ms 5956 KB Output is correct
128 Correct 229 ms 6992 KB Output is correct
129 Correct 431 ms 6968 KB Output is correct
130 Correct 433 ms 6992 KB Output is correct
131 Correct 451 ms 5816 KB Output is correct
132 Correct 468 ms 7172 KB Output is correct
133 Correct 453 ms 5952 KB Output is correct
134 Correct 507 ms 6872 KB Output is correct
135 Correct 419 ms 5924 KB Output is correct
136 Correct 449 ms 6968 KB Output is correct
137 Correct 12 ms 6960 KB Output is correct
138 Correct 19 ms 6928 KB Output is correct
139 Correct 7 ms 6920 KB Output is correct
140 Correct 47 ms 6908 KB Output is correct
141 Correct 1 ms 212 KB Output is correct
142 Correct 211 ms 6888 KB Output is correct
143 Correct 221 ms 6984 KB Output is correct
144 Correct 227 ms 6948 KB Output is correct
145 Correct 253 ms 6892 KB Output is correct
146 Correct 232 ms 6876 KB Output is correct
147 Correct 213 ms 6968 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 474 ms 6968 KB Output is correct
150 Correct 447 ms 6988 KB Output is correct
151 Correct 455 ms 6992 KB Output is correct
152 Correct 461 ms 6940 KB Output is correct
153 Correct 446 ms 6976 KB Output is correct
154 Correct 465 ms 6976 KB Output is correct
155 Correct 132 ms 6896 KB Output is correct
156 Correct 129 ms 6980 KB Output is correct
157 Correct 156 ms 6924 KB Output is correct
158 Correct 143 ms 6956 KB Output is correct
159 Correct 127 ms 5908 KB Output is correct
160 Correct 130 ms 6964 KB Output is correct
161 Correct 143 ms 6900 KB Output is correct
162 Correct 147 ms 5852 KB Output is correct
163 Correct 137 ms 6892 KB Output is correct
164 Correct 236 ms 6888 KB Output is correct
165 Correct 221 ms 6872 KB Output is correct
166 Correct 240 ms 5860 KB Output is correct
167 Correct 233 ms 6968 KB Output is correct
168 Correct 213 ms 5852 KB Output is correct
169 Correct 240 ms 6880 KB Output is correct
170 Correct 144 ms 6964 KB Output is correct
171 Correct 147 ms 6968 KB Output is correct
172 Correct 146 ms 6980 KB Output is correct
173 Correct 137 ms 6980 KB Output is correct
174 Correct 148 ms 5952 KB Output is correct
175 Correct 239 ms 6920 KB Output is correct
176 Correct 231 ms 6940 KB Output is correct
177 Correct 254 ms 5944 KB Output is correct
178 Correct 215 ms 5848 KB Output is correct
179 Correct 451 ms 5944 KB Output is correct
180 Correct 455 ms 6920 KB Output is correct
181 Correct 451 ms 5920 KB Output is correct
182 Correct 445 ms 6984 KB Output is correct
183 Correct 447 ms 5960 KB Output is correct
184 Correct 442 ms 6968 KB Output is correct
185 Correct 443 ms 6980 KB Output is correct
186 Correct 497 ms 6868 KB Output is correct
187 Correct 441 ms 6968 KB Output is correct
188 Correct 431 ms 5956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 6908 KB Output is correct
2 Correct 141 ms 6976 KB Output is correct
3 Correct 137 ms 6900 KB Output is correct
4 Correct 147 ms 6972 KB Output is correct
5 Correct 146 ms 6924 KB Output is correct
6 Correct 141 ms 5892 KB Output is correct
7 Correct 131 ms 6896 KB Output is correct
8 Correct 148 ms 6956 KB Output is correct
9 Correct 137 ms 5852 KB Output is correct
10 Correct 134 ms 6900 KB Output is correct
11 Correct 52 ms 6968 KB Output is correct
12 Correct 165 ms 6916 KB Output is correct
13 Correct 163 ms 6888 KB Output is correct
14 Correct 162 ms 6908 KB Output is correct
15 Correct 150 ms 6920 KB Output is correct
16 Correct 134 ms 5916 KB Output is correct
17 Correct 142 ms 6892 KB Output is correct
18 Correct 146 ms 6884 KB Output is correct
19 Correct 162 ms 5908 KB Output is correct
20 Correct 164 ms 6924 KB Output is correct
21 Correct 244 ms 6996 KB Output is correct
22 Correct 270 ms 6980 KB Output is correct
23 Correct 260 ms 6996 KB Output is correct
24 Correct 272 ms 6888 KB Output is correct
25 Correct 286 ms 5976 KB Output is correct
26 Correct 255 ms 6892 KB Output is correct
27 Correct 276 ms 5892 KB Output is correct
28 Correct 264 ms 6956 KB Output is correct
29 Correct 49 ms 6980 KB Output is correct
30 Correct 148 ms 6888 KB Output is correct
31 Correct 135 ms 7056 KB Output is correct
32 Correct 139 ms 6884 KB Output is correct
33 Correct 150 ms 7008 KB Output is correct
34 Correct 144 ms 5916 KB Output is correct
35 Correct 132 ms 6896 KB Output is correct
36 Correct 133 ms 7108 KB Output is correct
37 Correct 148 ms 5876 KB Output is correct
38 Correct 137 ms 6928 KB Output is correct
39 Correct 232 ms 6936 KB Output is correct
40 Correct 243 ms 6980 KB Output is correct
41 Correct 224 ms 6980 KB Output is correct
42 Correct 233 ms 6968 KB Output is correct
43 Correct 228 ms 5940 KB Output is correct
44 Correct 227 ms 6876 KB Output is correct
45 Correct 226 ms 5956 KB Output is correct
46 Correct 229 ms 6992 KB Output is correct
47 Correct 431 ms 6968 KB Output is correct
48 Correct 433 ms 6992 KB Output is correct
49 Correct 451 ms 5816 KB Output is correct
50 Correct 468 ms 7172 KB Output is correct
51 Correct 453 ms 5952 KB Output is correct
52 Correct 507 ms 6872 KB Output is correct
53 Correct 419 ms 5924 KB Output is correct
54 Correct 449 ms 6968 KB Output is correct
55 Correct 47 ms 6936 KB Output is correct
56 Correct 147 ms 6884 KB Output is correct
57 Correct 138 ms 6896 KB Output is correct
58 Correct 141 ms 6952 KB Output is correct
59 Correct 151 ms 7036 KB Output is correct
60 Correct 136 ms 5928 KB Output is correct
61 Correct 139 ms 7064 KB Output is correct
62 Correct 146 ms 6928 KB Output is correct
63 Correct 148 ms 5944 KB Output is correct
64 Correct 149 ms 6940 KB Output is correct
65 Correct 212 ms 6968 KB Output is correct
66 Correct 223 ms 6884 KB Output is correct
67 Correct 238 ms 6968 KB Output is correct
68 Correct 219 ms 6968 KB Output is correct
69 Correct 246 ms 5904 KB Output is correct
70 Correct 242 ms 6936 KB Output is correct
71 Correct 218 ms 5872 KB Output is correct
72 Correct 252 ms 6984 KB Output is correct
73 Correct 540 ms 6984 KB Output is correct
74 Correct 571 ms 6980 KB Output is correct
75 Correct 522 ms 5960 KB Output is correct
76 Correct 515 ms 6944 KB Output is correct
77 Correct 518 ms 5836 KB Output is correct
78 Correct 526 ms 6952 KB Output is correct
79 Correct 469 ms 5944 KB Output is correct
80 Correct 522 ms 7084 KB Output is correct
81 Correct 1501 ms 6980 KB Output is correct
82 Correct 1420 ms 6956 KB Output is correct
83 Correct 1492 ms 6920 KB Output is correct
84 Correct 1324 ms 6056 KB Output is correct
85 Correct 1287 ms 7080 KB Output is correct
86 Correct 1272 ms 7104 KB Output is correct
87 Correct 1282 ms 7028 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 6960 KB Output is correct
2 Correct 17 ms 6892 KB Output is correct
3 Correct 9 ms 6920 KB Output is correct
4 Correct 47 ms 6988 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 219 ms 6996 KB Output is correct
7 Correct 237 ms 6968 KB Output is correct
8 Correct 221 ms 6944 KB Output is correct
9 Correct 241 ms 7072 KB Output is correct
10 Correct 243 ms 6992 KB Output is correct
11 Correct 217 ms 7096 KB Output is correct
12 Correct 12 ms 6936 KB Output is correct
13 Correct 18 ms 6972 KB Output is correct
14 Correct 8 ms 6920 KB Output is correct
15 Correct 48 ms 6988 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 234 ms 6872 KB Output is correct
18 Correct 245 ms 6956 KB Output is correct
19 Correct 230 ms 6868 KB Output is correct
20 Correct 228 ms 6876 KB Output is correct
21 Correct 234 ms 6940 KB Output is correct
22 Correct 225 ms 6872 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 468 ms 6892 KB Output is correct
25 Correct 488 ms 6968 KB Output is correct
26 Correct 489 ms 6876 KB Output is correct
27 Correct 463 ms 6968 KB Output is correct
28 Correct 464 ms 6928 KB Output is correct
29 Correct 426 ms 6968 KB Output is correct
30 Correct 47 ms 6908 KB Output is correct
31 Correct 141 ms 6976 KB Output is correct
32 Correct 137 ms 6900 KB Output is correct
33 Correct 147 ms 6972 KB Output is correct
34 Correct 146 ms 6924 KB Output is correct
35 Correct 141 ms 5892 KB Output is correct
36 Correct 131 ms 6896 KB Output is correct
37 Correct 148 ms 6956 KB Output is correct
38 Correct 137 ms 5852 KB Output is correct
39 Correct 134 ms 6900 KB Output is correct
40 Correct 14 ms 6960 KB Output is correct
41 Correct 17 ms 6908 KB Output is correct
42 Correct 9 ms 6920 KB Output is correct
43 Correct 46 ms 6948 KB Output is correct
44 Correct 151 ms 7032 KB Output is correct
45 Correct 144 ms 6888 KB Output is correct
46 Correct 157 ms 6936 KB Output is correct
47 Correct 141 ms 6904 KB Output is correct
48 Correct 141 ms 5820 KB Output is correct
49 Correct 140 ms 6928 KB Output is correct
50 Correct 163 ms 6924 KB Output is correct
51 Correct 149 ms 5932 KB Output is correct
52 Correct 154 ms 7008 KB Output is correct
53 Correct 158 ms 6984 KB Output is correct
54 Correct 143 ms 6912 KB Output is correct
55 Correct 151 ms 6936 KB Output is correct
56 Correct 155 ms 6968 KB Output is correct
57 Correct 148 ms 5880 KB Output is correct
58 Correct 52 ms 6968 KB Output is correct
59 Correct 165 ms 6916 KB Output is correct
60 Correct 163 ms 6888 KB Output is correct
61 Correct 162 ms 6908 KB Output is correct
62 Correct 150 ms 6920 KB Output is correct
63 Correct 134 ms 5916 KB Output is correct
64 Correct 142 ms 6892 KB Output is correct
65 Correct 146 ms 6884 KB Output is correct
66 Correct 162 ms 5908 KB Output is correct
67 Correct 164 ms 6924 KB Output is correct
68 Correct 244 ms 6996 KB Output is correct
69 Correct 270 ms 6980 KB Output is correct
70 Correct 260 ms 6996 KB Output is correct
71 Correct 272 ms 6888 KB Output is correct
72 Correct 286 ms 5976 KB Output is correct
73 Correct 255 ms 6892 KB Output is correct
74 Correct 276 ms 5892 KB Output is correct
75 Correct 264 ms 6956 KB Output is correct
76 Correct 12 ms 6960 KB Output is correct
77 Correct 16 ms 6988 KB Output is correct
78 Correct 7 ms 6920 KB Output is correct
79 Correct 51 ms 7100 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 270 ms 6876 KB Output is correct
82 Correct 235 ms 6920 KB Output is correct
83 Correct 245 ms 6892 KB Output is correct
84 Correct 241 ms 6884 KB Output is correct
85 Correct 219 ms 6888 KB Output is correct
86 Correct 223 ms 7096 KB Output is correct
87 Correct 148 ms 6924 KB Output is correct
88 Correct 132 ms 6888 KB Output is correct
89 Correct 131 ms 6904 KB Output is correct
90 Correct 142 ms 6992 KB Output is correct
91 Correct 141 ms 5924 KB Output is correct
92 Correct 133 ms 6928 KB Output is correct
93 Correct 141 ms 6976 KB Output is correct
94 Correct 132 ms 5860 KB Output is correct
95 Correct 150 ms 6944 KB Output is correct
96 Correct 134 ms 6920 KB Output is correct
97 Correct 137 ms 6972 KB Output is correct
98 Correct 138 ms 6896 KB Output is correct
99 Correct 146 ms 6888 KB Output is correct
100 Correct 126 ms 5932 KB Output is correct
101 Correct 224 ms 7008 KB Output is correct
102 Correct 240 ms 6884 KB Output is correct
103 Correct 213 ms 5944 KB Output is correct
104 Correct 227 ms 6932 KB Output is correct
105 Correct 227 ms 5968 KB Output is correct
106 Correct 253 ms 7104 KB Output is correct
107 Correct 269 ms 6928 KB Output is correct
108 Correct 244 ms 7080 KB Output is correct
109 Correct 244 ms 5992 KB Output is correct
110 Correct 231 ms 5928 KB Output is correct
111 Correct 49 ms 6980 KB Output is correct
112 Correct 148 ms 6888 KB Output is correct
113 Correct 135 ms 7056 KB Output is correct
114 Correct 139 ms 6884 KB Output is correct
115 Correct 150 ms 7008 KB Output is correct
116 Correct 144 ms 5916 KB Output is correct
117 Correct 132 ms 6896 KB Output is correct
118 Correct 133 ms 7108 KB Output is correct
119 Correct 148 ms 5876 KB Output is correct
120 Correct 137 ms 6928 KB Output is correct
121 Correct 232 ms 6936 KB Output is correct
122 Correct 243 ms 6980 KB Output is correct
123 Correct 224 ms 6980 KB Output is correct
124 Correct 233 ms 6968 KB Output is correct
125 Correct 228 ms 5940 KB Output is correct
126 Correct 227 ms 6876 KB Output is correct
127 Correct 226 ms 5956 KB Output is correct
128 Correct 229 ms 6992 KB Output is correct
129 Correct 431 ms 6968 KB Output is correct
130 Correct 433 ms 6992 KB Output is correct
131 Correct 451 ms 5816 KB Output is correct
132 Correct 468 ms 7172 KB Output is correct
133 Correct 453 ms 5952 KB Output is correct
134 Correct 507 ms 6872 KB Output is correct
135 Correct 419 ms 5924 KB Output is correct
136 Correct 449 ms 6968 KB Output is correct
137 Correct 12 ms 6960 KB Output is correct
138 Correct 19 ms 6928 KB Output is correct
139 Correct 7 ms 6920 KB Output is correct
140 Correct 47 ms 6908 KB Output is correct
141 Correct 1 ms 212 KB Output is correct
142 Correct 211 ms 6888 KB Output is correct
143 Correct 221 ms 6984 KB Output is correct
144 Correct 227 ms 6948 KB Output is correct
145 Correct 253 ms 6892 KB Output is correct
146 Correct 232 ms 6876 KB Output is correct
147 Correct 213 ms 6968 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 474 ms 6968 KB Output is correct
150 Correct 447 ms 6988 KB Output is correct
151 Correct 455 ms 6992 KB Output is correct
152 Correct 461 ms 6940 KB Output is correct
153 Correct 446 ms 6976 KB Output is correct
154 Correct 465 ms 6976 KB Output is correct
155 Correct 132 ms 6896 KB Output is correct
156 Correct 129 ms 6980 KB Output is correct
157 Correct 156 ms 6924 KB Output is correct
158 Correct 143 ms 6956 KB Output is correct
159 Correct 127 ms 5908 KB Output is correct
160 Correct 130 ms 6964 KB Output is correct
161 Correct 143 ms 6900 KB Output is correct
162 Correct 147 ms 5852 KB Output is correct
163 Correct 137 ms 6892 KB Output is correct
164 Correct 236 ms 6888 KB Output is correct
165 Correct 221 ms 6872 KB Output is correct
166 Correct 240 ms 5860 KB Output is correct
167 Correct 233 ms 6968 KB Output is correct
168 Correct 213 ms 5852 KB Output is correct
169 Correct 240 ms 6880 KB Output is correct
170 Correct 144 ms 6964 KB Output is correct
171 Correct 147 ms 6968 KB Output is correct
172 Correct 146 ms 6980 KB Output is correct
173 Correct 137 ms 6980 KB Output is correct
174 Correct 148 ms 5952 KB Output is correct
175 Correct 239 ms 6920 KB Output is correct
176 Correct 231 ms 6940 KB Output is correct
177 Correct 254 ms 5944 KB Output is correct
178 Correct 215 ms 5848 KB Output is correct
179 Correct 451 ms 5944 KB Output is correct
180 Correct 455 ms 6920 KB Output is correct
181 Correct 451 ms 5920 KB Output is correct
182 Correct 445 ms 6984 KB Output is correct
183 Correct 447 ms 5960 KB Output is correct
184 Correct 442 ms 6968 KB Output is correct
185 Correct 443 ms 6980 KB Output is correct
186 Correct 497 ms 6868 KB Output is correct
187 Correct 441 ms 6968 KB Output is correct
188 Correct 431 ms 5956 KB Output is correct
189 Correct 47 ms 6936 KB Output is correct
190 Correct 147 ms 6884 KB Output is correct
191 Correct 138 ms 6896 KB Output is correct
192 Correct 141 ms 6952 KB Output is correct
193 Correct 151 ms 7036 KB Output is correct
194 Correct 136 ms 5928 KB Output is correct
195 Correct 139 ms 7064 KB Output is correct
196 Correct 146 ms 6928 KB Output is correct
197 Correct 148 ms 5944 KB Output is correct
198 Correct 149 ms 6940 KB Output is correct
199 Correct 212 ms 6968 KB Output is correct
200 Correct 223 ms 6884 KB Output is correct
201 Correct 238 ms 6968 KB Output is correct
202 Correct 219 ms 6968 KB Output is correct
203 Correct 246 ms 5904 KB Output is correct
204 Correct 242 ms 6936 KB Output is correct
205 Correct 218 ms 5872 KB Output is correct
206 Correct 252 ms 6984 KB Output is correct
207 Correct 540 ms 6984 KB Output is correct
208 Correct 571 ms 6980 KB Output is correct
209 Correct 522 ms 5960 KB Output is correct
210 Correct 515 ms 6944 KB Output is correct
211 Correct 518 ms 5836 KB Output is correct
212 Correct 526 ms 6952 KB Output is correct
213 Correct 469 ms 5944 KB Output is correct
214 Correct 522 ms 7084 KB Output is correct
215 Correct 1501 ms 6980 KB Output is correct
216 Correct 1420 ms 6956 KB Output is correct
217 Correct 1492 ms 6920 KB Output is correct
218 Correct 1324 ms 6056 KB Output is correct
219 Correct 1287 ms 7080 KB Output is correct
220 Correct 1272 ms 7104 KB Output is correct
221 Correct 1282 ms 7028 KB Output is correct
222 Correct 49 ms 6884 KB Output is correct
223 Correct 135 ms 6924 KB Output is correct
224 Correct 141 ms 6932 KB Output is correct
225 Correct 132 ms 6884 KB Output is correct
226 Correct 137 ms 6900 KB Output is correct
227 Correct 133 ms 5876 KB Output is correct
228 Correct 132 ms 6960 KB Output is correct
229 Correct 134 ms 6944 KB Output is correct
230 Correct 139 ms 5920 KB Output is correct
231 Correct 145 ms 6900 KB Output is correct
232 Correct 233 ms 6936 KB Output is correct
233 Correct 248 ms 6968 KB Output is correct
234 Correct 227 ms 6984 KB Output is correct
235 Correct 219 ms 6980 KB Output is correct
236 Correct 246 ms 5836 KB Output is correct
237 Correct 239 ms 6868 KB Output is correct
238 Correct 208 ms 5960 KB Output is correct
239 Correct 229 ms 6920 KB Output is correct
240 Correct 477 ms 7024 KB Output is correct
241 Correct 428 ms 6984 KB Output is correct
242 Correct 458 ms 6008 KB Output is correct
243 Correct 429 ms 6972 KB Output is correct
244 Correct 454 ms 5952 KB Output is correct
245 Correct 454 ms 6872 KB Output is correct
246 Correct 454 ms 5936 KB Output is correct
247 Correct 439 ms 6980 KB Output is correct
248 Correct 13 ms 6960 KB Output is correct
249 Correct 17 ms 6988 KB Output is correct
250 Correct 8 ms 6920 KB Output is correct
251 Correct 0 ms 212 KB Output is correct
252 Correct 219 ms 6952 KB Output is correct
253 Correct 232 ms 6948 KB Output is correct
254 Correct 223 ms 7028 KB Output is correct
255 Correct 226 ms 6908 KB Output is correct
256 Correct 0 ms 212 KB Output is correct
257 Correct 465 ms 7164 KB Output is correct
258 Correct 461 ms 6980 KB Output is correct
259 Correct 464 ms 7020 KB Output is correct
260 Correct 451 ms 7048 KB Output is correct
261 Correct 147 ms 6960 KB Output is correct
262 Correct 164 ms 6952 KB Output is correct
263 Correct 151 ms 6884 KB Output is correct
264 Correct 137 ms 6936 KB Output is correct
265 Correct 137 ms 5852 KB Output is correct
266 Correct 238 ms 6980 KB Output is correct
267 Correct 236 ms 6972 KB Output is correct
268 Correct 226 ms 5936 KB Output is correct
269 Correct 234 ms 5840 KB Output is correct
270 Correct 463 ms 7112 KB Output is correct
271 Correct 444 ms 7000 KB Output is correct
272 Correct 455 ms 6984 KB Output is correct
273 Correct 451 ms 5856 KB Output is correct
274 Correct 1268 ms 7024 KB Output is correct
275 Correct 1277 ms 6968 KB Output is correct
276 Correct 1272 ms 7060 KB Output is correct
277 Correct 1349 ms 5916 KB Output is correct
278 Correct 1289 ms 6988 KB Output is correct
279 Correct 1259 ms 6892 KB Output is correct
280 Correct 1280 ms 6976 KB Output is correct
281 Correct 1364 ms 6972 KB Output is correct
282 Correct 1376 ms 7108 KB Output is correct
283 Correct 1325 ms 6968 KB Output is correct