Submission #622354

# Submission time Handle Problem Language Result Execution time Memory
622354 2022-08-04T07:55:39 Z rrrr10000 Uplifting Excursion (BOI22_vault) C++14
80 / 100
5000 ms 19704 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define REP(i,k,n) for(ll i=(ll)(k);i<(ll)(n);i++)
#define all(a) a.begin(),a.end()
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pb emplace_back
#define dupli(a) {sort(all(a));a.erase(unique(all(a)),a.end());}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
const ll inf=1001001001001001001;

int main(){
    ll n,K;cin>>n>>K;
    ll tot=0,sum=0;
    vi a(n),b(n);
    rep(i,n)cin>>a[i];
    cin>>tot;
    rep(i,n)cin>>b[i];
    reverse(all(a));
    rep(i,n)sum-=a[i]*(i+1);
    rep(i,n)sum+=b[i]*(i+1);
    rep(i,n)tot+=a[i];
    rep(i,n)tot+=b[i];
    sum-=K;
    if(sum<0){
        sum*=-1;swap(a,b);
    }
    ll mx=910000,mx2=450000;
    auto sol=[&](vi v){
        vi dp(mx+1,inf);dp[0]=0;
        REP(i,1,v.size()+1){
            rep(j,i){
                deque<P> deq;
                for(ll k=j;k<=mx;k+=i){
                    if(dp[k]!=inf){
                        while(deq.size()&&deq.back().se>=dp[k]-k/i)deq.pop_back();
                        deq.pb(k,dp[k]-k/i);
                    }
                    while(deq.size()&&deq.front().fi<k-i*v[i-1])deq.pop_front();
                    if(deq.size())chmin(dp[k],deq.front().se+k/i);
                }
            }
        }
        return dp;
    };
    for(int i=n;i>0;i--)if(sum>mx2){
        ll mi=min(b[i-1]-i,(sum-mx2)/i+1);
        chmax(mi,0ll);
        sum-=mi*i;
        b[i-1]-=mi;
        tot-=mi;
    }
    if(sum>mx){
        out("impossible");
        return 0;
    }
    vi dpa=sol(a);
    vi dpb=sol(b);
    ll ans=inf;
    rep(i,dpa.size())if(i+sum<dpb.size())chmin(ans,dpa[i]+dpb[i+sum]);
    if(ans==inf)out("impossible");
    else out(tot-ans);
}

Compilation message

vault.cpp: In function 'int main()':
vault.cpp:72:30: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 |     rep(i,dpa.size())if(i+sum<dpb.size())chmin(ans,dpa[i]+dpb[i+sum]);
      |                         ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 19 ms 14548 KB Output is correct
