QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#351272 | #965. Trade | chenxinyang2006# | AC ✓ | 93ms | 10188kb | C++14 | 3.0kb | 2024-03-11 19:35:52 | 2024-03-11 19:35:54 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define db double
#define ldb long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mkp make_pair
#define eb emplace_back
#define SZ(S) (int)S.size()
//#define mod 998244353
//#define mod 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3f
using namespace std;
template <class T>
void chkmax(T &x,T y){
if(x < y) x = y;
}
template <class T>
void chkmin(T &x,T y){
if(x > y) x = y;
}
inline int popcnt(int x){
return __builtin_popcount(x);
}
inline int ctz(int x){
return __builtin_ctz(x);
}
/*ll power(ll p,int k = mod - 2){
ll ans = 1;
while(k){
if(k % 2 == 1) ans = ans * p % mod;
p = p * p % mod;
k /= 2;
}
return ans;
}*/
int n,S;
int c[100005],p[100005],ord[100005],tmp[100005];
bool cmp(int x,int y){
return p[x] > p[y];
}
int cnt;
struct node{
int siz,l,r,w;
ll val,tag,rktag;
}tree[100005];
#define ls(rt) tree[rt].l
#define rs(rt) tree[rt].r
void upd(int rt,ll C1,ll C2){
tree[rt].val += C1;
tree[rt].val += (tree[ls(rt)].siz + 1) * C2;
tree[rt].tag += C1;
tree[rt].rktag += C2;
}
void pushdown(int rt){
upd(ls(rt),tree[rt].tag,tree[rt].rktag);
upd(rs(rt),tree[rt].tag + tree[rt].rktag * (tree[ls(rt)].siz + 1),tree[rt].rktag);
tree[rt].tag = tree[rt].rktag = 0;
}
void pushup(int rt){
tree[rt].siz = tree[ls(rt)].siz + tree[rs(rt)].siz + 1;
}
void split(int rt,ll val,int &x,int &y){
if(!rt){
x = y = 0;
return;
}
pushdown(rt);
if(tree[rt].val <= val){
x = rt;
split(rs(rt),val,rs(rt),y);
}else{
y = rt;
split(ls(rt),val,x,ls(rt));
}
pushup(rt);
}
int Merge(int x,int y){
if(!x || !y) return x + y;
if(tree[x].w < tree[y].w){
pushdown(x);
rs(x) = Merge(rs(x),y);
pushup(x);
return x;
}else{
pushdown(y);
ls(y) = Merge(x,ls(y));
pushup(y);
return y;
}
}
int rt;
void ins(int u,int val){
int a,b;
split(rt,val,a,b);
rt = Merge(a,Merge(u,b));
}
mt19937 rnd(0);
int N;
ll ans[100005];
void travel(int u){
if(!u) return;
pushdown(u);
travel(ls(u));
ans[++N] = tree[u].val;
travel(rs(u));
}
int main(){
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
scanf("%d%d",&n,&S);
rep(i,1,n) scanf("%d",&c[i]);
rep(i,1,n){
scanf("%d",&p[i]);
ord[i] = i;
}
sort(ord + 1,ord + n + 1,cmp);
rep(i,1,n) tmp[i] = p[ord[i]];
rep(i,1,n) p[i] = tmp[i];
rep(i,1,n) tmp[i] = c[ord[i]];
rep(i,1,n) c[i] = tmp[i];
rep(i,1,n){
tree[i].siz = 1;
tree[i].w = rnd();tree[i].val = c[i];
ins(i,c[i]);
upd(rt,-p[i] + p[i + 1],p[i] - p[i + 1]);
N = 0;
// travel(rt);
// rep(k,1,N) printf("%lld ",ans[k]);
// printf("\n");
}
travel(rt);
int output = 0;
while(output < n && S >= ans[output + 1]){
output++;
S -= ans[output];
}
printf("%d\n",output);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3804kb
input:
2 5 1 1 10 11
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 22 10 1 0 10000
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3960kb
input:
1 0 1 0
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
100 100 27 64 97 65 62 73 4 99 39 28 73 80 22 58 49 47 28 63 8 36 1 98 81 74 22 48 44 1 40 46 28 9 42 18 74 97 14 34 53 58 58 34 35 96 32 82 32 17 36 4 46 79 14 15 82 9 7 56 75 73 95 57 2 10 4 59 25 28 91 71 34 26 6 67 52 48 10 36 69 21 84 28 50 7 50 99 64 92 46 83 25 39 57 96 94 87 53 79 20 75 47 9...
output:
6
result:
ok 1 number(s): "6"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
100 1000000000 92 10 63 82 27 70 84 27 51 82 31 89 36 87 88 4 78 94 98 80 85 36 5 76 72 43 18 57 25 25 68 97 70 15 66 33 21 48 75 96 57 80 87 84 74 83 81 20 2 73 67 10 4 62 77 37 88 48 7 86 56 69 65 20 63 60 95 55 95 1 60 61 82 49 51 69 80 81 63 21 67 56 48 94 42 91 44 19 81 58 16 79 36 66 61 55 73 ...
output:
100
result:
ok 1 number(s): "100"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
100 1000000000 120257228 557511186 386772241 2806964 773458571 348106345 915880772 645203887 358800633 71539475 90761197 668794032 828988857 53801363 163581988 334995719 656620400 748708478 180228942 195311072 632338909 421944369 384634443 401198678 512399678 259642866 663773698 116444419 278003602 ...
output:
14
result:
ok 1 number(s): "14"
Test #7:
score: 0
Accepted
time: 6ms
memory: 4440kb
input:
10000 10000 553 5780 2647 3284 1514 4103 7505 6005 1418 1765 2996 7475 6899 8544 2259 7743 4145 3695 368 6334 949 4674 3498 9956 1077 7837 4954 5947 4147 7667 1141 3136 7246 5437 7451 7813 8259 7729 5746 5970 1788 7713 4728 3035 6648 619 3256 5830 9341 7117 1475 2492 5235 5734 3590 2280 6501 481 415...
output:
15
result:
ok 1 number(s): "15"
Test #8:
score: 0
Accepted
time: 5ms
memory: 4400kb
input:
10000 1000000000 3 48 65 79 65 53 64 86 66 4 67 11 13 59 60 80 79 88 77 70 75 41 46 37 37 89 70 52 24 5 24 31 17 71 65 10 54 17 50 52 91 65 73 36 19 56 96 4 83 100 22 48 60 90 56 18 50 85 100 27 73 13 97 54 35 41 39 25 20 13 53 50 51 5 25 97 28 49 73 93 48 91 40 35 35 39 71 82 75 29 84 94 6 50 3 74 ...
output:
1818
result:
ok 1 number(s): "1818"
Test #9:
score: 0
Accepted
time: 7ms
memory: 4480kb
input:
10000 1000000000 17478881 846868180 252834662 584621530 688368711 649771552 897367118 857304150 840702693 367368413 387315882 785727134 410284672 300499440 142912462 428466550 918774960 630206990 117113626 804456081 773064621 590760931 912927447 934569708 61621694 446616310 754044998 568678757 98709...
output:
133
result:
ok 1 number(s): "133"
Test #10:
score: 0
Accepted
time: 57ms
memory: 10044kb
input:
100000 1000000 593 8988 4850 5332 302 7862 7748 2674 9256 1110 2765 2184 9013 9678 5509 2524 9918 9091 2399 9526 971 3951 1421 1339 2583 1139 5594 4113 981 5049 9790 4466 1625 470 829 5569 4768 103 2074 4627 8261 3326 6514 2951 9275 4486 2782 9908 7363 4876 7232 913 7950 4772 8333 5880 8968 9789 889...
output:
143
result:
ok 1 number(s): "143"
Test #11:
score: 0
Accepted
time: 53ms
memory: 10180kb
input:
100000 1000000000 78 34 24 65 50 6 44 45 3 17 74 76 95 2 53 99 96 27 71 36 43 25 48 74 45 9 1 18 81 52 26 15 18 53 7 35 51 34 84 25 31 24 23 35 6 96 33 84 56 30 8 67 47 66 11 96 30 74 13 36 63 14 56 50 25 94 62 55 34 26 97 9 48 73 11 71 43 44 33 77 24 54 9 83 53 95 24 59 45 10 62 72 81 33 52 79 94 5...
output:
1818
result:
ok 1 number(s): "1818"
Test #12:
score: 0
Accepted
time: 93ms
memory: 10144kb
input:
100000 1000000000 655850704 799318532 847362720 860512043 309964082 914190394 205369361 539257741 348555792 683603870 753264008 462739624 671291326 505596508 404015036 160676590 385760635 293958915 655884949 328158528 279707446 652532235 905470741 173927845 399847721 945020051 258905368 336120002 79...
output:
251
result:
ok 1 number(s): "251"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
10 100 8 7 14 14 3 4 15 18 14 5 10 2 3 7 8 5 9 6 1 4
output:
6
result:
ok 1 number(s): "6"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
10 10000 18 19 9 6 20 19 16 1 4 1 14 54 43 32 20 31 25 51 88 41
output:
10
result:
ok 1 number(s): "10"
Test #15:
score: 0
Accepted
time: 1ms
memory: 4008kb
input:
1000 1000000000 8 17 17 7 18 15 8 3 1 12 8 16 8 6 15 3 7 4 4 17 6 18 11 3 10 10 5 13 1 13 2 12 20 20 16 9 2 15 14 13 17 18 14 19 1 13 3 12 15 16 8 5 11 7 5 5 4 7 14 17 1 19 10 14 8 1 12 11 18 5 16 16 2 8 20 17 5 6 1 17 10 4 5 18 2 9 13 6 11 2 19 16 4 19 11 8 6 8 19 20 20 15 2 9 2 15 19 19 20 16 18 1...
output:
1000
result:
ok 1 number(s): "1000"
Test #16:
score: 0
Accepted
time: 1ms
memory: 3988kb
input:
1000 1000000000 14 7 3 14 5 8 18 17 2 10 6 11 9 5 20 5 16 13 19 9 3 11 6 14 14 8 14 3 14 7 3 4 15 8 19 13 9 5 2 5 19 7 8 1 10 14 19 20 6 13 10 8 12 3 3 5 12 5 13 4 12 20 3 16 3 4 20 3 10 2 20 20 2 9 11 5 1 12 5 19 6 10 7 5 11 15 10 13 10 11 20 9 12 11 18 1 6 19 20 10 11 15 14 19 2 19 2 15 19 20 20 7...
output:
390
result:
ok 1 number(s): "390"
Test #17:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
1000 1000000000 14 13 4 9 6 17 9 10 11 8 19 12 6 7 12 3 17 8 16 11 18 20 12 17 20 10 8 12 6 1 6 13 15 6 3 17 10 7 2 4 9 11 13 8 1 13 11 11 17 12 8 1 11 14 12 3 10 17 14 16 3 19 20 7 3 12 3 11 7 8 9 11 18 10 4 7 11 17 20 13 13 4 10 3 4 7 16 14 13 16 10 16 6 11 2 19 4 2 8 7 1 8 16 18 3 18 11 6 12 5 7 ...
output:
18
result:
ok 1 number(s): "18"
Test #18:
score: 0
Accepted
time: 53ms
memory: 10000kb
input:
100000 1000000000 6 5 5 18 6 11 17 20 19 6 2 14 7 10 8 9 15 7 15 14 20 7 13 17 8 4 6 3 11 16 13 6 20 2 14 1 4 5 15 12 3 2 17 4 12 13 18 2 4 1 19 19 3 6 9 11 15 10 19 2 6 11 19 3 17 3 14 17 1 5 12 19 2 13 10 14 6 13 2 5 12 4 10 4 8 5 2 15 16 11 14 18 7 2 4 13 11 3 18 17 19 8 2 9 8 18 2 4 2 15 8 3 12 ...
output:
1817
result:
ok 1 number(s): "1817"
Test #19:
score: 0
Accepted
time: 56ms
memory: 10152kb
input:
100000 1000000000 13 17 14 19 17 14 8 13 5 19 13 14 18 9 20 19 9 16 18 3 8 10 5 16 6 14 10 2 15 2 3 17 10 4 13 9 15 6 5 18 9 9 11 7 5 19 13 4 4 7 1 10 7 5 18 3 17 12 7 14 8 6 8 6 5 12 12 17 6 10 14 12 3 5 3 2 4 14 12 10 2 14 20 7 1 7 13 17 19 11 17 9 13 20 13 7 12 19 13 9 9 6 14 10 8 20 14 18 11 6 1...
output:
844
result:
ok 1 number(s): "844"
Test #20:
score: 0
Accepted
time: 52ms
memory: 10116kb
input:
100000 1000000000 3 13 6 16 20 13 2 15 17 4 8 8 12 20 20 17 15 20 1 9 3 9 15 15 1 1 14 1 16 3 19 1 6 6 18 9 18 1 17 20 20 8 4 7 12 20 4 2 3 15 14 18 8 18 20 13 6 3 19 2 18 11 3 10 6 17 18 7 5 2 5 6 15 2 7 7 17 6 15 15 7 9 12 8 17 3 8 6 7 19 5 10 15 1 16 6 19 13 11 9 15 18 6 13 3 10 8 9 11 4 9 17 17 ...
output:
84
result:
ok 1 number(s): "84"
Test #21:
score: 0
Accepted
time: 63ms
memory: 10088kb
input:
100000 284324 6 5 11 11 7 8 10 16 13 13 14 15 6 8 15 11 5 17 4 15 10 11 15 20 13 20 18 2 11 2 18 2 10 6 2 1 9 8 14 8 8 3 9 19 2 16 6 19 17 19 2 19 5 19 11 12 2 9 18 1 12 6 15 9 11 7 10 3 4 12 14 18 7 7 10 5 5 6 5 2 3 6 12 18 18 15 2 11 6 16 19 13 17 14 17 1 17 19 8 4 9 13 5 13 3 2 11 10 9 14 13 18 2...
output:
119
result:
ok 1 number(s): "119"
Test #22:
score: 0
Accepted
time: 70ms
memory: 10056kb
input:
100000 284324 69191 31484 98004 95881 46963 79646 55159 72635 76793 95072 58676 61397 87001 58432 34730 95992 56148 72565 38933 80486 36171 31829 88760 48453 98840 46909 6743 91540 18114 38837 52033 99792 45905 24610 2302 94850 93812 70921 45733 27360 5002 24604 62484 76547 56787 85424 39763 15318 3...
output:
44
result:
ok 1 number(s): "44"
Test #23:
score: 0
Accepted
time: 84ms
memory: 10044kb
input:
100000 1000000000 69378460 233413476 208889501 720996600 291941546 911904805 522353785 618651565 974887814 688607031 385207699 94244661 600284582 708558061 105758319 710070304 814741540 129255293 808959880 50706568 851812010 940342187 287265143 222407243 759081339 596366257 778533616 595933161 66813...
output:
254
result:
ok 1 number(s): "254"
Test #24:
score: 0
Accepted
time: 85ms
memory: 10112kb
input:
100000 1000000000 75360483 814474522 906193224 968842776 81372626 927076143 551097790 138611649 699142770 28689183 616733101 104185877 613636530 890246623 468132699 607523859 338955517 963334978 316138521 161635546 261752918 229201656 664090451 502268315 586163008 419786604 85134750 201656179 996804...
output:
144
result:
ok 1 number(s): "144"
Test #25:
score: 0
Accepted
time: 69ms
memory: 10060kb
input:
100000 1000000000 780148326 56793980 95285626 959896385 367942384 157510119 45643998 198356427 38804627 489895277 896128009 591935021 911708504 399488288 47953532 56683909 547967481 941140597 747581249 575955431 145203511 433758276 8271575 629070970 20774600 212299491 699825635 597687721 125170772 3...
output:
27
result:
ok 1 number(s): "27"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
100 100000 2 19 99 95 46 53 11 44 53 59 22 96 12 76 52 81 83 22 95 67 34 63 28 11 68 89 22 5 69 2 54 64 77 74 100 26 76 72 7 71 5 21 69 8 28 41 69 48 83 87 87 41 5 74 11 62 36 39 68 7 87 70 72 32 65 39 34 52 12 58 1 34 87 12 30 70 32 79 69 75 18 35 7 8 37 20 85 40 89 2 89 17 43 37 96 67 77 44 11 49 ...
output:
83
result:
ok 1 number(s): "83"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
100 1000000 9188 2849 2094 7722 2372 5468 2576 1133 3220 1695 3330 1090 5982 1676 5643 7082 6232 6876 9210 5027 9499 2059 6265 2302 671 3246 9278 6277 6669 1680 7304 4896 4373 6571 2366 46 5702 580 5534 8354 3354 9495 91 1848 5542 9796 7601 8188 5728 1964 5405 2503 3730 7581 7313 3526 8363 8516 3989...
output:
100
result:
ok 1 number(s): "100"
Test #28:
score: 0
Accepted
time: 41ms
memory: 10004kb
input:
100000 1000000000 775683 880441 376230 193944 991836 97031 920959 151637 691426 890551 202259 459189 186852 621953 346989 532483 323337 23437 459177 811587 321432 673149 265629 988570 850034 977433 83830 170338 185838 417073 767712 232383 198709 636166 408648 968830 538181 561279 779121 100565 58996...
output:
1807
result:
ok 1 number(s): "1807"
Test #29:
score: 0
Accepted
time: 41ms
memory: 10188kb
input:
100000 1000000000 9598886 7237741 8662013 5445930 1552610 9401766 1030134 9490921 4351238 8200461 8180954 9982092 139024 7645627 2826399 3915195 5340244 7909570 150087 4673409 9152578 5991083 3687528 8450097 5698475 4863406 324463 5567273 4596993 8310322 5541841 9570234 6984263 5264937 6078787 44800...
output:
1402
result:
ok 1 number(s): "1402"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3968kb
input:
100 100000 96 76 2 5 52 43 83 52 44 40 72 2 81 18 46 12 11 74 5 36 69 39 70 85 34 7 72 95 32 96 41 37 17 22 1 71 19 22 87 26 89 74 30 87 70 58 34 49 11 7 8 54 95 21 87 39 67 62 34 89 8 28 22 69 37 63 68 44 77 41 100 68 11 79 69 28 69 12 32 20 76 67 89 87 64 75 11 59 5 99 7 77 53 65 2 35 12 53 83 48 ...
output:
82
result:
ok 1 number(s): "82"
Test #31:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
100 1000000 1453 7313 8188 2372 7722 5643 7501 9210 6954 8911 6876 9264 4736 9171 5468 3205 4684 3330 1133 5713 671 8336 4621 7793 9499 6913 780 4616 3730 8936 2916 5723 6344 3989 7785 9897 5405 9717 5610 2044 6790 678 9796 8769 5570 91 2400 2094 4750 8635 5702 7581 6669 2503 2849 6697 2040 2019 657...
output:
100
result:
ok 1 number(s): "100"
Test #32:
score: 0
Accepted
time: 51ms
memory: 10148kb
input:
100000 1000000000 224844 119233 626655 805937 7962 902912 79024 847315 311134 108779 797867 543588 813056 381395 657039 470292 680214 976823 543625 188532 681829 330475 734869 11056 148983 22862 916120 829153 813974 586091 232727 768029 801576 366863 594292 31049 464856 441860 221470 898878 412759 7...
output:
891
result:
ok 1 number(s): "891"
Test #33:
score: 0
Accepted
time: 62ms
memory: 10160kb
input:
100000 1000000000 389428 2743189 1326220 4544754 8436813 586289 8957617 494528 5636959 1781481 1800581 17229 9846899 2343551 7154681 6084989 4652710 2077312 9835760 5319495 826038 4011044 6304728 1537785 4293853 5132870 9664517 4420824 5397732 1675353 4446877 414690 2996294 4728530 3921811 5506789 8...
output:
125
result:
ok 1 number(s): "125"
Test #34:
score: 0
Accepted
time: 50ms
memory: 10148kb
input:
100000 1000000000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1817
result:
ok 1 number(s): "1817"
Test #35:
score: 0
Accepted
time: 53ms
memory: 10184kb
input:
100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1
result:
ok 1 number(s): "1"
Test #36:
score: 0
Accepted
time: 46ms
memory: 10152kb
input:
100000 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
0
result:
ok 1 number(s): "0"
Test #37:
score: 0
Accepted
time: 1ms
memory: 3952kb
input:
12 343 9 6 3 10 4 4 1 2 7 1 1 4 13 27 22 6 21 20 15 5 10 11 18 7
output:
9
result:
ok 1 number(s): "9"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
12 396 9 9 6 5 3 5 10 5 3 4 8 8 6 1 19 25 27 13 2 7 15 16 22 17
output:
9
result:
ok 1 number(s): "9"
Test #39:
score: 0
Accepted
time: 1ms
memory: 3820kb
input:
12 528608839 5 9 1 6 9 8 3 3 5 6 7 10 6 16 27 2 0 7 13 24 10 4 28 26
output:
12
result:
ok 1 number(s): "12"
Test #40:
score: 0
Accepted
time: 67ms
memory: 10044kb
input:
100000 549506373 299350 113613 299791 378999 278111 175495 306608 253965 399030 7674 346302 390704 199218 417121 380556 181999 117470 341885 170579 78891 317360 322780 8269 372954 374768 48637 353863 309888 61164 249574 98507 6477 295006 351131 285876 18502 357817 228687 340043 374572 123007 70940 3...
output:
1001
result:
ok 1 number(s): "1001"
Test #41:
score: 0
Accepted
time: 1ms
memory: 3948kb
input:
1 1 1 0
output:
1
result:
ok 1 number(s): "1"
Test #42:
score: 0
Accepted
time: 67ms
memory: 10148kb
input:
100000 65606465 70923 118904 594867 262154 29969 424292 134874 116354 596667 98562 154594 276176 376095 84507 573685 24625 69086 403298 209234 168307 314602 559790 520758 535769 357952 239921 475889 277757 254881 15206 275482 557128 106465 223981 141887 555309 198815 125256 93590 236071 418844 44355...
output:
350
result:
ok 1 number(s): "350"
Test #43:
score: 0
Accepted
time: 72ms
memory: 10188kb
input:
100000 69370168 32726 376674 500723 498264 71431 544158 26744 197796 140426 138310 289854 286412 358443 115595 178369 261160 79867 468943 211712 212841 194494 517912 386588 403168 230919 427933 171400 320931 298958 101735 243735 289539 447519 496572 546468 249487 261818 162708 524396 184094 527989 2...
output:
350
result:
ok 1 number(s): "350"
Test #44:
score: 0
Accepted
time: 69ms
memory: 10044kb
input:
98062 93416493 81002 85843 183628 80585 186639 43149 165724 152879 249187 315662 244828 129914 66659 47450 205069 348678 205969 35435 178876 123920 323779 25229 116733 355466 354072 175012 240425 123516 368640 120008 385549 69044 258430 138360 241641 398413 98317 234981 96878 342148 105025 299021 10...
output:
490
result:
ok 1 number(s): "490"
Test #45:
score: 0
Accepted
time: 79ms
memory: 10112kb
input:
100000 68355590 523388 20698 109144 180020 355475 319453 217520 196923 52566 598294 77839 358080 528633 455151 178704 467583 130873 423189 311106 41712 318618 58184 384115 82263 288425 345923 394405 67298 176452 112607 459308 272088 228908 111787 478871 14157 458377 505886 224736 197062 485473 39507...
output:
350
result:
ok 1 number(s): "350"
Test #46:
score: 0
Accepted
time: 64ms
memory: 9576kb
input:
90000 701709842 351975578 332990149 173061037 6783 1878 331626014 700651293 197019280 262716853 1220 4991 7517 435 436 529 4242 9374 1085 62 651959222 282273246 448759274 553723076 5842 285595427 5379 5089 4455 9605 187853023 429568667 1286 592 3458 317 4881 7855 663397244 242098601 341 587886045 60...
output:
153
result:
ok 1 number(s): "153"
Test #47:
score: 0
Accepted
time: 80ms
memory: 10152kb
input:
100000 545370978 456699999 456596112 4767 8110 323823553 1737 164 7405 3442 511024111 4556 234446009 7995 341530579 522167915 1202 941 198247157 2790 7557 882 280447192 296390288 1938 7109 422355977 8903 179777525 372478603 1425 1895 1938 9470 176 160136031 469 8407 187307531 6263 387689046 3925 491...
output:
117
result:
ok 1 number(s): "117"
Test #48:
score: 0
Accepted
time: 66ms
memory: 10056kb
input:
100000 835737295 836 978 4127 825301971 1601 8276 7657 1420 3970 981 1091 778310394 925 731926335 5293 9335 8874 763 264023369 2695 1398 1922 9113 1175 3689 649917034 177 1586 335 1447 291915874 158 9127 1722 339303482 671037416 390301823 560 811 289 3234 3805 1791 271812847 498129167 9365 4144 9160...
output:
204
result:
ok 1 number(s): "204"
Test #49:
score: 0
Accepted
time: 68ms
memory: 10160kb
input:
100000 694690416 4980 1297 143342488 1922 1287 8915 4597 7736 3850 1120 415271889 488 1000 440 4939 260 6116 4979 2208 9350 201 6964 8201 1400 5147 1133 1716 6387 9247 263 5730 8152 1037 4141 2228 75 477403938 7913 497405343 5980 1021 1449 9104 1532 53 3858 1787 1713 78 544827475 4605 8737 329 949 9...
output:
262
result:
ok 1 number(s): "262"
Test #50:
score: 0
Accepted
time: 66ms
memory: 10048kb
input:
100000 655688072 3632 9074 6275 8183 7893 3731 2038 2453 5116 2391 7062 794 8615 355 1798 8207 282581330 8535 8995 2693 9169 1459 5417 8151 3473 606 9046 9065 4525 9171 5485 9304 2724 6945 4221 9838 323 9620 9100 4766 7058 388 1516 439365770 2001 4780 4664 9523 608912031 651 2698 7994 6101 7042 6026...
output:
255
result:
ok 1 number(s): "255"
Test #51:
score: 0
Accepted
time: 8ms
memory: 4872kb
input:
15000 766572536 1785 1043 1357 1449 1059 1866 783 617 354 601 1237 851 1490 146 1102 720 728 1896 964 1714 1820 8771 1641 217803525 380 797 651 741 1651 246 1595 7025 675804071 1841 1942 356399570 6626 1581 1316 981 563 597 802 170 405 1572 333 4801 8268 604 8085 810 757 1547 974 580 1238 148 104 13...
output:
590
result:
ok 1 number(s): "590"
Test #52:
score: 0
Accepted
time: 51ms
memory: 10124kb
input:
100000 999000013 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
2
result:
ok 1 number(s): "2"
Test #53:
score: 0
Accepted
time: 87ms
memory: 10076kb
input:
99123 196672093 947954425 774958945 656774125 752174054 918164220 535247149 568942810 870478286 394797557 5954626 258324998 391526995 40970446 3457869 501858121 755075712 626533438 86555576 917333688 851830153 963150476 423250833 743357506 448612473 398535254 470310052 271712029 299599595 993370864 ...
output:
55
result:
ok 1 number(s): "55"
Test #54:
score: 0
Accepted
time: 81ms
memory: 10116kb
input:
99999 215230924 84793846 433800136 403365218 9901377 408602007 148187440 996114258 469362781 554762067 879603682 629452005 98206647 863368419 698454594 493329254 447863540 966133393 661280054 192168413 110496781 816414830 752820845 689225446 10031001 836748911 93606214 989196553 815931451 660208021 ...
output:
55
result:
ok 1 number(s): "55"
Test #55:
score: 0
Accepted
time: 9ms
memory: 4696kb
input:
12345 303011117 139503474 308259561 393400222 558757833 318277157 734351774 176874091 559472420 340177230 734346801 726517831 458626959 96838234 357128998 134535078 135154194 908553691 16252190 155119813 191816693 810873167 877730785 846574075 875528798 820413287 869103708 913496501 515484668 557356...
output:
39
result:
ok 1 number(s): "39"
Test #56:
score: 0
Accepted
time: 56ms
memory: 10144kb
input:
99999 562508132 5 7 8 10 4 3 3 1 2 2 4 9 4 9 3 5 3 2 10 5 5 8 7 4 6 7 2 10 1 1 3 6 6 2 2 1 8 5 9 9 8 1 4 7 7 10 8 8 7 3 3 8 10 4 10 9 6 5 4 9 4 8 8 10 1 6 10 2 5 3 9 9 5 6 3 7 1 10 2 1 7 10 4 8 8 4 10 7 1 9 6 5 10 7 9 7 9 6 8 9 9 4 1 1 5 2 6 10 1 3 10 6 6 2 8 6 6 1 10 10 8 10 7 1 5 8 1 2 7 6 6 9 3 6...
output:
1500
result:
ok 1 number(s): "1500"
Test #57:
score: 0
Accepted
time: 47ms
memory: 10188kb
input:
99999 561383932 1 3 2 8 2 9 5 1 5 1 6 5 3 7 2 6 10 3 5 3 4 4 4 2 3 3 2 10 4 10 4 1 4 6 6 2 8 3 9 6 10 10 4 2 4 1 3 3 1 4 9 10 2 9 5 2 2 10 5 5 5 4 5 6 7 3 9 1 6 3 6 2 9 1 10 10 10 6 8 2 10 9 8 1 8 5 2 6 1 5 5 8 1 7 1 6 6 10 1 6 4 2 5 1 9 5 10 8 4 2 5 5 5 1 2 8 7 9 1 1 10 9 2 6 8 1 10 2 3 10 3 3 3 1 ...
output:
1500
result:
ok 1 number(s): "1500"
Test #58:
score: 0
Accepted
time: 52ms
memory: 10044kb
input:
100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
output:
1
result:
ok 1 number(s): "1"
Test #59:
score: 0
Accepted
time: 55ms
memory: 10172kb
input:
100000 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10000000...
output:
0
result:
ok 1 number(s): "0"
Test #60:
score: 0
Accepted
time: 51ms
memory: 10056kb
input:
100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
output:
1
result:
ok 1 number(s): "1"
Test #61:
score: 0
Accepted
time: 57ms
memory: 10004kb
input:
100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
output:
2
result:
ok 1 number(s): "2"
Test #62:
score: 0
Accepted
time: 48ms
memory: 10152kb
input:
100000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000...
output:
10
result:
ok 1 number(s): "10"