QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#770326 | #4878. Easy Problem | I_be_wanna | AC ✓ | 278ms | 34040kb | C++20 | 8.3kb | 2024-11-21 21:27:53 | 2024-11-21 21:27:53 |
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 T,n,m;
int a[100005];
ll b[100005];
int _l[100005],_r[100005],_w[100005];
vector <int> occ[2][100005];
#define ls (rt * 2)
#define rs (rt * 2 + 1)
namespace SEG1{//单点加,前缀 min
struct node{
ll sum,ans;
}tree[400005];
void pushup(int rt){
tree[rt].sum = tree[ls].sum + tree[rs].sum;
tree[rt].ans = min(tree[ls].ans,tree[ls].sum + tree[rs].ans);
}
void build(int rt,int l,int r){
tree[rt].sum = tree[rt].ans = 0;
if(l == r) return;
int mid = (l + r) >> 1;
build(ls,l,mid);build(rs,mid+1,r);
}
void modify(int rt,int l,int r,int pos,int C){
if(l == r){
tree[rt].sum += C;
tree[rt].ans = min(tree[rt].sum,0ll);
return;
}
int mid = (l + r) >> 1;
if(pos <= mid) modify(ls,l,mid,pos,C);
else modify(rs,mid+1,r,pos,C);
pushup(rt);
}
}
namespace SEG2{//后缀加,全局定位最小值(left most)
struct node{
ll tag,Mn;
}tree[400005];
void pushup(int rt){
tree[rt].Mn = min(tree[ls].Mn,tree[rs].Mn) + tree[rt].tag;
}
void upd(int rt,ll C){
tree[rt].tag += C;
tree[rt].Mn += C;
}
void build(int rt,int l,int r){
tree[rt].tag = 0;
if(l == r){
tree[rt].Mn = b[l];
return;
}
int mid = (l + r) >> 1;
build(ls,l,mid);build(rs,mid+1,r);
pushup(rt);
}
void upload(int rt,int l,int r,int L,int R,ll C){
// if(l == 1 && r == n) printf("upload [%d,%d] %lld\n",L,R,C);
if(l == L && r == R){
upd(rt,C);
return;
}
int mid = (l + r) >> 1;
if(R <= mid){
upload(ls,l,mid,L,R,C);
}else if(L > mid){
upload(rs,mid+1,r,L,R,C);
}else{
upload(ls,l,mid,L,mid,C);
upload(rs,mid+1,r,mid+1,R,C);
}
pushup(rt);
}
ll query(int rt,int l,int r,int L,int R,ll tot){
if(L > R) return linf;
if(l == L && r == R) return tree[rt].Mn + tot;
int mid = (l + r) >> 1;
tot += tree[rt].tag;
if(R <= mid) return query(ls,l,mid,L,R,tot);
else if(L > mid) return query(rs,mid+1,r,L,R,tot);
else return min(query(ls,l,mid,L,mid,tot),query(rs,mid+1,r,mid+1,R,tot));
}
pair<int,ll> fnd(int rt,int l,int r,ll tot){
if(l == r) return mkp(l,tree[rt].Mn + tot);
int mid = (l + r) >> 1;
tot += tree[rt].tag;
if(tree[ls].Mn <= tree[rs].Mn) return fnd(ls,l,mid,tot);
return fnd(rs,mid+1,r,tot);
}
inline int chk(){
return tree[1].Mn >= 0;
}
void prt(int rt,int l,int r){
printf("node %d [%d,%d] Mn %lld tag %lld\n",rt,l,r,tree[rt].Mn,tree[rt].tag);
}
void travel(int rt,int l,int r){
if(l == r){
prt(rt,l,r);
return;
}
int mid = (l + r) >> 1;
travel(ls,l,mid);travel(rs,mid+1,r);
prt(rt,l,r);
}
}
int rk[200005],idx[200005],lim[200005];
namespace SEG3{
int c[200005];
pii tree[800005];
void build(int rt,int l,int r){
tree[rt] = mkp(n + 1,0);
if(l == r){
c[l] = 0;
return;
}
int mid = (l + r) >> 1;
build(ls,l,mid);build(rs,mid+1,r);
}
void pushup(int rt){
tree[rt] = min(tree[ls],tree[rs]);
}
void modify(int rt,int l,int r,int pos,int C){
if(l == r){
c[pos] += C;
if(c[pos] > 0) tree[rt] = mkp(_l[idx[l]],l);
else tree[rt] = mkp(n + 1,0);
return;
}
int mid = (l + r) >> 1;
if(pos <= mid) modify(ls,l,mid,pos,C);
else modify(rs,mid+1,r,pos,C);
pushup(rt);
}
pii query(int rt,int l,int r,int L,int R){
if(l == L && r == R) return tree[rt];
int mid = (l + r) >> 1;
if(R <= mid) return query(ls,l,mid,L,R);
else if(L > mid) return query(rs,mid+1,r,L,R);
else return min(query(ls,l,mid,L,mid),query(rs,mid+1,r,mid+1,R));
}
}
ll answer;
void maintain(){
// printf("travel.\n");
// SEG2::travel(1,1,n);
while(!SEG2::chk()){
pair<int,ll> temp = SEG2::fnd(1,1,n,0);
int pos = temp.first;
// printf("pos=%d val=%lld\n",pos,temp.second);
int _id = SEG3::query(1,1,m,1,lim[pos]).second,id = idx[_id];//注意 id 是在 seg3 的位置
int up = (int)min((ll)SEG3::c[_id],min(0ll,SEG2::query(1,1,n,1,_r[id] - 1,0)) - temp.second);
SEG3::modify(1,1,m,_id,-up);
SEG2::upload(1,1,n,_r[id],n,up);
SEG1::modify(1,1,n,_l[id],up);
// printf("discard %d %d current %d\n",id,up,SEG3::c[_id]);
answer -= up;
}
// printf("fin\n");
}
void force(int pos,int C){//给 [pos,n] 的 limit 全部加 C
SEG2::upload(1,1,n,pos,n,-C);
}
void solve(int testid){
scanf("%d%d",&n,&m);
// if(testid == 4) cerr << n << " " << m << endl;
rep(i,1,n){
scanf("%d",&a[i]);
occ[0][i].clear();occ[1][i].clear();
b[i] = b[i - 1] + a[i];
// if(testid == 4) cerr << a[i] << " ";
}
// if(testid == 4) cerr << endl;
rep(i,1,m){
scanf("%d%d%d",&_l[i],&_r[i],&_w[i]);
occ[0][_l[i]].eb(i);occ[1][_r[i]].eb(i);
// if(testid == 4) cerr << _l[i] << " " << _r[i] << " " << _w[i] << endl;
}
int _cur = 0;
rep(i,1,n){
for(int id:occ[1][i]){
idx[++_cur] = id;
rk[id] = _cur;
}
lim[i] = _cur;
}
answer = 0;
SEG1::build(1,1,n);SEG2::build(1,1,n);SEG3::build(1,1,m);
rep(i,1,n){
if(i > 1){
force(i - 1,a[i - 1]);
maintain();
answer += a[i - 1];
SEG1::modify(1,1,n,i - 1,-a[i - 1]);
for(int id:occ[1][i - 1]) SEG1::modify(1,1,n,_l[id],-_w[id]);
}
for(int id:occ[0][i]){
SEG3::modify(1,1,m,rk[id],_w[id]);
force(_r[id],_w[id]);
answer += _w[id];
}
maintain();
printf("%lld ",answer + SEG1::tree[1].ans);
}
printf("\n");
}
int main(){
// freopen("test.in","r",stdin);
// freopen("test.out","w",stdout);
scanf("%d",&T);
rep(i,1,T) solve(i);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 11940kb
input:
1 4 3 3 3 2 2 1 2 2 3 3 3 2 2 4
output:
2 5 2 0
result:
ok 4 number(s): "2 5 2 0"
Test #2:
score: 0
Accepted
time: 3ms
memory: 9900kb
input:
200 10 10 441129649 175970039 478629746 150210377 473385687 400931249 155714650 270352812 293555449 444876725 1 1 114317839 1 1 158354349 1 4 13054554 1 3 562005243 1 3 114310710 1 1 481426141 1 2 150800722 1 1 224503966 2 3 106234607 1 2 6235654 10 10 216212720 595995796 317909277 459839404 7779474...
output:
1108783988 952641490 795605114 13054554 0 0 0 0 0 0 608974640 444907672 198220395 146074643 98876749 98876749 0 0 0 0 705855899 1806578664 1806578664 1087055465 1097923412 658626033 0 0 0 0 1317049808 1333896443 1333896443 1130264137 705133476 705133476 244998554 244998554 244998554 0 650384552 ...
result:
ok 2000 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 14180kb
input:
70 28 28 299340757 599163086 479724314 553373673 145370014 449023488 239828280 464547162 564617481 386788885 538072218 336574202 509700840 260000237 268218492 205809003 488992076 71498927 295908965 44608221 292458381 266918504 40046299 405753946 167337570 198865640 496122952 543209246 5 9 391702331 ...
output:
1235779916 1768292605 2109280695 2359711223 2405196868 2123670563 1768854560 1380797414 1238518374 278712450 278712450 278712450 231436975 196429714 196429714 196429714 0 0 0 0 0 0 0 0 0 0 0 0 2302336351 2675990660 3187926354 3192222346 3364716631 2662585211 2408759307 2211771249 1696281402 9760642...
result:
ok 1960 numbers
Test #4:
score: 0
Accepted
time: 0ms
memory: 12116kb
input:
10 200 200 299033703 19649886 450325950 482223075 248052091 395331620 572513571 267142029 218785235 34042552 290536701 299995691 293820663 43235625 560205909 130244099 454253406 151897732 185348562 330028326 451777736 580255995 446945889 481094104 428101716 350315144 51275596 479535003 298489189 360...
output:
2154894760 4199376091 5796781394 6737814223 8420742145 8914942062 10381605876 10520258167 10892708803 12006419441 11977947406 12529541411 13183556633 13218927651 13183507867 13287383363 12980564168 12972527881 12847282036 14133445977 14969437777 15457763699 15547495412 14417815800 13792861110 139988...
result:
ok 2000 numbers
Test #5:
score: 0
Accepted
time: 4ms
memory: 10140kb
input:
10 200 200 595356907 443448658 460461205 450742489 519384409 307395926 165352831 339038683 427285121 426550807 509134731 379144832 570498910 333295057 174436429 506785283 385756684 320737549 495579424 454968196 418665180 481240461 369995678 514644016 535052542 418582649 281534233 248733994 390402184...
output:
1225078551 2997561317 3899585942 5204205468 6383949036 7229364885 8066807243 8306523436 8570996997 9525764487 10977828851 12142506978 12869530266 13737037591 14810936387 15104498076 15666580157 15508122964 14633651671 14519418762 14611216840 15218444516 16202857784 15238271521 15694077349 1583991999...
result:
ok 2000 numbers
Test #6:
score: 0
Accepted
time: 4ms
memory: 14148kb
input:
10 200 200 24460166 28276704 270150308 175177963 13861942 310904352 210747485 265173556 408994772 124097238 115367001 176436386 75904658 43096507 101591862 504938289 397312266 284971444 84810208 107312069 170434853 53667321 31695817 30332703 136185925 2398490 11478728 274487327 147259442 71604184 24...
output:
1725076274 2659549622 4067804646 5163190804 6363193694 8085344355 8853204563 9097037689 9741400351 10160594403 10347739813 10586325097 10586325097 11663449216 11673324990 12185298414 12269774191 12447842154 12651295393 12801274970 12801274970 13283817756 13374032325 13402831907 13402831907 138362208...
result:
ok 2000 numbers
Test #7:
score: 0
Accepted
time: 0ms
memory: 16416kb
input:
1 2000 2000 6011813 213667239 5945093 187762583 475936831 378905220 594349904 310225141 122190242 250514358 8077992 181412851 9134031 104423717 419143617 359383615 252871346 30732778 530106662 513365192 404086553 104790142 451175600 136377140 365671895 56813665 408910185 460180739 505332700 54193785...
output:
0 198302601 1396865691 1396865691 3866836916 4940266045 5703536894 8292460995 9148924995 9148924995 9993902266 10589664957 12134255786 12793971332 14588157637 14588157637 14868468696 15801388733 15801388733 16509502608 17270770212 19815061171 20406537838 22787012398 24025044403 24418063581 260749419...
result:
ok 2000 numbers
Test #8:
score: 0
Accepted
time: 5ms
memory: 14296kb
input:
1 2000 2000 521880962 294784943 365054800 249877928 499212134 276197310 82025423 521704635 502274770 411642519 311172388 531811368 527063495 553917636 586816271 426459688 372121339 367403853 524341391 131352450 224845142 524007556 565844126 572270621 456011844 543259208 470298448 359047314 434374481...
output:
1383775592 1660566118 1730389461 2026158347 2026158347 2753021547 4330043563 4555272127 5618205776 6103191022 8595294909 10413259789 11979985387 13671799664 13671799664 15324437557 16073915414 17759600991 18833176752 19176727890 19788399698 20455817699 22350761278 22529178144 22716007741 22716007741...
result:
ok 2000 numbers
Test #9:
score: 0
Accepted
time: 4ms
memory: 10228kb
input:
1 2000 2000 18634946 52785279 402945189 138307314 113704536 37220654 156925339 387830130 243020825 268445959 21799841 62981286 196421544 168481865 33597043 82626878 305083234 170517752 188385119 165849450 19608800 5442345 3136958 149535267 192346946 308098527 60797882 288231427 142803931 53105148 53...
output:
0 532821839 2347383679 3046288880 3951046405 4577795382 6482460009 7947438687 10060455651 11699414809 11725858043 12686163376 13247331064 13982598283 13982598283 14329333504 14383018497 16697648774 16994424178 19432636555 21330380091 21523192456 21523192456 22049315733 22139799556 24275611044 261158...
result:
ok 2000 numbers
Test #10:
score: 0
Accepted
time: 0ms
memory: 12076kb
input:
30 375 9 0 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 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8 8 8 8 8 8 7 7 7 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6...
output:
0 0 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 353 353 353 353 353 404 404 404 404 404 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 649 6...
result:
ok 2000 numbers
Test #11:
score: 0
Accepted
time: 0ms
memory: 14328kb
input:
1 2000 2000 6 478 1306 1550 1550 1550 1580 1876 1884 2054 2153 2223 2223 2223 2586 2586 2683 2734 2787 2963 3181 3181 4885 4885 5845 5896 6027 6066 6176 6194 6908 7030 7139 7139 7481 7481 7535 7703 7903 8064 8228 8228 8268 8268 8600 8874 8933 9143 9264 9861 10742 10844 11104 11331 11296 11567 11572 ...
output:
9792 80592 240126 378290 378290 378290 409400 536910 550166 683310 765876 890644 890644 890644 1085400 1085400 1143618 1193255 1241273 1339845 1455010 1455010 1676001 1676001 1999961 2001440 2159672 2215247 2341244 2368226 2541667 2663289 2759581 2759581 2843371 2843371 2867023 3029519 3165409 32934...
result:
ok 2000 numbers
Test #12:
score: 0
Accepted
time: 64ms
memory: 19100kb
input:
1 10000 100000 714519107 799719102 916051247 923586147 422922467 98830600 224703891 610642423 867543035 537626660 462820463 479024255 655189743 333344477 817015323 805979230 469528780 511535367 437324861 991375160 279679855 63153966 451122455 402336301 524145481 701167815 957731659 561663697 2043956...
output:
58795407 471145715 589084080 214338354 422922467 98830600 224703891 228691744 153486531 431918585 462820463 276713889 460253900 333344477 270222830 139137476 380884111 189624829 357795644 256933901 279679855 63153966 242024972 387716113 174353951 188737738 220852549 245120315 18112695 11994560 41258...
result:
ok 10000 numbers
Test #13:
score: 0
Accepted
time: 41ms
memory: 27068kb
input:
1 100000 10000 32281288 76162132 63460927 61862522 37540562 63519118 12854491 1455925 33568013 54711131 75051144 84777256 43526071 39243086 90634603 40896029 28407494 47525219 25058218 40588201 20866688 56354351 73098061 42368619 39787049 1375657 95787074 39896534 78640526 16984443 37204454 59787872...
output:
0 0 0 61862522 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 31127914 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 53225789 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 42312841 0 0 0 0 0 0 0 87205800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 100000 numbers
Test #14:
score: 0
Accepted
time: 98ms
memory: 24344kb
input:
1 50000 100000 40075029 399923805 154909733 311529291 986184082 260498470 85706595 817678104 669812179 732364965 657954394 212392168 247919651 477264595 993180829 211320953 211531762 30077883 262054423 515475404 941105732 791707623 659257380 682318045 587452109 726636321 647207213 954866229 10145486...
output:
0 0 0 90810481 176632489 146497844 85706595 476711203 669812179 129994135 0 212392168 92845366 293981596 402786427 130464539 153477390 30077883 262054423 0 0 421677129 32767451 555229739 333748555 277750853 133912922 0 101454869 0 132695433 442768949 29793860 940001176 605614716 0 158353551 28704569...
result:
ok 50000 numbers
Test #15:
score: 0
Accepted
time: 79ms
memory: 31944kb
input:
1 100000 50000 275914683 372143079 486177507 202282438 404939171 171643545 327665229 460792743 59123935 54915834 161393278 172720400 359304037 54960485 226429181 263443850 426026210 179710738 494602720 185275945 54234600 296567908 317018179 318534125 45128771 143378639 214329589 430563771 163996777 ...
output:
0 372143079 0 0 0 73694563 0 460792743 0 0 161393278 0 0 0 226429181 0 0 0 0 18469271 0 0 243071953 0 0 0 0 170931561 163996777 0 0 345339379 0 0 0 0 0 0 0 0 0 0 352049555 0 0 0 0 0 0 0 0 0 105420347 0 0 0 44265132 0 64312646 265471415 67367939 0 126537341 0 0 116356090 0 16345715 0 0 72921827 0 0 0...
result:
ok 100000 numbers
Test #16:
score: 0
Accepted
time: 134ms
memory: 34028kb
input:
1 100000 100000 293727516 693397419 775051166 221634773 569638579 159394026 684514659 428450658 267030802 448480514 44775662 175450239 861889305 953624653 187009187 481006929 992075813 375363780 605618847 29576424 935092127 228999385 61456266 543613759 257261226 867260677 367785764 797958133 1116953...
output:
0 446464533 0 0 0 159394026 684514659 428450658 267030802 195285457 0 85947176 0 0 0 414375536 0 0 134469201 29576424 0 0 61456266 298167654 219065359 0 0 0 0 504340478 955682044 0 173462136 0 0 0 0 371186236 0 601144467 6404074 722312158 0 132172205 0 0 946175254 85836004 68671579 0 0 0 486457607 0...
result:
ok 100000 numbers
Test #17:
score: 0
Accepted
time: 139ms
memory: 33892kb
input:
1 100000 100000 756857911 956679627 548596255 931856053 574066653 734399420 926256465 539118889 687144625 598882223 951290389 881815590 369376761 528375992 769874335 653124910 556992477 998387743 745056737 864938046 379211958 221811301 756171064 489349640 769081226 994112725 834742825 651905774 8419...
output:
0 820539797 548596255 0 0 734399420 0 539118889 0 0 0 0 369376761 528375992 0 653124910 0 0 0 0 379211958 221811301 756171064 0 0 0 0 0 0 0 0 0 0 0 564332063 0 417314047 0 0 0 418817802 730235380 663524503 0 0 0 0 672749286 768423033 456856594 932581827 0 557856131 0 0 0 850456820 924438047 62478430...
result:
ok 100000 numbers
Test #18:
score: 0
Accepted
time: 136ms
memory: 32976kb
input:
1 100000 100000 145481527 772723409 44608742 139723763 124485266 181068283 161630296 136693788 196496734 117013418 665296836 14963760 130830078 1425155 171556706 140668098 270712901 15100628 366877827 71509562 244765227 384418000 354856726 164266268 31075521 76342651 168582117 734783300 538285905 37...
output:
0 0 0 139723763 124485266 0 0 0 0 117013418 0 0 32839561 0 0 140668098 233864047 0 335195816 63256835 0 353271631 0 0 31075521 0 0 0 274554301 0 0 0 94926512 277749062 72725355 414552356 0 144442565 0 0 0 0 0 6740681 138843917 0 0 0 193757352 16246593 0 0 27886814 0 474462044 0 0 33141301 0 0 571058...
result:
ok 100000 numbers
Test #19:
score: 0
Accepted
time: 56ms
memory: 10096kb
input:
10000 10 10 536785865 481619473 346311866 221662060 294631975 485928438 259687162 492716804 334315908 545689941 1 1 82196873 2 3 136708220 1 4 44070165 1 5 12863315 1 1 154728467 1 7 261618608 1 3 107081089 2 3 69381435 1 1 64244047 1 3 3744229 10 10 11523944 300010270 534053105 33242833 67729533 23...
output:
730546793 635467061 635467061 318552088 274481923 261618608 261618608 0 0 0 1181800752 1181800752 1117143222 496420407 496420407 425105813 0 0 0 0 998966257 1180546983 1180546983 803829660 270435291 270435291 0 0 0 0 1106778867 1248639258 1349261244 1131368142 255003885 255003885 154381899 141860...
result:
ok 100000 numbers
Test #20:
score: 0
Accepted
time: 89ms
memory: 10116kb
input:
1000 100 100 445901953 249835056 62708363 326596322 52103166 381188656 35624279 520737086 117915786 231779844 6447281 111601006 492825141 239411443 190726873 170567893 28137386 36285369 21310860 26027240 583334108 398525253 7612266 233906869 360149543 31604113 211825409 14260011 124192649 350849499 ...
output:
1434663998 2604985868 3002476476 4350691600 4706685482 5071072994 5149939370 5418696259 5477718850 5594020095 4884496759 4190108105 3822533513 4089522656 4167744192 4253961864 4213618206 4373867503 4518242014 4589091671 4090920595 3544073176 3576546197 3324210902 3214401396 3203283325 3108479303 262...
result:
ok 100000 numbers
Test #21:
score: 0
Accepted
time: 113ms
memory: 14304kb
input:
100 1000 1000 158951144 193475085 489139647 515126273 176375516 173604660 45751332 176850814 493831812 304147961 201651315 259703053 490378968 94463287 512658536 72085138 394118400 407393680 462963785 419301505 528134418 189224664 495618726 482711954 338714146 419186669 290504359 134566236 6610675 2...
output:
1764591660 3610269771 6280552571 7327219362 9335922996 11636459174 12896811402 14539469792 16712006913 18073603314 19331954869 19738225721 20854415893 22412461736 23591305344 26601008655 28885253275 30499154201 31690426416 33376142853 35965357433 36842646359 38511662424 39469471984 40117984680 40152...
result:
ok 100000 numbers
Test #22:
score: 0
Accepted
time: 145ms
memory: 15736kb
input:
10 10000 10000 406533377 12792208 102591174 594073909 483211438 208339863 297877010 316512135 534223185 337910514 96560306 64235345 86378768 360457783 510670579 394115381 436553930 556606289 175484839 489815669 382710981 274653023 113529054 224039915 324693847 9600692 143640803 585498380 421704745 5...
output:
2127135521 3543710377 5619314173 7626079758 9015618253 10256903393 12182770586 14470154954 16360350443 17514103818 19565758133 20271695669 22354085205 25099689902 27268092546 28935987044 29751662653 31931816867 33851180653 34425486478 36034181744 36688020162 37234227010 40085566265 42563843496 44502...
result:
ok 100000 numbers
Test #23:
score: 0
Accepted
time: 135ms
memory: 13764kb
input:
10 10000 10000 440943804 491923546 233657562 431227167 549613575 274539436 192217644 434175422 359609278 434991075 535339389 300859589 400778605 465025812 376613130 552010244 420925435 423386043 389370919 280682347 180646894 233605930 547441623 434074135 536068031 282312371 267525836 125091347 49361...
output:
1330826647 3645339787 5621908126 6693080794 8937917410 11765408640 12712866780 13598790764 15269488254 16065182732 16848813029 18343381523 19484772973 21346350799 23603673810 25357213074 27093212345 29993235151 30344045388 31233945516 33489505335 35317010667 36418932259 37716995259 40300257238 42822...
result:
ok 100000 numbers
Test #24:
score: 0
Accepted
time: 150ms
memory: 15700kb
input:
10 10000 10000 52198770 11470245 40564990 14841554 265067310 185580400 81271414 189511436 325668463 504068621 85761970 195850292 96848848 308591924 90864521 91649324 455211515 33056067 132049055 7857081 29403113 116594916 73741258 374753639 183388476 199612518 107154575 130407730 273094221 126947758...
output:
1007765774 3696419237 6703600819 8802914725 10867699681 13378244455 14842975827 16183587063 19129238495 21386098409 23116006924 24013397663 25425636712 26729329513 27184568611 29044916137 30220912435 31522237468 33845159311 35296464343 36556617164 38259339383 40693221172 42210687166 43029167802 4478...
result:
ok 100000 numbers
Test #25:
score: 0
Accepted
time: 113ms
memory: 20980kb
input:
1 10000 100000 714519107 799719102 916051247 923586147 422922467 98830600 224703891 610642423 867543035 537626660 462820463 479024255 655189743 333344477 817015323 805979230 469528780 511535367 437324861 991375160 279679855 63153966 451122455 402336301 524145481 701167815 957731659 561663697 2043956...
output:
1449413584 2722566348 6233807281 8642095539 10273215403 11841818474 13159576424 15060944338 17516262566 19319351070 20706380459 22763941038 24675400429 26056033742 27901460615 29891463430 31567774990 33622420302 34967804617 36855004127 39167523039 41267833486 43599290653 44876750241 46270303766 4790...
result:
ok 10000 numbers
Test #26:
score: 0
Accepted
time: 76ms
memory: 26876kb
input:
1 100000 10000 52281288 36162132 3460927 21862522 17540562 23519118 12854491 21455925 53568013 54711131 15051144 24777256 43526071 59243086 30634603 20896029 48407494 7525219 45058218 588201 866688 36354351 33098061 22368619 39787049 41375657 55787074 59896534 38640526 16984443 57204454 39787872 523...
output:
0 0 0 867760444 867760444 867760444 867760444 867760444 867760444 867760444 1378995422 1378995422 1378995422 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 2109161855 4317647250 4317647250 4317647250 4317647250 4317...
result:
ok 100000 numbers
Test #27:
score: 0
Accepted
time: 190ms
memory: 24008kb
input:
1 50000 100000 40075029 399923805 154909733 311529291 986184082 260498470 85706595 817678104 669812179 732364965 657954394 212392168 247919651 477264595 993180829 211320953 211531762 30077883 262054423 515475404 941105732 791707623 659257380 682318045 587452109 726636321 647207213 954866229 10145486...
output:
1345821581 2666603535 5624980496 5624980496 6534247115 7108573919 7946488980 9290292510 9886913970 11278562971 11278562971 12543357081 15343756977 16736773807 18219017684 19791415770 19826603430 23358738216 25977869400 26473248216 27277042830 27654631933 29871016071 31153058514 32282911101 339164518...
result:
ok 50000 numbers
Test #28:
score: 0
Accepted
time: 152ms
memory: 31788kb
input:
1 100000 50000 275914683 172143079 86177507 202282438 4939171 271643545 27665229 160792743 159123935 254915834 161393278 72720400 59304037 254960485 126429181 263443850 126026210 279710738 194602720 185275945 54234600 296567908 117018179 118534125 45128771 143378639 114329589 130563771 63996777 2400...
output:
261712004 1642399143 1642399143 1642399143 1642399143 4213084913 4301864337 5148636166 5148636166 5928096668 6250350554 6250350554 6250350554 8255171026 8255171026 8255171026 8255171026 8484069005 8484069005 8484069005 8484069005 9184280509 9772198840 10341872837 10416310958 12712727806 14078265867 ...
result:
ok 100000 numbers
Test #29:
score: 0
Accepted
time: 87ms
memory: 14136kb
input:
1000 100 100 399730728 511833454 9187816 78396349 558924211 284135709 199395863 581163515 513367160 211360669 591398415 279827571 97283641 338599113 31713796 248025197 425797505 476003763 370554857 106498883 559831843 288689555 473351144 563756541 384831459 295459187 162156391 393382542 363865113 42...
output:
1289945528 2745994743 2940572141 4144618105 4340841668 4589647452 5959360812 6720688217 7812893255 7938311242 7998602330 7788082098 7339973035 7665580539 6987035344 6577369684 6758524037 6542020739 5570718368 5077647001 4930992425 4992864609 5064169109 4455983409 4359363439 4233284183 4656280567 442...
result:
ok 100000 numbers
Test #30:
score: 0
Accepted
time: 157ms
memory: 25240kb
input:
1 50000 100000 234300905 860908548 223636996 904570899 712352745 367938003 183835316 755940911 285276670 832165557 127631923 894446148 70588450 199622444 810447672 814522385 915506588 827865040 318526957 829891808 365271542 576349638 175928953 476566092 193366934 724823083 442372900 14397948 1175765...
output:
1806364233 4257145244 7768740424 9409529051 10419253281 12165716968 14657177212 17828661798 20782356888 24857584123 26410689430 26941135043 29437338020 32673947871 33679292094 34230957538 35327503233 35727919670 38072076018 38836514505 41142437442 43032722208 44149192037 48513166911 48638313093 4986...
result:
ok 50000 numbers
Test #31:
score: 0
Accepted
time: 137ms
memory: 27832kb
input:
1 100000 50000 175746736 246012203 5181660 266820554 59264615 174978836 132999903 226203931 99981927 344534 44673112 217667670 9347647 255084619 188274580 173799130 278317314 83791569 6220225 65764718 74402090 62444821 93544533 72285275 119643401 245627655 18056735 261108660 229806568 60133357 74081...
output:
0 389349386 553966233 2011439453 2011439453 3118253263 3475208004 4313884447 4313884447 4313884447 5090416446 5090416446 6159108613 7111499285 7319092919 7319092919 8147150664 8147150664 8147150664 8147150664 8711865382 10652924623 11466797255 13007777788 13137491014 13480926900 13480926900 13480926...
result:
ok 100000 numbers
Test #32:
score: 0
Accepted
time: 214ms
memory: 32132kb
input:
1 100000 100000 492093234 458800465 238875815 527927168 234424008 60195374 497252916 554962646 584914337 342146205 407755505 560731894 288093136 331748038 94644810 584026690 249151862 302461624 72852903 259701785 301914331 35555830 317429242 465621679 2104880 264270513 464606275 419229049 172511747 ...
output:
1586290154 5080116482 5140964594 7095539863 10722872318 11444824082 13815029511 14368832821 15455366389 16968950272 17438819247 18452115306 18783971995 19613638662 20528054474 21380909567 22804320083 23725791711 24196595639 25042844324 25969428407 27574741560 28362109335 28497675808 28497675808 3177...
result:
ok 100000 numbers
Test #33:
score: 0
Accepted
time: 190ms
memory: 33268kb
input:
1 100000 100000 438865785 524907299 597794489 546783457 568507778 518576405 498096612 370358487 557695303 353605417 525580457 592888965 534838098 422069983 346674887 494204265 584584147 507885931 512694185 554958275 530492654 569772806 508982079 460393845 575824593 457549985 581207623 547463040 5672...
output:
1344650412 1834518005 2395758463 3845890050 3845890050 4048914158 4625732242 4660872452 6495289423 8267024947 10130625664 11843903726 13679281882 14644051142 15882893131 15882893131 16501119385 17523890320 18416953192 18814635751 19743549064 20540678254 22847281253 24215214727 24624174036 2511885452...
result:
ok 100000 numbers
Test #34:
score: 0
Accepted
time: 220ms
memory: 32452kb
input:
1 100000 100000 227955678 30149966 20957444 18181522 121273835 179871170 21401496 146196191 156154376 51711954 4199066 97619275 20861992 25717812 206870885 1690109 22253001 234388120 26125302 78861145 134907368 28380162 49653000 49179824 76533531 104175881 132914075 1910703 127843153 31112407 139194...
output:
3072806270 4080775955 4469907521 5194590271 6180578910 8369858642 9837216781 10604803124 11292675528 13135127463 13355089268 13993109702 14746343403 16010493291 18304277625 21281536975 22113424164 22968680834 22968680834 22968680834 24460299963 25899408144 25899408144 27539005027 29396901977 3009340...
result:
ok 100000 numbers
Test #35:
score: 0
Accepted
time: 255ms
memory: 33340kb
input:
1 100000 100000 93727516 93397419 175051166 21634773 369638579 159394026 484514659 428450658 267030802 248480514 44775662 575450239 353624653 187009187 281006929 375363780 5618847 29576424 335092127 228999385 461456266 343613759 57261226 367785764 597958133 511695351 27484787 355682044 194927597 688...
output:
994527344 1365578173 2549368708 3187501478 4129591831 4378490202 6762229085 7284721771 10365264079 10365264079 10486304205 11102523295 11611391117 12549884675 13333555251 14680069156 15143732767 17179483964 17990783314 20094189751 20823268074 20927416030 21912301744 22671508453 24154874743 270831108...
result:
ok 100000 numbers
Test #36:
score: 0
Accepted
time: 236ms
memory: 33344kb
input:
1 100000 100000 566794425 592428025 538857767 518154076 584881154 540598556 448473923 427487296 527272162 447902454 507734238 574793916 518730132 573389160 533465787 587614809 596466045 498002964 598280211 462540933 348159250 581320591 562635444 540506436 546644527 387095596 278196503 506730630 5023...
output:
817143983 4489928049 4489928049 5532266688 9705613987 10045889670 12383421034 13061326499 14525679072 15876808426 16385381489 17417636527 19395332853 20028005469 20028005469 20735327636 22419926680 23752162448 25593621001 27464456136 29559959329 30930990776 32444165991 34075976525 35817982061 368476...
result:
ok 100000 numbers
Test #37:
score: 0
Accepted
time: 274ms
memory: 34040kb
input:
1 100000 100000 73475231 135727261 7914217 204894014 118375700 42683161 6333882 96879119 35274399 26801932 8208021 160513535 71069560 4381638 59841246 152779765 33262985 44918223 13589295 16683665 15216162 123981747 96583466 18841560 2892052 112516412 37423665 76243230 110243924 80555898 19413540 58...
output:
1271302756 2196222368 3707285754 5059185450 5439509542 8266109126 9247805246 12124274070 12124274070 12827164458 13528146441 15025873648 15369232251 16799197797 17394419674 18532495188 19618283234 20669442179 20669442179 22358052981 24465269682 25450548215 28867348886 29784773552 32542139264 3412351...
result:
ok 100000 numbers
Test #38:
score: 0
Accepted
time: 267ms
memory: 33964kb
input:
1 100000 100000 96854762 16486280 89223307 232803653 21232061 30050845 65810770 20361034 20427279 2844815 15604052 32341375 21914614 109072689 66572310 10980914 44040758 17758954 33500194 42529180 59725740 97584423 7176100 175848277 65418913 70574554 13860397 56875044 42102769 42731546 59725631 6374...
output:
1754734712 4249360422 4249360422 6208244849 7366258161 9234713990 9792385854 11284775462 12967541070 13737117433 15123421862 15174458311 15875412988 16600368998 17254557652 18729061910 18729061910 19314437560 20578738925 21385411084 22737004196 23514240297 24887354081 26743830481 27189918846 2767876...
result:
ok 100000 numbers
Test #39:
score: 0
Accepted
time: 278ms
memory: 33168kb
input:
1 100000 100000 3655833 29762975 2384045 56105035 26451301 51224660 5458007 37992742 109497717 22476692 109299418 23349613 26027899 42160100 617039 56075800 16763295 32025219 34195328 10326163 67994945 35606196 28064747 1840381 22779184 5181373 93542560 37517705 9343027 19039968 47217207 21057391 26...
output:
1375006887 4461190287 5194786680 6812641014 8046978358 8433440513 9755184410 11878571483 12826611503 14975957355 14975957355 17037208374 17694685582 17694685582 17937713103 19827184256 20711302392 20997902517 22122972047 22696411927 23200647816 24180369119 24855039854 25900001829 26719548755 2764898...
result:
ok 100000 numbers
Test #40:
score: 0
Accepted
time: 275ms
memory: 30756kb
input:
1 100000 100000 148544 3162627 4262660 8782352 11318864 1479312 32529880 3809132 20602708 19334771 31784642 3469732 3158942 6520122 207087 4524159 9023114 13199678 1309499 3030758 21758484 24574274 15676343 25527325 33159374 12026324 7813799 1704550 12981106 1245718 16441352 17769362 27464180 144109...
output:
1515198222 1515198222 3151566178 3151566178 3151566178 3151566178 3838671578 5350674157 6226870632 6226870632 7926856075 9195487449 10317946786 10317946786 11046927629 11046927629 13128712297 14408724124 15799929638 17618429559 18849638344 19939997610 19939997610 19939997610 20941616934 22563076730 ...
result:
ok 100000 numbers
Test #41:
score: 0
Accepted
time: 98ms
memory: 28928kb
input:
1 99999 66666 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 ...
output:
33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 33333000000000 ...
result:
ok 99999 numbers
Test #42:
score: 0
Accepted
time: 91ms
memory: 28316kb
input:
1 99999 66666 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 ...
output:
1000000000 2000000000 3000000000 4000000000 5000000000 6000000000 7000000000 8000000000 9000000000 10000000000 11000000000 12000000000 13000000000 14000000000 15000000000 16000000000 17000000000 18000000000 19000000000 20000000000 21000000000 22000000000 23000000000 24000000000 25000000000 260000000...
result:
ok 99999 numbers
Test #43:
score: 0
Accepted
time: 88ms
memory: 14508kb
input:
300 1103 75 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 8 8 8 9 9 9 10 10 10 10 10 10 10 10 11 11 11 12 13 13 14 14 14 14 14 14 14 14 14 14 14 15 15 15 16 16 16 16 16 16 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 11 11 11 11 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 ...
output:
0 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1583 1949 1949 1949 2163 2163 2163 3129 3129 3129 3129 3129 3129 3129 3129 3846 3846 3846 4790 5091 5091 5536 5536 5536 5536 5536 5536 5536 5536 5536 5536 5536 6050 6050 605...
result:
ok 100000 numbers
Test #44:
score: 0
Accepted
time: 212ms
memory: 33332kb
input:
1 100000 100000 154 370 532 831 1278 1278 1371 1665 1778 1984 2031 2270 2361 2458 2538 3301 3352 3633 3633 3851 3851 3998 4147 4240 4395 5314 5328 5557 5818 5832 5959 6510 6581 8364 8537 8537 9061 9061 9238 9759 9759 9846 9910 10275 10275 10275 10322 10395 10662 11444 12580 12729 12785 12785 13434 1...
output:
14208656 34137464 47753610 64162449 90243422 90243422 98587231 104621875 113988784 123129603 127465541 136403495 139200394 146069461 153449461 174248756 177322385 196369527 196369527 216478937 216478937 230038658 237224779 245803192 255432965 286770404 288032112 306075470 326823305 328114595 3401049...
result:
ok 100000 numbers