QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#600336 | #8200. Surowa zima | Zpair | 56 | 8142ms | 121396kb | C++20 | 5.8kb | 2024-09-29 15:59:05 | 2024-09-29 15:59:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf=1e18;
const int N=250005;
void chkmin(ll &x,ll y){
x=min(x,y);
}
ll k,L;
ll val(ll len){
if(len<=k)return len;
ll p=len/k,t=len-p*k;
ll ans=(t+t+p*k)*(p+1);
ans-=len;
return ans;
}
ll v1(ll len){
if(len<=k)return len;
ll p=len/k,ans=inf,pos;
pos=(p/2)*k,chkmin(ans,val(pos)+val(len-pos+k)-k);
pos=(p/2+1)*k,chkmin(ans,val(pos)+val(len-pos+k)-k);
return ans;
}
ll v2(ll len){
if(len<=k)return len*2;
ll p=len/k,ans=inf,pos;
pos=(p/2)*k,chkmin(ans,val(pos)+val(len-pos)+len);
pos=(p/2+1)*k,chkmin(ans,val(pos)+val(len-pos)+len);
return ans;
}
ll v3(ll len){
if(len==0)return 1e18;
if(len<=k)return len;
if(len<=2*k)return len+len-k;
ll p=len/k,ans=inf,pos;
pos=(p/2)*k,chkmin(ans,val(pos)+val(len-pos)+min(pos,len-pos));
pos=(p/2+1)*k,chkmin(ans,val(pos)+val(len-pos)+min(pos,len-pos));
return ans;
}
int n;
mt19937 rnd(163337);
struct T{
ll a1[N],a2[N],a3[N],a4[N];
ll mn[N],s1[N],s2[N];
ll tag[N];
int pri[N],ls[N],rs[N],siz[N],rt,tot;
unordered_map<int, int> mp;
void update(int p){
siz[p]=siz[ls[p]]+siz[rs[p]]+1;
mn[p]=min({mn[ls[p]],mn[rs[p]],a4[p]});
s1[p]=s1[ls[p]]+s1[rs[p]]+a1[p];
s2[p]=s2[ls[p]]+s2[rs[p]]+a2[p];
mn[0]=inf;
}
void push(int p,ll v){
a4[p]+=v,mn[p]+=v,tag[p]+=v;
}
void pushdown(int p){
if(tag[p]){
push(ls[p],tag[p]);
push(rs[p],tag[p]);
tag[p]=0;
}
}
void split(int p,int v,int &x,int &y){
if(!p)return x=y=0,void();
pushdown(p);
if(siz[ls[p]]+1<=v)
x=p,split(rs[p],v-siz[ls[p]]-1,rs[x],y);
else y=p,split(ls[p],v,x,ls[y]);
update(p);
}
int merge(int x,int y){
if(!x||!y)return x|y;
pushdown(x),pushdown(y);
if(pri[x]<=pri[y]){
rs[x]=merge(rs[x],y);
update(x);
return x;
}
else{
ls[y]=merge(x,ls[y]);
update(y);
return y;
}
}
ll qry1(int l,int r){
if(l>r)return 0;
int x,y,z,w;
split(rt,r,w,z);
split(w,l-1,x,y);
ll ret=s1[y];
w=merge(x,y);
rt=merge(w,z);
return ret;
}
ll qry2(int l,int r){
if(l>r)return 0;
int x,y,z,w;
split(rt,r,w,z);
split(w,l-1,x,y);
ll ret=s2[y];
w=merge(x,y);
rt=merge(w,z);
return ret;
}
ll qry3(int l,int r){
if(l>r)return inf;
int x,y,z,w;
split(rt,r,w,z);
split(w,l-1,x,y);
ll ret=mn[y];
w=merge(x,y);
rt=merge(w,z);
return ret;
}
void mdf(int i,ll d){
int x,y,z,w;
split(rt,i,w,z);
split(w,i-1,x,y);
//修改y
ll dt1=v1(d)-a1[y];
ll dt2=v2(d)-a2[y];
a4[y]-=a3[y];
a1[y]=s1[y]=v1(d);
a2[y]=s2[y]=v2(d);
a3[y]=v3(d);
a4[y]+=a3[y];
mn[y]=a4[y];
push(z,dt1);
push(x,dt2);
w=merge(x,y);
rt=merge(w,z);
//单点修改
}//将d[i]改为d
set<ll> s,_s;//下标
ll xp[N],Sz;
struct bit{
#define lb(x) ((x)&(-(x)))
int b[N];
void add(int x,int v){
for(;x<=n;x+=lb(x))
b[x]+=v;
}
int qry(int x){
int ans=0;
for(;x;x-=lb(x))
ans+=b[x];
return ans;
}
#undef lb
}tree;
int findlst(int x){
auto it=s.lower_bound(x);
if(it==s.begin())return 0;
else return *(--it);
}
int findnxt(int x){
auto it=s.upper_bound(x);
if(it==s.end())return n+1;
else return *it;
}
int findlst2(int x){
auto it=_s.lower_bound(x);
if(it==_s.begin())return 0;
else return mp[*(--it)];
}
int findnxt2(int x){
auto it=_s.lower_bound(x);
if(it==_s.end())return L+1;
else return mp[*it];
}
vector<int> DEL;
void ins(int i){
int lst=findlst(i),rk=0;
int nxt=findnxt(i);
ll d=(nxt==n+1?0ll:xp[nxt]-xp[i]);
if(lst){
rk=tree.qry(lst);
ll d=xp[i]-xp[lst];
mdf(rk,d);
}
int x,y,p;
if(DEL.size()){
p=DEL.back();
DEL.pop_back();
ls[p]=rs[p]=tag[p]=0;
}
else p=++tot;
pri[p]=rnd();
siz[p]=1;
a1[p]=s1[p]=0;
a2[p]=s2[p]=0;
a3[p]=1e18;
a4[p]=mn[p]=qry2(rk+1,Sz-1)+qry1(1,rk)+a3[p];
split(rt,rk,x,y);
x=merge(x,p);
rt=merge(x,y);
mdf(rk+1,d);
s.insert(i);
_s.insert(xp[i]);
tree.add(i,1);
Sz++;
}
void del(int i){
int lst=findlst(i),rk=0;
int nxt=findnxt(i);
if(lst){
rk=tree.qry(lst);
ll d=(nxt==n+1?0:xp[nxt]-xp[lst]);
mdf(rk,d);
}
rk++;
mdf(rk,0);
int x,y,z,w;
split(rt,rk,w,z);
split(w,rk-1,x,y);
rt=merge(x,z);
DEL.push_back(y);
s.erase(i);
_s.erase(xp[i]);
tree.add(i,-1);
Sz--;
}
ll solve(int i){
int rk=tree.qry(i);
ll Ld=*(_s.begin()),Rd=L-*(--_s.end());
ll ret1=val(Ld)+Ld+qry2(1,rk-1);
ll ret2=val(Rd)+qry1(rk,Sz-1);
ll ret3=val(Rd)+Rd-qry1(1,rk-1)+qry3(rk,Sz-1);
return ret1+min(ret2,ret3);
}
ll work(int pos){
ll ans=inf;
int lst=findlst2(pos);
if(lst)ans=min(ans,solve(lst)+pos-xp[lst]);
int nxt=findnxt2(pos);
if(nxt!=L+1)ans=min(ans,solve(nxt)+xp[nxt]-pos);
return ans;
}
}_[2];
int Q;
namespace IO
{
#define gc()(xS==xTT&&(xTT=(xS=xB)+fread(xB,1,1<<20,stdin),xS==xTT)?0:*xS++)
#define pc(x)(p3-obuf<1000000)?(*p3++=x):(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=x)
char xch,xB[1<<20],*xS=xB,*xTT=xB,obuf[1000000],*p3=obuf;
inline ll read()
{
char ch=gc();ll x=0,f=1;
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=gc();}
while('0'<=ch&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=gc();}
return x*f;
}
}
using IO::read;
int main(){
_[0].mn[0]=inf;
_[1].mn[0]=inf;
cin>>n>>L>>k>>Q;ll x;
for(int i=1;i<=n;++i){
x=read();
_[0].xp[i]=x;
_[1].xp[n-i+1]=L-x;
_[0].mp[x]=i;
_[1].mp[L-x]=n-i+1;
}
for(int i=1;i<=n;++i){
_[0].ins(i);
_[1].ins(i);
}
while(Q--){
int z,u,p,x;
z=read(),u=read(),p=read();
for(int i=1;i<=z;++i)
x=read(),_[0].ins(x),_[1].ins(n-x+1);
for(int i=1;i<=u;++i)
x=read(),_[0].del(x),_[1].del(n-x+1);
printf("%lld\n",min(_[0].work(p),_[1].work(L-p)));
// printf("%lld\n",_[0].work(p));
// printf("%lld\n",_[1].work(L-p));
}
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 0ms
memory: 44676kb
input:
9 9 2 43 1 2 3 4 5 6 7 8 9 0 0 9 0 0 2 0 0 0 0 5 3 1 3 5 8 9 0 1 0 6 0 0 8 0 0 0 1 0 0 6 0 0 4 0 2 0 2 6 0 0 9 1 0 0 2 0 0 0 0 1 1 2 2 0 2 2 6 0 0 2 0 1 9 6 0 0 2 1 0 0 6 2 0 7 1 8 0 1 7 8 0 0 3 1 0 3 8 0 0 1 0 2 0 1 8 2 0 3 1 8 0 0 4 0 0 3 0 2 6 1 8 0 0 5 ...
output:
9 11 11 12 15 14 15 13 13 22 19 15 15 21 11 11 15 13 13 11 11 12 12 10 13 12 13 12 12 13 11 11 12 11 12 11 11 11 11 12 12 12 11
result:
ok 43 lines
Test #2:
score: 10
Accepted
time: 0ms
memory: 44676kb
input:
10 11 3 42 1 2 3 5 6 7 8 9 10 11 0 0 6 0 0 10 0 7 2 1 3 4 6 7 8 10 2 3 0 4 7 2 5 9 4 2 4 2 3 5 8 4 7 0 2 1 3 8 2 2 11 4 6 2 5 2 1 5 3 8 6 2 1 10 1 7 3 2 4 10 3 6 1 4 7 8 4 2 3 1 4 5 8 3 6 1 2 4 3 1 4 1 2 0 2 3 8 2 2 10 3 6 2 5 2 2 2 1 5 3 6 3 2 7 3 4 6 1 5 2 2 0 2 9 3 4 4 3 4 3 4 7 8 2 6 9 3 1...
output:
16 12 17 25 15 20 25 17 16 22 16 15 21 22 21 17 19 15 13 13 16 16 16 15 15 14 16 16 13 14 13 13 13 12 13 15 16 14 13 15 13 16
result:
ok 42 lines
Test #3:
score: 10
Accepted
time: 0ms
memory: 44680kb
input:
11 11 1 42 1 2 3 4 5 6 7 8 9 10 11 0 0 6 0 0 3 0 7 10 1 3 4 6 8 9 11 3 3 9 3 6 9 2 5 10 4 4 0 2 4 5 8 3 6 7 9 2 1 1 6 10 4 3 3 6 4 7 9 5 8 10 1 1 1 1 2 3 4 11 3 5 8 1 6 7 9 2 2 10 2 9 3 4 4 4 9 3 4 7 10 2 5 8 9 3 3 1 1 5 8 3 7 10 3 3 1 3 7 10 1 5 8 3 2 5 2 6 9 3 10 3 3 6 1 3 8 2 6 9 2 3 0 6 10 ...
output:
16 14 24 27 29 24 23 22 33 26 27 26 30 24 27 30 28 20 18 19 19 22 21 21 23 19 19 21 23 21 22 21 17 20 15 17 16 17 16 17 18 17
result:
ok 42 lines
Test #4:
score: 10
Accepted
time: 0ms
memory: 44600kb
input:
12 12 3 42 1 2 3 4 5 6 7 8 9 10 11 12 0 0 1 0 0 10 0 8 2 1 2 4 6 7 10 11 12 2 2 10 4 7 5 8 1 2 7 5 4 7 4 3 7 2 6 8 10 3 5 9 3 4 4 4 7 9 2 6 8 10 3 2 5 2 5 6 4 7 1 1 3 3 5 1 2 10 7 3 6 1 1 2 4 2 2 1 3 3 11 4 2 2 12 6 8 7 11 3 3 2 2 4 10 3 8 9 3 3 9 5 7 9 4 6 10 3 3 10 1 8 10 2 7 9 2 3 11 2 9 1 8...
output:
13 14 16 16 19 19 18 17 15 20 20 17 18 16 15 16 19 16 15 16 15 14 18 15 16 16 18 15 14 16 16 15 17 16 14 18 15 18 16 15 14 15
result:
ok 42 lines
Test #5:
score: 10
Accepted
time: 0ms
memory: 36476kb
input:
6 12 4 38 2 3 6 9 10 12 0 0 9 0 0 2 0 5 5 1 2 4 5 6 0 0 8 1 1 11 4 3 0 0 11 1 1 12 3 4 2 1 5 2 4 3 1 2 0 3 2 4 2 1 8 2 4 3 0 0 1 0 0 12 2 1 9 3 5 4 0 1 5 2 2 1 11 2 4 5 1 2 11 5 2 4 1 0 8 2 0 1 0 5 1 1 2 4 3 3 2 2 1 3 5 2 4 1 2 1 2 1 5 1 1 9 5 3 1 0 0 4 1 0 6 1 1 1 8 3 1 0 1 12 5 ...
output:
15 14 27 28 29 29 32 21 32 20 21 22 15 23 17 19 16 22 20 14 21 21 22 22 16 18 14 18 18 17 18 16 15 21 17 19 16 15
result:
ok 38 lines
Test #6:
score: 10
Accepted
time: 4ms
memory: 44676kb
input:
12 12 1 44 1 2 3 4 5 6 7 8 9 10 11 12 0 0 10 0 0 1 0 0 0 0 0 12 0 5 8 1 3 6 11 12 1 2 0 3 2 4 5 4 7 1 2 4 6 11 3 5 7 9 2 2 5 7 9 8 11 3 3 7 3 5 8 2 4 7 2 3 4 4 7 1 6 8 2 1 5 2 6 5 3 3 7 1 5 8 3 4 6 3 4 12 3 6 11 1 2 8 10 4 3 4 2 4 8 10 5 7 11 2 3 12 5 7 4 6 8 4 4 0 4 6 8 11 3 5 7 9 2 2 10 5...
output:
14 13 14 12 24 30 23 23 23 28 25 23 26 24 26 26 24 25 26 24 21 23 23 21 30 23 21 22 23 22 22 25 26 24 16 19 20 18 17 21 14 17 18 14
result:
ok 44 lines
Subtask #2:
score: 12
Accepted
Test #7:
score: 12
Accepted
time: 15ms
memory: 38916kb
input:
250 495 1 50 1 2 3 4 8 12 13 16 17 20 21 24 25 27 28 29 30 33 36 39 40 43 44 47 48 51 52 53 55 57 60 62 65 68 70 72 73 75 77 78 80 82 85 87 90 93 94 96 99 101 103 106 109 112 114 116 117 118 121 123 124 127 129 130 132 133 136 138 139 142 144 145 147 150 152 153 154 157 160 162 163 166 168 170 171 1...
output:
1662 1701 1708 1701 1696 1689 1664 1698 1680 1691 1651 1732 1737 1712 1710 1678 1679 1654 1706 1726 2119 2037 7588 2302 7844 2256 8704 5972 7280 16262 6302 2025 7145 2574 6008 4122 5402 6952 2573 7779 2936 3151 2918 3028 2938 3146 3119 2956 3132 2978
result:
ok 50 lines
Test #8:
score: 12
Accepted
time: 3ms
memory: 44776kb
input:
215 486 1 50 1 6 7 10 12 17 18 19 20 25 28 30 32 34 40 42 44 45 50 53 55 58 61 64 68 69 70 71 72 77 78 79 82 87 88 90 94 95 97 98 99 103 104 105 107 110 111 115 117 119 122 123 126 130 132 133 134 138 139 141 143 147 149 150 153 155 158 160 163 164 166 170 173 175 176 177 181 182 183 184 189 193 198...
output:
8826 2599 4103 3803 7589 2534 10366 3523 2720 2472 3014 4320 9690 13523 8905 4380 3815 4006 6326 3190 4356 6779 4048 13163 3264 3401 3666 5740 8310 2741 3317 3330 2769 2718 3223 3098 2631 4421 2501 4010 5657 4605 2815 3827 3045 2496 2220 2246 2222 2213
result:
ok 50 lines
Test #9:
score: 12
Accepted
time: 24ms
memory: 40760kb
input:
501 500 1 50 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 ...
output:
5638 5784 5860 5998 5833 3198 2975 2920 3044 2945 3041 2805 3263 2936 3130 1707 1728 1725 1704 1722 1722 1775 1632 1739 1704 1777 1732 1657 1740 1718 1001 1034 1028 1034 1048 1048 1022 1060 1053 1044 1033 1041 1063 1026 1023 1055 993 1008 1000 1051
result:
ok 50 lines
Test #10:
score: 12
Accepted
time: 7ms
memory: 44732kb
input:
154 254 1 50 0 1 3 4 6 7 8 10 14 16 17 18 22 23 24 25 29 30 32 34 35 37 39 40 43 45 46 49 51 53 54 57 59 61 62 65 66 68 69 70 71 73 74 75 76 77 78 80 83 84 85 86 87 89 90 92 94 96 98 99 101 103 104 107 108 109 110 111 113 114 115 116 119 120 121 123 126 127 128 129 130 131 132 135 136 137 140 143 14...
output:
1574 3625 1071 851 1397 941 963 1057 1179 1092 1019 778 564 823 4271 1101 5589 939 1592 2132 870 1720 1034 973 908 829 854 7308 1142 1123 558 745 832 3200 1896 1277 1635 1233 3769 1582 1134 945 970 1817 3548 938 1978 1041 578 692
result:
ok 50 lines
Test #11:
score: 12
Accepted
time: 7ms
memory: 36472kb
input:
122 499 1 50 3 9 13 16 19 26 34 37 44 45 46 53 57 58 63 65 67 75 77 85 86 89 91 99 103 105 114 117 121 129 132 140 144 148 149 155 156 161 163 170 171 177 179 182 186 194 196 204 208 218 221 224 232 234 244 249 250 259 261 264 266 274 280 281 287 288 295 296 297 298 304 311 315 320 321 326 327 338 3...
output:
6427 4420 7383 14379 5764 4905 6661 10899 4817 6096 4818 4143 13635 5402 12611 9245 4300 3797 5594 10894 3602 12452 4749 3982 6775 17979 9097 6593 4358 4329 14162 5434 10443 6268 8436 6634 6237 5230 5322 11518 6206 5970 7878 6892 9440 6923 5411 5555 11674 18100
result:
ok 50 lines
Subtask #3:
score: 8
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #12:
score: 8
Accepted
time: 650ms
memory: 51764kb
input:
25000 5000000 51 20 112 435 582 902 1243 1480 1829 1863 2090 2487 2707 2994 3168 3450 3532 3630 3976 4311 4566 4962 5176 5427 5739 5811 5921 5924 6175 6465 6593 6894 7043 7430 7816 8002 8186 8336 8679 9003 9026 9251 9548 9867 9976 10018 10254 10520 10853 11146 11524 11840 12122 12376 12525 12790 130...
output:
42856586 1453488037 970197028 52487076 51076661 48739581 56106078 72073047 1955675648 48849040 55644243 1496260500 57184400 1255346927 1871581846 46873584 3068277745 1421560187 59614895 901893228
result:
ok 20 lines
Test #13:
score: 8
Accepted
time: 3864ms
memory: 121396kb
input:
250000 5000000 10 20 28 46 76 108 117 134 168 203 219 231 235 252 264 293 297 314 349 359 380 414 436 455 477 516 529 531 552 576 597 632 649 689 718 735 769 783 823 824 845 869 898 916 935 940 967 990 1013 1040 1067 1099 1135 1174 1182 1186 1225 1262 1263 1303 1304 1314 1315 1355 1358 1388 1399 143...
output:
37955032 36261589 1719134274 39997915 3813597180 4694716047 3264383751 44372337 12033482042 23930020937 2883362389 53100687 2752707044 7027872083 25527692184 20063774853 3769998256 11123023000 54738204 40071482
result:
ok 20 lines
Test #14:
score: 8
Accepted
time: 3151ms
memory: 120520kb
input:
246396 5000000 5 20 8 61 75 97 120 125 126 127 137 194 201 209 231 249 262 286 304 321 342 364 383 406 420 431 491 503 532 554 561 600 602 631 632 634 696 703 734 736 756 791 798 842 846 869 872 900 903 922 943 968 987 1024 1028 1057 1078 1081 1106 1158 1168 1171 1187 1206 1251 1276 1283 1297 1304 1...
output:
593868318 421137343 223469439 765603328 1266416571 561810551 319530899 220377325 173163100 144437662 366985426 250417460 1173744637 167321436 138337575 562071863 317593051 221323360 1224004774 1488229388
result:
ok 20 lines
Test #15:
score: 8
Accepted
time: 2219ms
memory: 83884kb
input:
131072 5000000 263 20 38 104 168 191 199 260 291 357 393 396 420 421 497 568 597 599 622 687 695 741 785 844 869 919 931 993 1010 1020 1049 1051 1073 1113 1169 1184 1200 1269 1337 1376 1413 1468 1483 1553 1621 1643 1651 1652 1702 1748 1749 1754 1810 1843 1860 1911 1949 1975 2036 2088 2097 2101 2126 ...
output:
12771018 12691519 12983776 12778211 12949686 12811980 12774259 12731187 12777739 12932258 13036739 12942301 12687549 12723145 12872010 12810416 12584654 13053166 12802117 12830190
result:
ok 20 lines
Test #16:
score: 8
Accepted
time: 2335ms
memory: 121160kb
input:
250000 5000000 1000000 20 3 32 52 82 102 127 152 168 186 211 236 266 305 318 353 361 365 387 395 433 436 464 485 514 531 541 571 591 612 635 671 687 699 724 747 748 773 811 836 872 908 931 950 973 997 1006 1041 1047 1086 1094 1102 1136 1143 1152 1186 1206 1229 1238 1264 1281 1282 1287 1327 1331 1344...
output:
6363302 7349809 5760187 6463706 5033167 5852222 6522141 7186079 5788774 6372685 5484031 6133837 5705361 5053883 6679155 6586834 6993221 6126016 6063754 6583865
result:
ok 20 lines
Subtask #4:
score: 8
Accepted
Test #17:
score: 8
Accepted
time: 4057ms
memory: 82320kb
input:
131072 7000000 263 250000 20 22 45 99 158 245 288 360 437 450 462 563 615 629 669 748 823 894 984 1008 1097 1138 1150 1165 1225 1285 1391 1470 1486 1515 1611 1679 1717 1791 1847 1887 1958 2030 2095 2150 2191 2206 2244 2337 2418 2485 2547 2595 2649 2670 2769 2813 2914 2991 3041 3062 3168 3185 3280 33...
output:
8513356 8471871 8419347 7712212 8754163 9757890 9420391 8969598 10442369 10099473 8759883 7530068 7442310 9285306 10435831 9407102 8141129 8396502 7532797 7308905 8681626 7383619 9685899 9239374 9767102 9498756 9657515 9663700 7892842 8020437 8391769 8605798 8747139 7475189 9707930 7665595 9996277 1...
result:
ok 250000 lines
Test #18:
score: 8
Accepted
time: 5177ms
memory: 117120kb
input:
249902 100000000 11 250000 23 44 67 90 113 135 157 1005 2569 2591 2614 2636 2658 2681 2916 5093 5116 5137 5158 5179 5200 5307 7612 7634 7655 7677 7683 7700 7721 8407 10133 10155 10177 10198 10221 10242 11066 12654 12676 12698 12720 12742 12763 13781 14947 15175 15197 15218 15240 15262 15283 16949 17...
output:
6726630031 6726672457 6726711810 6726701654 6726552459 6726591802 6726452071 6726432906 6726473216 6726592308 6726571118 6726670585 6726534324 6726575900 6726472842 6726583045 6726503902 6726513331 6726670016 6726649284 6726494446 6726422443 6726500821 6726664808 6726538420 6726421183 6726531622 672...
result:
ok 250000 lines
Test #19:
score: 8
Accepted
time: 5083ms
memory: 114772kb
input:
241997 668000583 155 250000 311 621 931 1240 1549 1859 2168 2478 2787 3098 3409 3426 3719 4029 4338 4647 4956 5267 5576 5885 6194 6505 6816 7127 7436 7746 8057 8368 8678 8989 9300 9611 9922 10026 10231 10540 10851 11162 11472 11783 12092 12401 12712 13021 13332 13643 13953 14263 14574 14883 15192 15...
output:
14073835750 14074486724 14075450584 14075915328 14073036395 14072739392 14075168249 14073448303 14073247222 14074020395 14076450754 14076285085 14077140377 14072739441 14074189849 14074164911 14073590273 14072573130 14073257644 14075717045 14074254916 14075954652 14073451291 14074273261 14075974084 ...
result:
ok 250000 lines
Test #20:
score: 8
Accepted
time: 5002ms
memory: 108108kb
input:
218094 835802697 51 250000 101 202 304 405 506 609 712 815 918 958 1059 1160 1262 1363 1465 1566 1669 1772 1857 1958 2059 2160 2241 2263 2364 2467 2568 2670 2880 2983 3084 3187 3288 3390 3493 3595 3696 3935 4036 4139 4240 4343 4445 4546 4647 4750 4851 4952 5054 5155 5258 5360 5718 5821 5924 6026 612...
output:
38459413997 38459453691 38458809528 38457622281 38457877840 38457827150 38457573899 38458874813 38457767288 38458767126 38458207137 38457801725 38459411964 38458736190 38459712079 38458213923 38459696090 38458766073 38458798296 38458678798 38457879738 38457686851 38457743144 38459368400 38458929572 ...
result:
ok 250000 lines
Test #21:
score: 8
Accepted
time: 5015ms
memory: 117348kb
input:
250000 1000000000 10000 250000 1010 1965 7343 11625 19449 25096 31489 34459 35565 39097 42227 47368 50804 55367 58242 65278 67055 68342 69596 73709 73721 80363 84681 89730 93987 94668 96832 97851 98695 103725 108117 109860 116495 118023 122894 124064 124899 125487 133310 134651 141830 149231 152377 ...
output:
1346428598 1060481061 1415124008 1036274277 1248315636 1465191170 1385172527 1189554941 1215249414 1238806082 1020570268 1017498334 1406257303 1499335350 1064239075 1373288069 1379448384 1056035332 1403161409 1081345580 1157531517 1013676167 1346880747 1383131528 1415376255 1089459676 1144028672 101...
result:
ok 250000 lines
Subtask #5:
score: 0
Time Limit Exceeded
Test #22:
score: 0
Time Limit Exceeded
input:
245189 984079106 32 250000 64 127 192 255 318 381 445 508 573 637 702 765 830 894 957 1021 1084 1147 1210 1273 1337 1402 1465 1530 1593 1657 1721 1784 1847 1911 1974 2038 2101 2164 2227 2292 2357 2422 2485 2507 2570 2633 2696 2761 2825 2890 2955 3019 3083 3147 3210 3274 3339 3404 3468 3532 3595 3660...
output:
359358894786 359358890346 359358715033 359358746197 359358807351 359358681261 359359101233 359358912570 359358869227 359358911384 359358691435 359358668872 359358539812 359376681536 359376609835 359376633013 359373538272 359393475124 359393692953 359393735508 359393659138 359393575272 359393700041 3...
result:
Subtask #6:
score: 18
Accepted
Dependency #2:
100%
Accepted
Test #26:
score: 18
Accepted
time: 5425ms
memory: 53264kb
input:
30000 50000 1 250000 0 1 3 5 7 8 11 14 17 18 19 20 23 25 27 28 29 32 35 37 39 42 44 47 49 50 52 54 56 59 62 65 66 67 68 71 73 76 77 79 81 83 84 87 90 91 92 94 96 97 99 102 104 106 108 109 111 113 115 118 119 120 123 124 125 127 129 130 133 136 139 140 143 144 146 148 149 152 154 156 157 159 161 162 ...
output:
104291 103290 102872 103512 102827 98600 98034 98527 99791 99144 104428 102091 101115 103005 103923 98814 104847 102447 99815 101838 100527 105122 103635 101379 104062 101305 101183 99934 98472 98011 100488 102299 102111 101006 104621 99284 105264 103186 105143 99706 100193 99658 102790 105217 10191...
result:
ok 250000 lines
Test #27:
score: 18
Accepted
time: 7833ms
memory: 114188kb
input:
232955 208954842 1 250000 1 4 7 10 13 16 18 20 23 26 29 31 34 36 37 40 43 45 47 49 50 51 54 57 59 62 64 66 71 73 75 76 77 78 80 81 84 86 89 92 94 97 99 100 101 102 104 105 108 111 114 115 116 119 120 122 123 125 128 131 134 135 138 141 144 145 207 210 211 212 215 216 219 221 223 224 225 228 229 231 ...
output:
168384488524 168384492475 168384522273 168387308959 168387326053 168405386039 168405367439 168405371798 168405400283 168405409542 168405395389 168405370842 168407960657 168407979820 168407923937 168407930486 168407981792 168407967882 168407945488 168407929497 168422197654 168422228719 168422221651 1...
result:
ok 250000 lines
Test #28:
score: 18
Accepted
time: 8142ms
memory: 120316kb
input:
249999 1000000 1 250000 2 5 6 7 10 13 14 15 16 18 19 21 24 26 27 31 33 36 39 42 44 47 48 50 53 55 58 59 61 62 65 68 70 71 73 75 76 77 80 82 84 85 86 89 190 193 194 196 197 199 200 202 204 205 206 207 210 212 215 218 219 222 225 228 229 232 235 238 240 242 245 246 247 250 251 253 256 259 261 263 264 ...
output:
28463584 28496200 28467070 28468601 28489315 28466649 28481313 28488236 28471222 28467992 28488083 28474716 28483085 28497808 28485868 28481578 28471336 28485836 28477954 28462592 28497148 28465351 28473219 28464285 28497347 28498082 28466421 28489204 28486699 28484690 28485476 28468354 28472967 284...
result:
ok 250000 lines
Subtask #7:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Dependency #5:
0%