2 Correct 23 ms 14476 KB Output is correct
3 Correct 12 ms 14552 KB Output is correct
4 Correct 65 ms 14464 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 525 ms 14460 KB Output is correct
7 Correct 439 ms 14448 KB Output is correct
8 Correct 437 ms 14540 KB Output is correct
9 Correct 472 ms 14456 KB Output is correct
10 Correct 485 ms 14540 KB Output is correct
11 Correct 491 ms 14448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 14548 KB Output is correct
2 Correct 23 ms 14476 KB Output is correct
3 Correct 12 ms 14552 KB Output is correct
4 Correct 65 ms 14464 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 525 ms 14460 KB Output is correct
7 Correct 439 ms 14448 KB Output is correct
8 Correct 437 ms 14540 KB Output is correct
9 Correct 472 ms 14456 KB Output is correct
10 Correct 485 ms 14540 KB Output is correct
11 Correct 491 ms 14448 KB Output is correct
12 Correct 17 ms 14548 KB Output is correct
13 Correct 22 ms 14548 KB Output is correct
14 Correct 17 ms 14556 KB Output is correct
15 Correct 67 ms 14544 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 501 ms 14596 KB Output is correct
18 Correct 409 ms 14624 KB Output is correct
19 Correct 557 ms 14544 KB Output is correct
20 Correct 490 ms 14544 KB Output is correct
21 Correct 468 ms 14452 KB Output is correct
22 Correct 559 ms 14576 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1229 ms 14540 KB Output is correct
25 Correct 1065 ms 14544 KB Output is correct
26 Correct 1262 ms 14552 KB Output is correct
27 Correct 1236 ms 14580 KB Output is correct
28 Correct 973 ms 14540 KB Output is correct
29 Correct 946 ms 14464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14540 KB Output is correct
2 Correct 558 ms 15908 KB Output is correct
3 Correct 396 ms 14828 KB Output is correct
4 Correct 536 ms 18288 KB Output is correct
5 Correct 523 ms 15688 KB Output is correct
6 Correct 534 ms 17100 KB Output is correct
7 Correct 240 ms 14536 KB Output is correct
8 Correct 239 ms 14536 KB Output is correct
9 Correct 534 ms 16676 KB Output is correct
10 Correct 468 ms 14916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14540 KB Output is correct
2 Correct 558 ms 15908 KB Output is correct
3 Correct 396 ms 14828 KB Output is correct
4 Correct 536 ms 18288 KB Output is correct
5 Correct 523 ms 15688 KB Output is correct
6 Correct 534 ms 17100 KB Output is correct
7 Correct 240 ms 14536 KB Output is correct
8 Correct 239 ms 14536 KB Output is correct
9 Correct 534 ms 16676 KB Output is correct
10 Correct 468 ms 14916 KB Output is correct
11 Correct 21 ms 14548 KB Output is correct
12 Correct 22 ms 14548 KB Output is correct
13 Correct 13 ms 14472 KB Output is correct
14 Correct 69 ms 14540 KB Output is correct
15 Correct 555 ms 15780 KB Output is correct
16 Correct 433 ms 14828 KB Output is correct
17 Correct 566 ms 18252 KB Output is correct
18 Correct 493 ms 15692 KB Output is correct
19 Correct 516 ms 16992 KB Output is correct
20 Correct 247 ms 14540 KB Output is correct
21 Correct 258 ms 14544 KB Output is correct
22 Correct 569 ms 16696 KB Output is correct
23 Correct 501 ms 14964 KB Output is correct
24 Correct 816 ms 15908 KB Output is correct
25 Correct 509 ms 14744 KB Output is correct
26 Correct 767 ms 15276 KB Output is correct
27 Correct 786 ms 15740 KB Output is correct
28 Correct 789 ms 17080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14540 KB Output is correct
2 Correct 558 ms 15908 KB Output is correct
3 Correct 396 ms 14828 KB Output is correct
4 Correct 536 ms 18288 KB Output is correct
5 Correct 523 ms 15688 KB Output is correct
6 Correct 534 ms 17100 KB Output is correct
7 Correct 240 ms 14536 KB Output is correct
8 Correct 239 ms 14536 KB Output is correct
9 Correct 534 ms 16676 KB Output is correct
10 Correct 468 ms 14916 KB Output is correct
11 Correct 65 ms 14540 KB Output is correct
12 Correct 563 ms 15780 KB Output is correct
13 Correct 406 ms 14828 KB Output is correct
14 Correct 559 ms 18284 KB Output is correct
15 Correct 518 ms 15696 KB Output is correct
16 Correct 534 ms 17088 KB Output is correct
17 Correct 270 ms 14460 KB Output is correct
18 Correct 270 ms 14468 KB Output is correct
19 Correct 558 ms 16664 KB Output is correct
20 Correct 478 ms 14912 KB Output is correct
21 Correct 493 ms 14580 KB Output is correct
22 Correct 494 ms 14468 KB Output is correct
23 Correct 869 ms 15416 KB Output is correct
24 Correct 819 ms 15056 KB Output is correct
25 Correct 956 ms 17008 KB Output is correct
26 Correct 973 ms 16692 KB Output is correct
27 Correct 884 ms 16328 KB Output is correct
28 Correct 934 ms 15288 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 14548 KB Output is correct
2 Correct 23 ms 14476 KB Output is correct
3 Correct 12 ms 14552 KB Output is correct
4 Correct 65 ms 14464 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 525 ms 14460 KB Output is correct
7 Correct 439 ms 14448 KB Output is correct
8 Correct 437 ms 14540 KB Output is correct
9 Correct 472 ms 14456 KB Output is correct
10 Correct 485 ms 14540 KB Output is correct
11 Correct 491 ms 14448 KB Output is correct
12 Correct 64 ms 14540 KB Output is correct
13 Correct 558 ms 15908 KB Output is correct
14 Correct 396 ms 14828 KB Output is correct
15 Correct 536 ms 18288 KB Output is correct
16 Correct 523 ms 15688 KB Output is correct
17 Correct 534 ms 17100 KB Output is correct
18 Correct 240 ms 14536 KB Output is correct
19 Correct 239 ms 14536 KB Output is correct
20 Correct 534 ms 16676 KB Output is correct
21 Correct 468 ms 14916 KB Output is correct
22 Correct 21 ms 14548 KB Output is correct
23 Correct 22 ms 14548 KB Output is correct
24 Correct 13 ms 14472 KB Output is correct
25 Correct 69 ms 14540 KB Output is correct
26 Correct 555 ms 15780 KB Output is correct
27 Correct 433 ms 14828 KB Output is correct
28 Correct 566 ms 18252 KB Output is correct
29 Correct 493 ms 15692 KB Output is correct
30 Correct 516 ms 16992 KB Output is correct
31 Correct 247 ms 14540 KB Output is correct
32 Correct 258 ms 14544 KB Output is correct
33 Correct 569 ms 16696 KB Output is correct
34 Correct 501 ms 14964 KB Output is correct
35 Correct 816 ms 15908 KB Output is correct
36 Correct 509 ms 14744 KB Output is correct
37 Correct 767 ms 15276 KB Output is correct
38 Correct 786 ms 15740 KB Output is correct
39 Correct 789 ms 17080 KB Output is correct
40 Correct 65 ms 14540 KB Output is correct
41 Correct 563 ms 15780 KB Output is correct
42 Correct 406 ms 14828 KB Output is correct
43 Correct 559 ms 18284 KB Output is correct
44 Correct 518 ms 15696 KB Output is correct
45 Correct 534 ms 17088 KB Output is correct
46 Correct 270 ms 14460 KB Output is correct
47 Correct 270 ms 14468 KB Output is correct
48 Correct 558 ms 16664 KB Output is correct
49 Correct 478 ms 14912 KB Output is correct
50 Correct 493 ms 14580 KB Output is correct
51 Correct 494 ms 14468 KB Output is correct
52 Correct 869 ms 15416 KB Output is correct
53 Correct 819 ms 15056 KB Output is correct
54 Correct 956 ms 17008 KB Output is correct
55 Correct 973 ms 16692 KB Output is correct
56 Correct 884 ms 16328 KB Output is correct
57 Correct 934 ms 15288 KB Output is correct
58 Correct 16 ms 14548 KB Output is correct
59 Correct 23 ms 14536 KB Output is correct
60 Correct 12 ms 14560 KB Output is correct
61 Correct 69 ms 14536 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 467 ms 14592 KB Output is correct
64 Correct 445 ms 14464 KB Output is correct
65 Correct 472 ms 14540 KB Output is correct
66 Correct 568 ms 14540 KB Output is correct
67 Correct 470 ms 14576 KB Output is correct
68 Correct 423 ms 14536 KB Output is correct
69 Correct 529 ms 15772 KB Output is correct
70 Correct 393 ms 14980 KB Output is correct
71 Correct 544 ms 18252 KB Output is correct
72 Correct 529 ms 15688 KB Output is correct
73 Correct 524 ms 17016 KB Output is correct
74 Correct 270 ms 14544 KB Output is correct
75 Correct 263 ms 14452 KB Output is correct
76 Correct 525 ms 16668 KB Output is correct
77 Correct 460 ms 14920 KB Output is correct
78 Correct 773 ms 15800 KB Output is correct
79 Correct 526 ms 14704 KB Output is correct
80 Correct 757 ms 15280 KB Output is correct
81 Correct 786 ms 15760 KB Output is correct
82 Correct 795 ms 17064 KB Output is correct
83 Correct 892 ms 15476 KB Output is correct
84 Correct 781 ms 15144 KB Output is correct
85 Correct 934 ms 17052 KB Output is correct
86 Correct 903 ms 16712 KB Output is correct
87 Correct 934 ms 16308 KB Output is correct
88 Correct 875 ms 15292 KB Output is correct
89 Correct 1308 ms 15236 KB Output is correct
90 Correct 1414 ms 16664 KB Output is correct
91 Correct 1378 ms 17024 KB Output is correct
92 Correct 1328 ms 17152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14540 KB Output is correct
2 Correct 558 ms 15908 KB Output is correct
3 Correct 396 ms 14828 KB Output is correct
4 Correct 536 ms 18288 KB Output is correct
5 Correct 523 ms 15688 KB Output is correct
6 Correct 534 ms 17100 KB Output is correct
7 Correct 240 ms 14536 KB Output is correct
8 Correct 239 ms 14536 KB Output is correct
9 Correct 534 ms 16676 KB Output is correct
10 Correct 468 ms 14916 KB Output is correct
11 Correct 65 ms 14540 KB Output is correct
12 Correct 563 ms 15780 KB Output is correct
13 Correct 406 ms 14828 KB Output is correct
14 Correct 559 ms 18284 KB Output is correct
15 Correct 518 ms 15696 KB Output is correct
16 Correct 534 ms 17088 KB Output is correct
17 Correct 270 ms 14460 KB Output is correct
18 Correct 270 ms 14468 KB Output is correct
19 Correct 558 ms 16664 KB Output is correct
20 Correct 478 ms 14912 KB Output is correct
21 Correct 493 ms 14580 KB Output is correct
22 Correct 494 ms 14468 KB Output is correct
23 Correct 869 ms 15416 KB Output is correct
24 Correct 819 ms 15056 KB Output is correct
25 Correct 956 ms 17008 KB Output is correct
26 Correct 973 ms 16692 KB Output is correct
27 Correct 884 ms 16328 KB Output is correct
28 Correct 934 ms 15288 KB Output is correct
29 Correct 71 ms 14468 KB Output is correct
30 Correct 570 ms 15792 KB Output is correct
31 Correct 420 ms 14948 KB Output is correct
32 Correct 540 ms 18340 KB Output is correct
33 Correct 517 ms 15736 KB Output is correct
34 Correct 539 ms 17012 KB Output is correct
35 Correct 285 ms 14448 KB Output is correct
36 Correct 287 ms 14468 KB Output is correct
37 Correct 571 ms 16676 KB Output is correct
38 Correct 455 ms 14896 KB Output is correct
39 Correct 432 ms 14540 KB Output is correct
40 Correct 489 ms 14456 KB Output is correct
41 Correct 866 ms 15388 KB Output is correct
42 Correct 775 ms 15060 KB Output is correct
43 Correct 1020 ms 17012 KB Output is correct
44 Correct 1131 ms 16684 KB Output is correct
45 Correct 931 ms 16372 KB Output is correct
46 Correct 1054 ms 15288 KB Output is correct
47 Correct 1174 ms 14544 KB Output is correct
48 Correct 1008 ms 14556 KB Output is correct
49 Correct 1860 ms 18284 KB Output is correct
50 Correct 1619 ms 14728 KB Output is correct
51 Correct 1910 ms 19520 KB Output is correct
52 Correct 1865 ms 17548 KB Output is correct
53 Correct 1773 ms 15612 KB Output is correct
54 Correct 1910 ms 17012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 14548 KB Output is correct
2 Correct 23 ms 14476 KB Output is correct
3 Correct 12 ms 14552 KB Output is correct
4 Correct 65 ms 14464 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 525 ms 14460 KB Output is correct
7 Correct 439 ms 14448 KB Output is correct
8 Correct 437 ms 14540 KB Output is correct
9 Correct 472 ms 14456 KB Output is correct
10 Correct 485 ms 14540 KB Output is correct
11 Correct 491 ms 14448 KB Output is correct
12 Correct 17 ms 14548 KB Output is correct
13 Correct 22 ms 14548 KB Output is correct
14 Correct 17 ms 14556 KB Output is correct
15 Correct 67 ms 14544 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 501 ms 14596 KB Output is correct
18 Correct 409 ms 14624 KB Output is correct
19 Correct 557 ms 14544 KB Output is correct
20 Correct 490 ms 14544 KB Output is correct
21 Correct 468 ms 14452 KB Output is correct
22 Correct 559 ms 14576 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1229 ms 14540 KB Output is correct
25 Correct 1065 ms 14544 KB Output is correct
26 Correct 1262 ms 14552 KB Output is correct
27 Correct 1236 ms 14580 KB Output is correct
28 Correct 973 ms 14540 KB Output is correct
29 Correct 946 ms 14464 KB Output is correct
30 Correct 64 ms 14540 KB Output is correct
31 Correct 558 ms 15908 KB Output is correct
32 Correct 396 ms 14828 KB Output is correct
33 Correct 536 ms 18288 KB Output is correct
34 Correct 523 ms 15688 KB Output is correct
35 Correct 534 ms 17100 KB Output is correct
36 Correct 240 ms 14536 KB Output is correct
37 Correct 239 ms 14536 KB Output is correct
38 Correct 534 ms 16676 KB Output is correct
39 Correct 468 ms 14916 KB Output is correct
40 Correct 21 ms 14548 KB Output is correct
41 Correct 22 ms 14548 KB Output is correct
42 Correct 13 ms 14472 KB Output is correct
43 Correct 69 ms 14540 KB Output is correct
44 Correct 555 ms 15780 KB Output is correct
45 Correct 433 ms 14828 KB Output is correct
46 Correct 566 ms 18252 KB Output is correct
47 Correct 493 ms 15692 KB Output is correct
48 Correct 516 ms 16992 KB Output is correct
49 Correct 247 ms 14540 KB Output is correct
50 Correct 258 ms 14544 KB Output is correct
51 Correct 569 ms 16696 KB Output is correct
52 Correct 501 ms 14964 KB Output is correct
53 Correct 816 ms 15908 KB Output is correct
54 Correct 509 ms 14744 KB Output is correct
55 Correct 767 ms 15276 KB Output is correct
56 Correct 786 ms 15740 KB Output is correct
57 Correct 789 ms 17080 KB Output is correct
58 Correct 65 ms 14540 KB Output is correct
59 Correct 563 ms 15780 KB Output is correct
60 Correct 406 ms 14828 KB Output is correct
61 Correct 559 ms 18284 KB Output is correct
62 Correct 518 ms 15696 KB Output is correct
63 Correct 534 ms 17088 KB Output is correct
64 Correct 270 ms 14460 KB Output is correct
65 Correct 270 ms 14468 KB Output is correct
66 Correct 558 ms 16664 KB Output is correct
67 Correct 478 ms 14912 KB Output is correct
68 Correct 493 ms 14580 KB Output is correct
69 Correct 494 ms 14468 KB Output is correct
70 Correct 869 ms 15416 KB Output is correct
71 Correct 819 ms 15056 KB Output is correct
72 Correct 956 ms 17008 KB Output is correct
73 Correct 973 ms 16692 KB Output is correct
74 Correct 884 ms 16328 KB Output is correct
75 Correct 934 ms 15288 KB Output is correct
76 Correct 16 ms 14548 KB Output is correct
77 Correct 23 ms 14536 KB Output is correct
78 Correct 12 ms 14560 KB Output is correct
79 Correct 69 ms 14536 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 467 ms 14592 KB Output is correct
82 Correct 445 ms 14464 KB Output is correct
83 Correct 472 ms 14540 KB Output is correct
84 Correct 568 ms 14540 KB Output is correct
85 Correct 470 ms 14576 KB Output is correct
86 Correct 423 ms 14536 KB Output is correct
87 Correct 529 ms 15772 KB Output is correct
88 Correct 393 ms 14980 KB Output is correct
89 Correct 544 ms 18252 KB Output is correct
90 Correct 529 ms 15688 KB Output is correct
91 Correct 524 ms 17016 KB Output is correct
92 Correct 270 ms 14544 KB Output is correct
93 Correct 263 ms 14452 KB Output is correct
94 Correct 525 ms 16668 KB Output is correct
95 Correct 460 ms 14920 KB Output is correct
96 Correct 773 ms 15800 KB Output is correct
97 Correct 526 ms 14704 KB Output is correct
98 Correct 757 ms 15280 KB Output is correct
99 Correct 786 ms 15760 KB Output is correct
100 Correct 795 ms 17064 KB Output is correct
101 Correct 892 ms 15476 KB Output is correct
102 Correct 781 ms 15144 KB Output is correct
103 Correct 934 ms 17052 KB Output is correct
104 Correct 903 ms 16712 KB Output is correct
105 Correct 934 ms 16308 KB Output is correct
106 Correct 875 ms 15292 KB Output is correct
107 Correct 1308 ms 15236 KB Output is correct
108 Correct 1414 ms 16664 KB Output is correct
109 Correct 1378 ms 17024 KB Output is correct
110 Correct 1328 ms 17152 KB Output is correct
111 Correct 71 ms 14468 KB Output is correct
112 Correct 570 ms 15792 KB Output is correct
113 Correct 420 ms 14948 KB Output is correct
114 Correct 540 ms 18340 KB Output is correct
115 Correct 517 ms 15736 KB Output is correct
116 Correct 539 ms 17012 KB Output is correct
117 Correct 285 ms 14448 KB Output is correct
118 Correct 287 ms 14468 KB Output is correct
119 Correct 571 ms 16676 KB Output is correct
120 Correct 455 ms 14896 KB Output is correct
121 Correct 432 ms 14540 KB Output is correct
122 Correct 489 ms 14456 KB Output is correct
123 Correct 866 ms 15388 KB Output is correct
124 Correct 775 ms 15060 KB Output is correct
125 Correct 1020 ms 17012 KB Output is correct
126 Correct 1131 ms 16684 KB Output is correct
127 Correct 931 ms 16372 KB Output is correct
128 Correct 1054 ms 15288 KB Output is correct
129 Correct 1174 ms 14544 KB Output is correct
130 Correct 1008 ms 14556 KB Output is correct
131 Correct 1860 ms 18284 KB Output is correct
132 Correct 1619 ms 14728 KB Output is correct
133 Correct 1910 ms 19520 KB Output is correct
134 Correct 1865 ms 17548 KB Output is correct
135 Correct 1773 ms 15612 KB Output is correct
136 Correct 1910 ms 17012 KB Output is correct
137 Correct 19 ms 14676 KB Output is correct
138 Correct 23 ms 14564 KB Output is correct
139 Correct 12 ms 14472 KB Output is correct
140 Correct 66 ms 14456 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 460 ms 14588 KB Output is correct
143 Correct 482 ms 14540 KB Output is correct
144 Correct 495 ms 14540 KB Output is correct
145 Correct 527 ms 14536 KB Output is correct
146 Correct 476 ms 14536 KB Output is correct
147 Correct 474 ms 14540 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 1138 ms 14540 KB Output is correct
150 Correct 937 ms 14548 KB Output is correct
151 Correct 1283 ms 14456 KB Output is correct
152 Correct 1239 ms 14456 KB Output is correct
153 Correct 953 ms 14540 KB Output is correct
154 Correct 1012 ms 14584 KB Output is correct
155 Correct 553 ms 15772 KB Output is correct
156 Correct 408 ms 14824 KB Output is correct
157 Correct 603 ms 18252 KB Output is correct
158 Correct 492 ms 15680 KB Output is correct
159 Correct 562 ms 16984 KB Output is correct
160 Correct 309 ms 14464 KB Output is correct
161 Correct 282 ms 14464 KB Output is correct
162 Correct 558 ms 16672 KB Output is correct
163 Correct 505 ms 14904 KB Output is correct
164 Correct 874 ms 15432 KB Output is correct
165 Correct 830 ms 15056 KB Output is correct
166 Correct 905 ms 17012 KB Output is correct
167 Correct 911 ms 16684 KB Output is correct
168 Correct 899 ms 16308 KB Output is correct
169 Correct 917 ms 15308 KB Output is correct
170 Correct 843 ms 15760 KB Output is correct
171 Correct 571 ms 14680 KB Output is correct
172 Correct 806 ms 15272 KB Output is correct
173 Correct 805 ms 15684 KB Output is correct
174 Correct 893 ms 17068 KB Output is correct
175 Correct 1349 ms 15228 KB Output is correct
176 Correct 1351 ms 16524 KB Output is correct
177 Correct 1392 ms 17068 KB Output is correct
178 Correct 1354 ms 17116 KB Output is correct
179 Correct 1868 ms 18284 KB Output is correct
180 Correct 1577 ms 14748 KB Output is correct
181 Correct 1840 ms 19520 KB Output is correct
182 Correct 1856 ms 17544 KB Output is correct
183 Correct 1868 ms 15692 KB Output is correct
184 Correct 1855 ms 17016 KB Output is correct
185 Correct 2699 ms 16452 KB Output is correct
186 Correct 2687 ms 18296 KB Output is correct
187 Correct 2641 ms 18272 KB Output is correct
188 Correct 2623 ms 17040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 14540 KB Output is correct
2 Correct 558 ms 15908 KB Output is correct
3 Correct 396 ms 14828 KB Output is correct
4 Correct 536 ms 18288 KB Output is correct
5 Correct 523 ms 15688 KB Output is correct
6 Correct 534 ms 17100 KB Output is correct
7 Correct 240 ms 14536 KB Output is correct
8 Correct 239 ms 14536 KB Output is correct
9 Correct 534 ms 16676 KB Output is correct
10 Correct 468 ms 14916 KB Output is correct
11 Correct 65 ms 14540 KB Output is correct
12 Correct 563 ms 15780 KB Output is correct
13 Correct 406 ms 14828 KB Output is correct
14 Correct 559 ms 18284 KB Output is correct
15 Correct 518 ms 15696 KB Output is correct
16 Correct 534 ms 17088 KB Output is correct
17 Correct 270 ms 14460 KB Output is correct
18 Correct 270 ms 14468 KB Output is correct
19 Correct 558 ms 16664 KB Output is correct
20 Correct 478 ms 14912 KB Output is correct
21 Correct 493 ms 14580 KB Output is correct
22 Correct 494 ms 14468 KB Output is correct
23 Correct 869 ms 15416 KB Output is correct
24 Correct 819 ms 15056 KB Output is correct
25 Correct 956 ms 17008 KB Output is correct
26 Correct 973 ms 16692 KB Output is correct
27 Correct 884 ms 16328 KB Output is correct
28 Correct 934 ms 15288 KB Output is correct
29 Correct 71 ms 14468 KB Output is correct
30 Correct 570 ms 15792 KB Output is correct
31 Correct 420 ms 14948 KB Output is correct
32 Correct 540 ms 18340 KB Output is correct
33 Correct 517 ms 15736 KB Output is correct
34 Correct 539 ms 17012 KB Output is correct
35 Correct 285 ms 14448 KB Output is correct
36 Correct 287 ms 14468 KB Output is correct
37 Correct 571 ms 16676 KB Output is correct
38 Correct 455 ms 14896 KB Output is correct
39 Correct 432 ms 14540 KB Output is correct
40 Correct 489 ms 14456 KB Output is correct
41 Correct 866 ms 15388 KB Output is correct
42 Correct 775 ms 15060 KB Output is correct
43 Correct 1020 ms 17012 KB Output is correct
44 Correct 1131 ms 16684 KB Output is correct
45 Correct 931 ms 16372 KB Output is correct
46 Correct 1054 ms 15288 KB Output is correct
47 Correct 1174 ms 14544 KB Output is correct
48 Correct 1008 ms 14556 KB Output is correct
49 Correct 1860 ms 18284 KB Output is correct
50 Correct 1619 ms 14728 KB Output is correct
51 Correct 1910 ms 19520 KB Output is correct
52 Correct 1865 ms 17548 KB Output is correct
53 Correct 1773 ms 15612 KB Output is correct
54 Correct 1910 ms 17012 KB Output is correct
55 Correct 73 ms 14464 KB Output is correct
56 Correct 581 ms 15784 KB Output is correct
57 Correct 416 ms 14824 KB Output is correct
58 Correct 569 ms 18288 KB Output is correct
59 Correct 507 ms 15792 KB Output is correct
60 Correct 563 ms 16956 KB Output is correct
61 Correct 300 ms 14468 KB Output is correct
62 Correct 260 ms 14464 KB Output is correct
63 Correct 560 ms 16684 KB Output is correct
64 Correct 482 ms 14912 KB Output is correct
65 Correct 508 ms 14628 KB Output is correct
66 Correct 524 ms 14540 KB Output is correct
67 Correct 868 ms 15388 KB Output is correct
68 Correct 843 ms 15064 KB Output is correct
69 Correct 939 ms 17048 KB Output is correct
70 Correct 960 ms 16684 KB Output is correct
71 Correct 897 ms 16308 KB Output is correct
72 Correct 927 ms 15284 KB Output is correct
73 Correct 899 ms 14552 KB Output is correct
74 Correct 1076 ms 14588 KB Output is correct
75 Correct 1875 ms 18252 KB Output is correct
76 Correct 1607 ms 14768 KB Output is correct
77 Correct 1894 ms 19704 KB Output is correct
78 Correct 1851 ms 17552 KB Output is correct
79 Correct 1812 ms 15564 KB Output is correct
80 Correct 1898 ms 17020 KB Output is correct
81 Execution timed out 5033 ms 15784 KB Time limit exceeded
82 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 14548 KB Output is correct
2 Correct 23 ms 14476 KB Output is correct
3 Correct 12 ms 14552 KB Output is correct
4 Correct 65 ms 14464 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 525 ms 14460 KB Output is correct
7 Correct 439 ms 14448 KB Output is correct
8 Correct 437 ms 14540 KB Output is correct
9 Correct 472 ms 14456 KB Output is correct
10 Correct 485 ms 14540 KB Output is correct
11 Correct 491 ms 14448 KB Output is correct
12 Correct 17 ms 14548 KB Output is correct
13 Correct 22 ms 14548 KB Output is correct
14 Correct 17 ms 14556 KB Output is correct
15 Correct 67 ms 14544 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 501 ms 14596 KB Output is correct
18 Correct 409 ms 14624 KB Output is correct
19 Correct 557 ms 14544 KB Output is correct
20 Correct 490 ms 14544 KB Output is correct
21 Correct 468 ms 14452 KB Output is correct
22 Correct 559 ms 14576 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1229 ms 14540 KB Output is correct
25 Correct 1065 ms 14544 KB Output is correct
26 Correct 1262 ms 14552 KB Output is correct
27 Correct 1236 ms 14580 KB Output is correct
28 Correct 973 ms 14540 KB Output is correct
29 Correct 946 ms 14464 KB Output is correct
30 Correct 64 ms 14540 KB Output is correct
31 Correct 558 ms 15908 KB Output is correct
32 Correct 396 ms 14828 KB Output is correct
33 Correct 536 ms 18288 KB Output is correct
34 Correct 523 ms 15688 KB Output is correct
35 Correct 534 ms 17100 KB Output is correct
36 Correct 240 ms 14536 KB Output is correct
37 Correct 239 ms 14536 KB Output is correct
38 Correct 534 ms 16676 KB Output is correct
39 Correct 468 ms 14916 KB Output is correct
40 Correct 21 ms 14548 KB Output is correct
41 Correct 22 ms 14548 KB Output is correct
42 Correct 13 ms 14472 KB Output is correct
43 Correct 69 ms 14540 KB Output is correct
44 Correct 555 ms 15780 KB Output is correct
45 Correct 433 ms 14828 KB Output is correct
46 Correct 566 ms 18252 KB Output is correct
47 Correct 493 ms 15692 KB Output is correct
48 Correct 516 ms 16992 KB Output is correct
49 Correct 247 ms 14540 KB Output is correct
50 Correct 258 ms 14544 KB Output is correct
51 Correct 569 ms 16696 KB Output is correct
52 Correct 501 ms 14964 KB Output is correct
53 Correct 816 ms 15908 KB Output is correct
54 Correct 509 ms 14744 KB Output is correct
55 Correct 767 ms 15276 KB Output is correct
56 Correct 786 ms 15740 KB Output is correct
57 Correct 789 ms 17080 KB Output is correct
58 Correct 65 ms 14540 KB Output is correct
59 Correct 563 ms 15780 KB Output is correct
60 Correct 406 ms 14828 KB Output is correct
61 Correct 559 ms 18284 KB Output is correct
62 Correct 518 ms 15696 KB Output is correct
63 Correct 534 ms 17088 KB Output is correct
64 Correct 270 ms 14460 KB Output is correct
65 Correct 270 ms 14468 KB Output is correct
66 Correct 558 ms 16664 KB Output is correct
67 Correct 478 ms 14912 KB Output is correct
68 Correct 493 ms 14580 KB Output is correct
69 Correct 494 ms 14468 KB Output is correct
70 Correct 869 ms 15416 KB Output is correct
71 Correct 819 ms 15056 KB Output is correct
72 Correct 956 ms 17008 KB Output is correct
73 Correct 973 ms 16692 KB Output is correct
74 Correct 884 ms 16328 KB Output is correct
75 Correct 934 ms 15288 KB Output is correct
76 Correct 16 ms 14548 KB Output is correct
77 Correct 23 ms 14536 KB Output is correct
78 Correct 12 ms 14560 KB Output is correct
79 Correct 69 ms 14536 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 467 ms 14592 KB Output is correct
82 Correct 445 ms 14464 KB Output is correct
83 Correct 472 ms 14540 KB Output is correct
84 Correct 568 ms 14540 KB Output is correct
85 Correct 470 ms 14576 KB Output is correct
86 Correct 423 ms 14536 KB Output is correct
87 Correct 529 ms 15772 KB Output is correct
88 Correct 393 ms 14980 KB Output is correct
89 Correct 544 ms 18252 KB Output is correct
90 Correct 529 ms 15688 KB Output is correct
91 Correct 524 ms 17016 KB Output is correct
92 Correct 270 ms 14544 KB Output is correct
93 Correct 263 ms 14452 KB Output is correct
94 Correct 525 ms 16668 KB Output is correct
95 Correct 460 ms 14920 KB Output is correct
96 Correct 773 ms 15800 KB Output is correct
97 Correct 526 ms 14704 KB Output is correct
98 Correct 757 ms 15280 KB Output is correct
99 Correct 786 ms 15760 KB Output is correct
100 Correct 795 ms 17064 KB Output is correct
101 Correct 892 ms 15476 KB Output is correct
102 Correct 781 ms 15144 KB Output is correct
103 Correct 934 ms 17052 KB Output is correct
104 Correct 903 ms 16712 KB Output is correct
105 Correct 934 ms 16308 KB Output is correct
106 Correct 875 ms 15292 KB Output is correct
107 Correct 1308 ms 15236 KB Output is correct
108 Correct 1414 ms 16664 KB Output is correct
109 Correct 1378 ms 17024 KB Output is correct
110 Correct 1328 ms 17152 KB Output is correct
111 Correct 71 ms 14468 KB Output is correct
112 Correct 570 ms 15792 KB Output is correct
113 Correct 420 ms 14948 KB Output is correct
114 Correct 540 ms 18340 KB Output is correct
115 Correct 517 ms 15736 KB Output is correct
116 Correct 539 ms 17012 KB Output is correct
117 Correct 285 ms 14448 KB Output is correct
118 Correct 287 ms 14468 KB Output is correct
119 Correct 571 ms 16676 KB Output is correct
120 Correct 455 ms 14896 KB Output is correct
121 Correct 432 ms 14540 KB Output is correct
122 Correct 489 ms 14456 KB Output is correct
123 Correct 866 ms 15388 KB Output is correct
124 Correct 775 ms 15060 KB Output is correct
125 Correct 1020 ms 17012 KB Output is correct
126 Correct 1131 ms 16684 KB Output is correct
127 Correct 931 ms 16372 KB Output is correct
128 Correct 1054 ms 15288 KB Output is correct
129 Correct 1174 ms 14544 KB Output is correct
130 Correct 1008 ms 14556 KB Output is correct
131 Correct 1860 ms 18284 KB Output is correct
132 Correct 1619 ms 14728 KB Output is correct
133 Correct 1910 ms 19520 KB Output is correct
134 Correct 1865 ms 17548 KB Output is correct
135 Correct 1773 ms 15612 KB Output is correct
136 Correct 1910 ms 17012 KB Output is correct
137 Correct 19 ms 14676 KB Output is correct
138 Correct 23 ms 14564 KB Output is correct
139 Correct 12 ms 14472 KB Output is correct
140 Correct 66 ms 14456 KB Output is correct
141 Correct 0 ms 212 KB Output is correct
142 Correct 460 ms 14588 KB Output is correct
143 Correct 482 ms 14540 KB Output is correct
144 Correct 495 ms 14540 KB Output is correct
145 Correct 527 ms 14536 KB Output is correct
146 Correct 476 ms 14536 KB Output is correct
147 Correct 474 ms 14540 KB Output is correct
148 Correct 0 ms 212 KB Output is correct
149 Correct 1138 ms 14540 KB Output is correct
150 Correct 937 ms 14548 KB Output is correct
151 Correct 1283 ms 14456 KB Output is correct
152 Correct 1239 ms 14456 KB Output is correct
153 Correct 953 ms 14540 KB Output is correct
154 Correct 1012 ms 14584 KB Output is correct
155 Correct 553 ms 15772 KB Output is correct
156 Correct 408 ms 14824 KB Output is correct
157 Correct 603 ms 18252 KB Output is correct
158 Correct 492 ms 15680 KB Output is correct
159 Correct 562 ms 16984 KB Output is correct
160 Correct 309 ms 14464 KB Output is correct
161 Correct 282 ms 14464 KB Output is correct
162 Correct 558 ms 16672 KB Output is correct
163 Correct 505 ms 14904 KB Output is correct
164 Correct 874 ms 15432 KB Output is correct
165 Correct 830 ms 15056 KB Output is correct
166 Correct 905 ms 17012 KB Output is correct
167 Correct 911 ms 16684 KB Output is correct
168 Correct 899 ms 16308 KB Output is correct
169 Correct 917 ms 15308 KB Output is correct
170 Correct 843 ms 15760 KB Output is correct
171 Correct 571 ms 14680 KB Output is correct
172 Correct 806 ms 15272 KB Output is correct
173 Correct 805 ms 15684 KB Output is correct
174 Correct 893 ms 17068 KB Output is correct
175 Correct 1349 ms 15228 KB Output is correct
176 Correct 1351 ms 16524 KB Output is correct
177 Correct 1392 ms 17068 KB Output is correct
178 Correct 1354 ms 17116 KB Output is correct
179 Correct 1868 ms 18284 KB Output is correct
180 Correct 1577 ms 14748 KB Output is correct
181 Correct 1840 ms 19520 KB Output is correct
182 Correct 1856 ms 17544 KB Output is correct
183 Correct 1868 ms 15692 KB Output is correct
184 Correct 1855 ms 17016 KB Output is correct
185 Correct 2699 ms 16452 KB Output is correct
186 Correct 2687 ms 18296 KB Output is correct
187 Correct 2641 ms 18272 KB Output is correct
188 Correct 2623 ms 17040 KB Output is correct
189 Correct 73 ms 14464 KB Output is correct
190 Correct 581 ms 15784 KB Output is correct
191 Correct 416 ms 14824 KB Output is correct
192 Correct 569 ms 18288 KB Output is correct
193 Correct 507 ms 15792 KB Output is correct
194 Correct 563 ms 16956 KB Output is correct
195 Correct 300 ms 14468 KB Output is correct
196 Correct 260 ms 14464 KB Output is correct
197 Correct 560 ms 16684 KB Output is correct
198 Correct 482 ms 14912 KB Output is correct
199 Correct 508 ms 14628 KB Output is correct
200 Correct 524 ms 14540 KB Output is correct
201 Correct 868 ms 15388 KB Output is correct
202 Correct 843 ms 15064 KB Output is correct
203 Correct 939 ms 17048 KB Output is correct
204 Correct 960 ms 16684 KB Output is correct
205 Correct 897 ms 16308 KB Output is correct
206 Correct 927 ms 15284 KB Output is correct
207 Correct 899 ms 14552 KB Output is correct
208 Correct 1076 ms 14588 KB Output is correct
209 Correct 1875 ms 18252 KB Output is correct
210 Correct 1607 ms 14768 KB Output is correct
211 Correct 1894 ms 19704 KB Output is correct
212 Correct 1851 ms 17552 KB Output is correct
213 Correct 1812 ms 15564 KB Output is correct
214 Correct 1898 ms 17020 KB Output is correct
215 Execution timed out 5033 ms 15784 KB Time limit exceeded
216 Halted 0 ms 0 KB -