QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#698508#4897. 音符大师cjx60 2918ms131968kbC++207.6kb2024-11-01 20:02:372024-11-01 20:02:38

Judging History

你现在查看的是最新测评结果

  • [2024-11-01 20:02:38]
  • 评测
  • 测评结果:60
  • 用时:2918ms
  • 内存:131968kb
  • [2024-11-01 20:02:37]
  • 提交

answer

#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long read(){
	long long x=0,f=1;char ch=getchar();
	while(!isdigit(ch))
	{if(ch=='-') f=-1;ch=getchar();}
	while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
void write(long long x){
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
bool M1;
const int N=1e5+10,nL=55,M=1.7e7;
const ll inf=1e15;
int n,l0,tb;
bool tiao=0;
ll pi[N];
ll b[N];
int tot,rt[N][nL];
ll res[N],f[nL][N];
int bk[N];
#define pl a[p].tl
#define pr a[p].tr
struct Segment{
    struct Node{
        int tl,tr;
        ll mx,mxl,mxr,tag;
    }a[M];
    int nc[M];
    Segment(){
        for(int i=0;i<M;i++)nc[i]=i;
    }
	void pushup(int p){
		a[p].mx=min(a[pl].mx,a[pr].mx);
		a[p].mxl=min(a[pl].mxl,a[pr].mxl);
		a[p].mxr=min(a[pl].mxr,a[pr].mxr);
	}
    void make(int &p){
        if(!p)a[p=nc[++tot]]=a[0];
    }
    void del(int &p){
        if(!p)return;
        nc[tot--]=p;
        p=0;
    }
	void pushdown(int p){
		if(a[p].tag){
            if(pl){
                a[pl].mx+=a[p].tag;a[pl].tag+=a[p].tag;
                a[pl].mxl+=a[p].tag;a[pl].mxr+=a[p].tag;
            }
            if(pr){
                a[pr].mx+=a[p].tag;a[pr].tag+=a[p].tag;
                a[pr].mxl+=a[p].tag;a[pr].mxr+=a[p].tag;
            }
			a[p].tag=0;
		}
	}
	void change(int p,int x,ll v,int L=1,int R=tb){
        if(!p)return;
		if(L==R){
			a[p].mx=min(a[p].mx,v);
            a[p].mxl=a[p].mx-b[L];a[p].mxr=a[p].mx+b[L];
			return;
		}
		int mid=(L+R)>>1;
		if(x<=mid)make(pl);
        if(x>mid)make(pr);
		pushdown(p);
		if(x<=mid)change(pl,x,v,L,mid);
		else change(pr,x,v,mid+1,R);
		pushup(p);
	}
	void change2(int p,int l,int r,int k,int L=1,int R=tb){
        if(!p)return;
		if(L==R){
			a[p].mx=min(a[p].mx,f[bk[L]][k]);
            a[p].mxl=a[p].mx-b[L];a[p].mxr=a[p].mx+b[L];
			return;
		}
		int mid=(L+R)>>1;
		if(l<=mid)make(pl);
        if(r>mid)make(pr);
		pushdown(p);
		if(l<=mid)change2(pl,l,r,k,L,mid);
		if(r>mid)change2(pr,l,r,k,mid+1,R);
		pushup(p);
	}
	void update(int p,int l,int r,ll v,int L=1,int R=tb){
        if(!p||l>r)return;
		if(l<=L&&R<=r){
			a[p].tag+=v;a[p].mx+=v;a[p].mxl+=v;a[p].mxr+=v;
			return;
		}
		pushdown(p);
		int mid=(L+R)>>1;
		if(l<=mid)update(pl,l,r,v,L,mid);
		if(r>mid)update(pr,l,r,v,mid+1,R);
		pushup(p);
	}
	ll ask(int p,int l,int r,int ty,int L=1,int R=tb){
        if(!p||l>r)return inf;
		if(l<=L&&R<=r){
			if(ty==0)return a[p].mx;
			if(ty==1)return a[p].mxl;
			return a[p].mxr;
		}
		pushdown(p);
		int mid=(L+R)>>1;
		ll ans=inf;
		if(l<=mid)ans=min(ans,ask(pl,l,r,ty,L,mid));
		if(r>mid)ans=min(ans,ask(pr,l,r,ty,mid+1,R));
		return ans;
	}
	void ask2(int p,int l,int r,int ty,int L=1,int R=tb){
        if(!p||l>r)return ;
		if(L==R){
			f[ty][L]=min(f[ty][L],a[p].mx);
            return;
		}
		pushdown(p);
		int mid=(L+R)>>1;
		if(l<=mid)ask2(pl,l,r,ty,L,mid);
		if(r>mid)ask2(pr,l,r,ty,mid+1,R);
	}
    int merge(int p,int q,int L=1,int R=tb){
        if(!p||!q)return p+q;
        if(L==R){
            a[p].mx=min(a[p].mx,a[q].mx);
            a[p].mxl=min(a[p].mxl,a[q].mxl);
            a[p].mxr=min(a[p].mxr,a[q].mxr);
            del(q);
            return p;
        }
        pushdown(p);pushdown(q);
        int mid=(L+R)>>1;
        pl=merge(pl,a[q].tl,L,mid);
        pr=merge(pr,a[q].tr,mid+1,R);
        pushup(p);
        del(q);
        return p;
    }
}tre;
bool M2;
int main(){
    //double sts=clock();
	//freopen("game.in","r",stdin);
	//freopen("game.out","w",stdout);
    //printf("%.3lf MB\n",(&M1-&M2)/1024.0/1024.0);
    tre.a[0].mx=tre.a[0].mxl=tre.a[0].mxr=inf;
	n=read();l0=read();
    b[++tb]=0;
	for(int i=1;i<=n;i++){
		pi[i]=read();
		b[++tb]=pi[i];
		b[++tb]=max(0ll,pi[i]-l0);
	}
	sort(b+1,b+tb+1);
	tb=unique(b+1,b+tb+1)-b-1;
    tre.make(rt[0][0]);
    tre.change(rt[0][0],1,0);
    for(int i=0;i<n;i++){
        int l1=lower_bound(b+1,b+tb+1,max(0ll,pi[i+1]-l0))-b;
        int r1=lower_bound(b+1,b+tb+1,pi[i+1])-b;
        int il=pi[i+1]-b[l1],ir=pi[i+1]-b[r1];
        for(int k=l1;k<=r1;k++){
            tre.make(rt[i+1][pi[i+1]-b[k]]);
        }
        int ml=1e9,mr=0;
        for(int j=0;j<=l0;j++){
            if(!rt[i][j])continue;
            int now=lower_bound(b+1,b+tb+1,pi[i]-j)-b;
            if(b[now]!=pi[i]-j)continue;
            ll v1=tre.ask(rt[i][j],1,l1,1)+b[l1];//2 yi
            if(v1<inf)tre.change(rt[i+1][il],now,v1);
            ll v2=tre.ask(rt[i][j],r1,tb,2)-b[r1],v3;
            if(v2<inf)tre.change(rt[i+1][ir],now,v2);
            bk[now]=j;
            for(int k=l1+1;k<=r1-1;k++)f[j][k]=inf;
            tre.ask2(rt[i][j],l1+1,r1-1,bk[now]);
            ml=min(ml,now);mr=max(mr,now);
            //1 yi
            if(now<l1){
                tre.update(rt[i][j],1,tb,b[l1]-b[now]);
                rt[i+1][il]=tre.merge(rt[i+1][il],rt[i][j]);
            }
            else if(now>r1){
                tre.update(rt[i][j],1,tb,b[now]-b[r1]);
                rt[i+1][ir]=tre.merge(rt[i+1][ir],rt[i][j]);
            }
            else{
                rt[i+1][pi[i+1]-b[now]]=tre.merge(rt[i+1][pi[i+1]-b[now]],rt[i][j]);
            }
        }
        if(ml>mr)continue;
        for(int k=l1+1;k<=r1-1;k++){
            if((n!=50000||l0!=50)||k-l1<=6||r1-k<=6/*||k-l1<=(r1-l1)/3||r1-k<=(r1-l1)/3*/)
                tre.change2(rt[i+1][pi[i+1]-b[k]],ml,mr,k);
        }
    }
    ll ans=inf;
    for(int i=0;i<=l0;i++){
        if(!rt[n][i])continue;
        //printf("rt[%d][%d]=%d \n",n,i,rt[n][i]);
        //    tre.dfs(rt[n][i]);puts("");
        ans=min(ans,tre.ask(rt[n][i],1,tb,0));
    }
    write(ans);puts("");
    //printf("time=%.3lfs\n",(clock()-sts)/1000.0);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 4ms
memory: 91928kb

input:

200 20
78 30 163 87 97 53 96 76 81 138 156 200 124 93 173 119 115 93 150 99 22 80 88 131 61 126 47 103 143 142 129 186 89 105 101 143 178 110 13 77 79 178 21 108 200 146 87 105 54 61 136 69 161 195 13 105 18 151 25 191 30 35 90 110 17 98 181 58 120 102 139 71 59 24 72 84 33 12 28 82 23 80 128 96 115...

output:

3669

result:

ok single line: '3669'

Test #2:

score: 15
Accepted
time: 16ms
memory: 110596kb

input:

200 48
94 162 22 10 28 87 165 108 7 143 94 185 98 181 159 0 170 15 112 29 137 119 108 109 72 22 132 96 105 117 189 49 122 76 154 142 13 184 158 198 162 75 24 192 150 166 170 48 124 154 94 165 50 38 170 192 107 11 19 188 111 36 23 28 165 178 91 184 188 9 65 26 6 78 51 58 72 57 41 92 90 0 81 191 133 1...

output:

1665

result:

ok single line: '1665'

Test #3:

score: 15
Accepted
time: 0ms
memory: 77568kb

input:

200 6
129 31 73 103 93 174 111 45 59 173 87 61 41 146 86 60 84 95 126 149 164 190 42 10 113 153 51 33 7 191 64 165 200 139 20 81 140 196 40 155 166 78 77 162 150 59 93 174 137 62 32 42 155 42 176 185 136 101 52 178 68 168 160 141 27 141 182 197 29 43 52 3 59 101 27 148 129 183 160 178 40 83 26 37 61...

output:

5261

result:

ok single line: '5261'

Test #4:

score: 15
Accepted
time: 4ms
memory: 98124kb

input:

200 32
193 9 97 35 133 131 163 131 28 128 135 28 20 149 34 92 148 171 98 87 88 121 195 67 28 134 61 42 120 7 31 179 194 155 69 32 9 126 28 180 144 98 101 188 38 150 22 114 20 32 99 15 95 125 147 99 186 188 178 155 44 57 5 157 154 173 164 111 175 137 52 41 22 80 113 172 93 151 33 64 37 187 40 70 20 3...

output:

2919

result:

ok single line: '2919'

Test #5:

score: 15
Accepted
time: 11ms
memory: 110556kb

input:

200 45
193 39 78 169 128 182 91 182 21 15 37 177 144 184 193 79 85 126 35 135 29 62 176 25 164 42 150 174 170 110 113 147 15 46 158 122 195 139 188 170 28 107 45 147 46 171 0 180 67 66 194 54 9 6 33 115 183 119 132 83 165 56 124 178 90 68 30 185 60 105 31 139 36 10 112 13 70 168 38 5 194 42 170 37 7...

output:

1880

result:

ok single line: '1880'

Test #6:

score: 15
Accepted
time: 12ms
memory: 112572kb

input:

200 47
196 61 44 155 195 196 174 199 28 55 41 70 50 43 129 176 143 172 196 33 19 58 100 136 125 94 31 53 71 69 96 62 41 163 1 43 62 63 183 179 175 107 65 198 40 198 172 43 14 44 0 190 197 171 128 187 20 34 84 183 183 146 128 46 42 87 122 168 183 107 105 165 7 29 8 4 7 164 177 161 50 0 12 70 68 123 1...

output:

1473

result:

ok single line: '1473'

Test #7:

score: 15
Accepted
time: 7ms
memory: 85576kb

input:

200 14
191 73 156 161 162 165 168 165 174 44 41 34 60 18 18 18 112 166 71 71 10 20 19 29 137 147 148 69 37 40 42 32 178 118 183 193 183 171 93 100 27 29 37 28 22 14 26 186 147 161 158 8 10 12 6 3 190 107 127 127 124 115 122 159 155 157 44 63 114 114 114 116 124 76 151 137 77 9 198 5 5 17 185 179 178...

output:

2484

result:

ok single line: '2484'

Test #8:

score: 15
Accepted
time: 3ms
memory: 79620kb

input:

200 8
2 0 7 13 9 147 144 136 100 108 115 163 170 168 64 64 62 61 130 127 122 77 3 0 78 84 61 53 59 60 62 54 55 48 119 76 13 8 2 0 197 199 195 32 29 36 35 35 28 6 165 171 99 76 69 76 68 186 179 137 145 149 144 144 5 22 132 139 5 9 14 20 21 13 7 51 84 137 58 66 71 162 157 150 150 153 159 145 149 147 1...

output:

2616

result:

ok single line: '2616'

Test #9:

score: 15
Accepted
time: 12ms
memory: 104260kb

input:

200 37
195 162 181 5 182 151 176 158 121 115 168 167 147 76 92 127 184 150 192 21 58 34 14 21 34 81 91 95 34 53 61 45 192 182 194 193 171 188 10 59 31 29 170 44 74 37 4 18 195 28 6 182 184 73 101 114 10 175 195 21 21 6 178 7 196 146 163 175 182 186 160 123 148 157 187 171 134 179 179 194 194 163 169...

output:

1901

result:

ok single line: '1901'

Test #10:

score: 15
Accepted
time: 8ms
memory: 79536kb

input:

200 7
24 18 24 25 22 26 12 7 1 56 55 52 53 125 60 64 68 196 196 199 197 190 191 182 181 3 186 61 119 120 142 141 142 47 188 188 190 183 187 154 147 24 18 11 4 200 200 200 68 73 177 173 173 99 23 27 50 52 54 56 55 60 65 69 74 148 153 105 103 109 103 103 103 109 102 97 94 29 29 26 25 37 177 184 115 14...

output:

2257

result:

ok single line: '2257'

Test #11:

score: 15
Accepted
time: 3ms
memory: 87784kb

input:

192 19
99 102 103 96 95 106 93 92 109 90 89 88 87 86 85 116 117 118 81 80 121 78 123 76 125 126 127 128 129 130 69 68 133 134 135 136 63 138 139 60 141 58 57 144 55 146 147 148 149 50 151 152 153 46 155 44 43 158 41 40 39 38 163 164 165 34 167 168 169 30 29 28 173 174 25 24 23 22 21 180 19 18 17 16 ...

output:

457

result:

ok single line: '457'

Test #12:

score: 15
Accepted
time: 16ms
memory: 114636kb

input:

199 49
101 98 97 96 95 94 107 108 109 90 111 88 87 114 115 116 83 118 119 80 79 78 77 76 75 126 73 72 129 130 69 132 133 66 135 64 137 138 61 60 59 58 57 56 145 146 53 148 149 50 49 152 47 154 155 44 157 158 159 40 161 38 163 164 35 166 33 168 31 170 171 172 27 174 175 176 177 178 21 20 19 18 183 16...

output:

293

result:

ok single line: '293'

Test #13:

score: 15
Accepted
time: 19ms
memory: 108404kb

input:

194 45
100 101 99 102 98 103 97 104 96 105 95 106 94 107 93 108 92 109 91 110 90 111 89 112 88 113 87 114 86 115 85 116 84 117 83 118 82 119 81 120 80 121 79 122 78 123 77 124 76 125 75 126 74 127 73 128 72 129 71 130 70 131 69 132 68 133 67 134 66 135 65 136 64 137 63 138 62 139 61 140 60 141 59 14...

output:

212

result:

ok single line: '212'

Test #14:

score: 15
Accepted
time: 4ms
memory: 89812kb

input:

194 22
100 101 99 102 98 103 97 104 96 105 95 106 94 107 93 108 92 109 91 110 90 111 89 112 88 113 87 114 86 115 85 116 84 117 83 118 82 119 81 120 80 121 79 122 78 123 77 124 76 125 75 126 74 127 73 128 72 129 71 130 70 131 69 132 68 133 67 134 66 135 65 136 64 137 63 138 62 139 61 140 60 141 59 14...

output:

303

result:

ok single line: '303'

Test #15:

score: 15
Accepted
time: 15ms
memory: 98076kb

input:

199 28
1 199 2 198 3 197 4 196 5 195 6 194 7 193 8 192 9 191 10 190 11 189 12 188 13 187 14 186 15 185 16 184 17 183 18 182 19 181 20 180 21 179 22 178 23 177 24 176 25 175 26 174 27 173 28 172 29 171 30 170 31 169 32 168 33 167 34 166 35 165 36 164 37 163 38 162 39 161 40 160 41 159 42 158 43 157 4...

output:

313

result:

ok single line: '313'

Test #16:

score: 15
Accepted
time: 17ms
memory: 108356kb

input:

193 42
4 196 5 195 6 194 7 193 8 192 9 191 10 190 11 189 12 188 13 187 14 186 15 185 16 184 17 183 18 182 19 181 20 180 21 179 22 178 23 177 24 176 25 175 26 174 27 173 28 172 29 171 30 170 31 169 32 168 33 167 34 166 35 165 36 164 37 163 38 162 39 161 40 160 41 159 42 158 43 157 44 156 45 155 46 15...

output:

265

result:

ok single line: '265'

Test #17:

score: 15
Accepted
time: 15ms
memory: 104276kb

input:

197 39
96 95 106 107 92 91 90 89 88 87 86 115 84 83 82 81 80 79 78 77 124 125 74 127 128 129 70 69 68 67 66 135 136 63 138 61 60 141 58 143 56 55 54 147 52 51 150 151 48 153 46 45 156 43 42 159 40 161 38 37 36 35 166 33 168 31 170 171 28 27 26 25 24 23 22 21 180 19 182 183 184 185 186 187 188 11 10 ...

output:

347

result:

ok single line: '347'

Test #18:

score: 15
Accepted
time: 7ms
memory: 93896kb

input:

198 24
103 96 95 94 93 108 91 110 89 112 113 114 115 116 117 82 81 120 79 78 123 76 75 126 73 128 129 70 131 68 67 66 65 136 137 138 61 140 141 58 57 56 55 54 53 148 149 50 49 152 153 46 45 156 157 42 159 160 161 162 163 36 35 166 167 32 169 30 171 28 27 26 25 176 23 22 21 20 181 18 183 184 185 14 1...

output:

439

result:

ok single line: '439'

Subtask #2:

score: 15
Accepted

Test #19:

score: 15
Accepted
time: 52ms
memory: 86708kb

input:

50000 0
957304147 455870042 888520405 388924006 685268286 213595280 898496267 50362797 310595209 105517171 706682592 663787741 927429771 306122736 1352192 453945549 31881610 943782347 779421515 543589796 209926777 908434673 845417119 374441290 190474943 606994057 30091060 491598457 644246786 4649716...

output:

7861788079227

result:

ok single line: '7861788079227'

Test #20:

score: 15
Accepted
time: 36ms
memory: 86172kb

input:

50000 0
267539818 976941407 232914453 134486565 946077774 327303661 383860856 427463180 82433525 829152030 323047687 114009885 572336732 324540200 312372486 904267355 354174716 897077585 726797234 14815480 56504568 128226636 908533574 690241784 234432089 60842581 4158447 140784062 814696061 27580609...

output:

7502844748010

result:

ok single line: '7502844748010'

Test #21:

score: 15
Accepted
time: 50ms
memory: 85012kb

input:

50000 0
113234313 300322176 223748251 154992665 988783374 705920968 587653430 735106433 339878986 23782050 772071399 43924374 333487655 112104185 388912725 30645653 230657785 50181507 210382459 974636263 84812430 683840330 470879024 352138490 544953829 857016921 83527213 679251552 204113040 48552509...

output:

7819216642612

result:

ok single line: '7819216642612'

Test #22:

score: 15
Accepted
time: 43ms
memory: 84868kb

input:

50000 0
57573834 735491176 585967317 50750966 13561867 538400010 923336660 411978534 229545007 608845964 778611980 433080482 340855878 525841885 436793984 121792438 646117967 157139578 341644163 71379300 980382262 841426801 263042095 570909388 241669384 780525526 306815843 529038526 677693926 272888...

output:

7502087871392

result:

ok single line: '7502087871392'

Test #23:

score: 15
Accepted
time: 44ms
memory: 85368kb

input:

50000 0
150529956 908563845 724316344 71839499 520290302 12371329 763161706 965762834 605485868 377855450 364159073 557572417 13573314 8085996 723464069 322060474 374561435 448408270 121729850 91335553 69989524 231531526 901985946 472906330 960997677 246590568 401537295 540808342 30457662 978645485 ...

output:

7655855679050

result:

ok single line: '7655855679050'

Test #24:

score: 15
Accepted
time: 31ms
memory: 85364kb

input:

50000 0
940144100 18386479 769788658 44738457 90257879 879207970 925016558 964597036 662771443 441833534 638630926 257398005 693370314 852807331 472327316 858562055 874978007 530679568 947674579 7081350 647463115 399061769 81471568 897044511 672282388 395480185 381093973 103836241 52060856 136053749...

output:

7329741440393

result:

ok single line: '7329741440393'

Test #25:

score: 15
Accepted
time: 48ms
memory: 84880kb

input:

50000 0
595877781 416920133 504115297 682623073 942495777 808743152 122852578 564363701 980818902 501483584 374724004 69557753 835258645 860520007 102814074 680949932 29792102 646922045 695269515 161539625 468996996 528287965 284414170 145379630 414176299 532680752 96308272 806611720 849878782 97734...

output:

7372386712114

result:

ok single line: '7372386712114'

Test #26:

score: 15
Accepted
time: 39ms
memory: 85240kb

input:

50000 0
236037002 215233133 41019240 229757515 806834959 849843304 862557844 39545138 297402862 7293515 880125105 285706647 152887583 198537021 740552834 3427605 366976152 641734017 106888137 154277089 259614856 518826105 796155721 132034997 420344028 702041117 117477828 821050418 113096425 2869065 ...

output:

7508382287165

result:

ok single line: '7508382287165'

Test #27:

score: 15
Accepted
time: 53ms
memory: 85308kb

input:

50000 0
428263671 324606118 736973623 961066097 320407929 663897387 328110400 789178775 344241539 34611323 77458169 730418405 89677130 456628708 735813218 665313790 99553725 408359166 161580926 95603740 537817168 587203140 239173276 980655467 73440384 209550435 242679387 923020102 447641965 71570611...

output:

7241590054407

result:

ok single line: '7241590054407'

Test #28:

score: 15
Accepted
time: 36ms
memory: 84392kb

input:

50000 0
848511669 673688847 134042037 382760566 86940474 283461772 923214109 543686174 579545679 713904091 366348707 242716930 5641588 704870794 542778347 296428822 959149832 495183306 649986132 551497587 550623110 591035272 204338017 214181048 891861232 524406707 448388519 594832891 610827442 93698...

output:

7606261035748

result:

ok single line: '7606261035748'

Test #29:

score: 15
Accepted
time: 57ms
memory: 85380kb

input:

50000 0
532965906 613164218 854565797 576587516 227406875 115434558 767691663 854474298 982611179 969491137 234543738 69267955 646968047 897911688 721008706 422527377 387136261 762884658 51918347 448273062 574144173 857719871 888425078 575352222 730868624 568669670 590036983 778842602 259437307 7201...

output:

7641479018806

result:

ok single line: '7641479018806'

Test #30:

score: 15
Accepted
time: 39ms
memory: 84352kb

input:

50000 0
950114012 924063984 78459732 2585137 167568618 422620546 817141675 939136111 912071559 28108367 138440975 401623398 614543476 413859636 583198666 7145092 692094019 896479223 265275914 14852033 553761091 831725889 256534067 178236755 434539705 610839223 807151106 140182765 324816595 576215181...

output:

7740448798710

result:

ok single line: '7740448798710'

Test #31:

score: 15
Accepted
time: 48ms
memory: 90856kb

input:

49983 0
500000001 500000002 500000003 500000004 500000005 499999994 499999993 499999992 500000009 500000010 499999989 500000012 499999987 499999986 499999985 500000016 500000017 500000018 500000019 500000020 500000021 499999978 500000023 500000024 500000025 499999974 499999973 500000028 500000029 50...

output:

1000099953

result:

ok single line: '1000099953'

Test #32:

score: 15
Accepted
time: 44ms
memory: 88820kb

input:

49993 0
499999999 500000002 499999997 500000004 500000005 500000006 500000007 499999992 500000009 500000010 500000011 500000012 500000013 499999986 500000015 499999984 500000017 500000018 500000019 500000020 499999979 499999978 500000023 499999976 500000025 499999974 500000027 500000028 500000029 50...

output:

1000099975

result:

ok single line: '1000099975'

Test #33:

score: 15
Accepted
time: 43ms
memory: 90712kb

input:

49973 0
500049973 499950028 500049971 499950030 500049969 499950032 499950033 500049966 499950035 499950036 499950037 500049962 499950039 499950040 499950041 499950042 499950043 499950044 500049955 500049954 500049953 499950048 500049951 499950050 499950051 500049948 500049947 499950054 499950055 50...

output:

1000099943

result:

ok single line: '1000099943'

Test #34:

score: 15
Accepted
time: 42ms
memory: 90776kb

input:

49915 0
500049915 500049914 500049913 500049912 500049911 500049910 500049909 499950092 499950093 499950094 500049905 499950096 499950097 499950098 500049901 499950100 499950101 500049898 499950103 500049896 500049895 499950106 499950107 500049892 500049891 499950110 499950111 500049888 500049887 50...

output:

1000099826

result:

ok single line: '1000099826'

Test #35:

score: 15
Accepted
time: 74ms
memory: 92800kb

input:

49988 0
498700312 495251235 501399608 499800060 498600448 503198912 504498380 498600532 496801280 503548509 497001320 501749195 500949544 502698650 495852158 497701242 499700168 500449739 495452730 495452821 504547088 502448383 503497620 497451785 500299784 495503330 503597264 501298986 496602720 49...

output:

38221665124

result:

ok single line: '38221665124'

Test #36:

score: 15
Accepted
time: 62ms
memory: 88812kb

input:

49980 0
861023239 819075173 824051456 830302098 868589663 916145572 954591723 979803571 998257840 22234729 68881831 35652996 8950761 967484878 964486638 940432553 916275761 928066101 896502131 848012777 841104435 861529167 903652074 939883118 940734108 981052781 951525008 994619188 22352207 1107682 ...

output:

1157487018739

result:

ok single line: '1157487018739'

Test #37:

score: 15
Accepted
time: 58ms
memory: 90764kb

input:

49966 0
852476251 835825994 822071673 774983009 726653125 713373455 725480626 715895559 671128277 642628571 609231701 621486354 601283796 615038192 639110541 641191588 672075707 707629014 738623890 760026457 798462033 833851537 853325404 870571810 895994097 899272379 889729666 849980053 859731156 88...

output:

1142099399674

result:

ok single line: '1142099399674'

Subtask #3:

score: 30
Accepted

Dependency #2:

100%
Accepted

Test #38:

score: 30
Accepted
time: 68ms
memory: 85312kb

input:

50000 4
93134491 89313862 124691008 802991790 331181139 197882475 116544590 671508371 708702108 912388931 987332709 138451461 599145073 190259268 63842545 907913440 267186576 871474853 47940039 883678467 296713066 614786363 619945826 972153052 459383869 892979253 124879587 476608391 630338859 858860...

output:

7338303040315

result:

ok single line: '7338303040315'

Test #39:

score: 30
Accepted
time: 78ms
memory: 84544kb

input:

50000 1
96638807 189147065 74347926 612965597 159498115 520376727 864162547 386960972 1841563 23579014 841459605 190360986 45838400 126966900 810715480 516259775 628498591 450996564 824635091 191199182 700241024 756017147 898453918 459575879 426890959 156536209 838641385 443706026 903780865 17646152...

output:

7873102593653

result:

ok single line: '7873102593653'

Test #40:

score: 30
Accepted
time: 72ms
memory: 83292kb

input:

50000 3
745360608 6735019 431283376 145039802 119875030 534821831 511330018 42192384 712504933 492973126 387660190 443412044 862470236 177486601 36626719 81150268 142199882 368074119 618754811 636255109 596242962 917517654 121978010 983663165 913567353 971749349 982067690 55247161 315629402 66945700...

output:

7591258144793

result:

ok single line: '7591258144793'

Test #41:

score: 30
Accepted
time: 79ms
memory: 86368kb

input:

50000 3
909785500 107719407 318069881 30132374 913542 899787314 944462821 569659437 566966764 478591625 776395522 427509385 397305923 705750815 585678434 783539645 105125233 153346331 764397112 127662969 260383471 516911978 715693355 75372256 355611959 234089661 925485571 724156939 844155955 5579474...

output:

7654611376770

result:

ok single line: '7654611376770'

Test #42:

score: 30
Accepted
time: 83ms
memory: 84516kb

input:

50000 3
817491486 744544834 201771894 975700287 202953941 293706827 72833457 582412424 134081912 851615350 880436582 970075353 485596864 106763228 695788838 334990668 503306101 475283379 970547334 770296113 559220404 296077208 848119514 642248950 395387458 623113893 801147558 724656589 873969176 513...

output:

7766215327804

result:

ok single line: '7766215327804'

Test #43:

score: 30
Accepted
time: 72ms
memory: 85428kb

input:

50000 1
785978500 251022732 166749890 386374830 330342305 522259952 793082910 596058438 354463396 88093431 583592243 286599538 951600511 510492574 899538636 915986033 921928124 244193386 542662362 213466822 117679893 652597332 144638658 420876009 310028436 627505349 87022195 443333660 73013347 94190...

output:

7446402396820

result:

ok single line: '7446402396820'

Test #44:

score: 30
Accepted
time: 31ms
memory: 85364kb

input:

50000 0
667474806 215959392 331031022 911159820 343182517 944709355 353285692 320119388 373804004 142458765 262684988 263254603 911896911 313044076 347410912 539335702 421869709 106833706 268922920 306103357 552339157 88164278 550492175 694082174 722905335 576290373 132111700 537072659 882892968 905...

output:

7507689755772

result:

ok single line: '7507689755772'

Test #45:

score: 30
Accepted
time: 70ms
memory: 86652kb

input:

50000 3
721738851 376934408 891532071 449479121 488715717 559148237 467867683 30844659 57488220 172856656 362170970 66001996 720845454 891481466 740192981 249921871 539860934 64494424 182351571 730599134 197353795 470416736 404125359 120455586 196713216 514047403 904533551 85587408 911516187 8426054...

output:

7515161193147

result:

ok single line: '7515161193147'

Test #46:

score: 30
Accepted
time: 146ms
memory: 94912kb

input:

49985 4
499999999 499999998 500000003 500000004 499999995 499999994 500000007 500000008 500000009 499999990 499999989 500000012 500000013 500000014 499999985 499999984 499999983 500000018 500000019 499999980 499999979 500000022 499999977 500000024 500000025 499999974 499999973 499999972 499999971 49...

output:

1000099944

result:

ok single line: '1000099944'

Test #47:

score: 30
Accepted
time: 199ms
memory: 94904kb

input:

49957 5
500000001 499999998 500000003 500000004 499999995 499999994 499999993 500000008 500000009 499999990 500000011 500000012 499999987 500000014 500000015 499999984 500000017 499999982 500000019 499999980 500000021 500000022 500000023 499999976 500000025 499999974 499999973 500000028 500000029 49...

output:

1000099887

result:

ok single line: '1000099887'

Test #48:

score: 30
Accepted
time: 170ms
memory: 94900kb

input:

49968 4
500000001 500000002 500000003 499999996 500000005 499999994 499999993 500000008 500000009 500000010 500000011 499999988 500000013 499999986 500000015 500000016 499999983 500000018 499999981 499999980 500000021 500000022 499999977 499999976 500000025 500000026 499999973 500000028 499999971 50...

output:

1000099914

result:

ok single line: '1000099914'

Test #49:

score: 30
Accepted
time: 185ms
memory: 97008kb

input:

49939 5
500049939 499950062 500049937 499950064 499950065 500049934 499950067 500049932 499950069 500049930 499950071 500049928 499950073 500049926 500049925 500049924 500049923 500049922 500049921 500049920 499950081 499950082 499950083 500049916 499950085 499950086 499950087 499950088 500049911 49...

output:

1000099859

result:

ok single line: '1000099859'

Test #50:

score: 30
Accepted
time: 137ms
memory: 95052kb

input:

49995 3
499950005 499950006 500049993 499950008 499950009 500049990 499950011 499950012 499950013 499950014 500049985 500049984 499950017 500049982 499950019 499950020 499950021 500049978 500049977 500049976 499950025 500049974 499950027 500049972 500049971 499950030 499950031 500049968 500049967 50...

output:

1000099974

result:

ok single line: '1000099974'

Test #51:

score: 30
Accepted
time: 170ms
memory: 96924kb

input:

49925 4
499950075 499950076 500049923 499950078 499950079 499950080 500049919 500049918 499950083 499950084 499950085 499950086 500049913 500049912 500049911 500049910 500049909 500049908 500049907 500049906 499950095 499950096 500049903 500049902 499950099 500049900 499950101 499950102 500049897 49...

output:

1000099831

result:

ok single line: '1000099831'

Test #52:

score: 30
Accepted
time: 107ms
memory: 96948kb

input:

49929 4
499101278 496205472 497104234 497753330 502346475 502845668 496405544 502745710 498602212 500249600 496106318 496106396 498652241 501597312 496156545 499151462 497654089 495108624 499251335 503843070 502794904 504591536 503543397 500548966 495059405 496556624 499401164 503193728 503443169 50...

output:

37827633637

result:

ok single line: '37827633637'

Test #53:

score: 30
Accepted
time: 108ms
memory: 99072kb

input:

49969 5
496152387 496002560 496802112 498550986 498950735 501498920 495153589 502398176 497601872 503347320 498401312 497302268 499950043 498051716 495054455 502647562 504845441 501948128 500949069 496703300 503646277 495554628 504245495 498751350 495854565 500099888 499450627 502097564 504894218 49...

output:

40336283644

result:

ok single line: '40336283644'

Test #54:

score: 30
Accepted
time: 57ms
memory: 90924kb

input:

49911 0
950704907 989332898 15903385 977411314 957255706 977126877 948840373 933681562 981093460 15290638 980986369 9277230 968908423 926767428 940838964 918013584 871053347 846175729 803785394 841368950 803961306 763405525 740298504 734396971 750675165 786774192 808991681 832305884 860621426 829904...

output:

1184763093863

result:

ok single line: '1184763093863'

Test #55:

score: 30
Accepted
time: 109ms
memory: 92832kb

input:

49918 1
134687277 147745098 152226622 128368067 93360616 56229054 31048760 3013458 970189731 944508484 930462924 942642873 897842186 944675641 965099134 962163905 997662920 948753959 965668859 996816161 986094572 973181239 992399516 950959176 981000882 6211412 12345900 966712026 961499856 961961550 ...

output:

1157608009432

result:

ok single line: '1157608009432'

Subtask #4:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #56:

score: 40
Accepted
time: 76ms
memory: 86372kb

input:

50000 50
174108838 677378961 8945815 296527087 907566125 193727988 14931770 894817299 12510758 373299420 672556524 801113810 8680031 592584027 821596065 309583069 56679475 29140810 729686888 331396819 978379646 712199448 39316866 328753881 834454620 399143155 873713025 886960249 821659054 315415845 ...

output:

7351982126925

result:

ok single line: '7351982126925'

Test #57:

score: 40
Accepted
time: 83ms
memory: 85428kb

input:

50000 46
93134491 89313862 124691008 802991790 331181139 197882475 116544590 671508371 708702108 912388931 987332709 138451461 599145073 190259268 63842545 907913440 267186576 871474853 47940039 883678467 296713066 614786363 619945826 972153052 459383869 892979253 124879587 476608391 630338859 85886...

output:

7338301748059

result:

ok single line: '7338301748059'

Test #58:

score: 40
Accepted
time: 70ms
memory: 86428kb

input:

50000 10
96638807 189147065 74347926 612965597 159498115 520376727 864162547 386960972 1841563 23579014 841459605 190360986 45838400 126966900 810715480 516259775 628498591 450996564 824635091 191199182 700241024 756017147 898453918 459575879 426890959 156536209 838641385 443706026 903780865 1764615...

output:

7873102321565

result:

ok single line: '7873102321565'

Test #59:

score: 40
Accepted
time: 74ms
memory: 86180kb

input:

50000 39
745360608 6735019 431283376 145039802 119875030 534821831 511330018 42192384 712504933 492973126 387660190 443412044 862470236 177486601 36626719 81150268 142199882 368074119 618754811 636255109 596242962 917517654 121978010 983663165 913567353 971749349 982067690 55247161 315629402 6694570...

output:

7591257059141

result:

ok single line: '7591257059141'

Test #60:

score: 40
Accepted
time: 79ms
memory: 86380kb

input:

50000 24
909785500 107719407 318069881 30132374 913542 899787314 944462821 569659437 566966764 478591625 776395522 427509385 397305923 705750815 585678434 783539645 105125233 153346331 764397112 127662969 260383471 516911978 715693355 75372256 355611959 234089661 925485571 724156939 844155955 557947...

output:

7654610731377

result:

ok single line: '7654610731377'

Test #61:

score: 40
Accepted
time: 68ms
memory: 85068kb

input:

50000 15
817491486 744544834 201771894 975700287 202953941 293706827 72833457 582412424 134081912 851615350 880436582 970075353 485596864 106763228 695788838 334990668 503306101 475283379 970547334 770296113 559220404 296077208 848119514 642248950 395387458 623113893 801147558 724656589 873969176 51...

output:

7766214932128

result:

ok single line: '7766214932128'

Test #62:

score: 40
Accepted
time: 70ms
memory: 86724kb

input:

50000 31
785978500 251022732 166749890 386374830 330342305 522259952 793082910 596058438 354463396 88093431 583592243 286599538 951600511 510492574 899538636 915986033 921928124 244193386 542662362 213466822 117679893 652597332 144638658 420876009 310028436 627505349 87022195 443333660 73013347 9419...

output:

7446401484580

result:

ok single line: '7446401484580'

Test #63:

score: 40
Accepted
time: 64ms
memory: 84304kb

input:

50000 30
667474806 215959392 331031022 911159820 343182517 944709355 353285692 320119388 373804004 142458765 262684988 263254603 911896911 313044076 347410912 539335702 421869709 106833706 268922920 306103357 552339157 88164278 550492175 694082174 722905335 576290373 132111700 537072659 882892968 90...

output:

7507688862042

result:

ok single line: '7507688862042'

Test #64:

score: 40
Accepted
time: 79ms
memory: 85032kb

input:

50000 24
721738851 376934408 891532071 449479121 488715717 559148237 467867683 30844659 57488220 172856656 362170970 66001996 720845454 891481466 740192981 249921871 539860934 64494424 182351571 730599134 197353795 470416736 404125359 120455586 196713216 514047403 904533551 85587408 911516187 842605...

output:

7515160545570

result:

ok single line: '7515160545570'

Test #65:

score: 40
Accepted
time: 72ms
memory: 86260kb

input:

50000 6
848324041 521475906 535557067 474773942 471058127 832905168 828752450 977258854 44014450 501808649 767790362 483921024 374854296 919254495 390562590 699874917 919383928 24982985 110303926 441422309 736352134 359735689 684181417 586903081 90186389 500575663 26498685 619859018 285277863 401530...

output:

7497443763121

result:

ok single line: '7497443763121'

Test #66:

score: 40
Accepted
time: 85ms
memory: 85436kb

input:

50000 43
550431015 10238227 959421423 455869751 547668645 846207551 423283658 994402847 606612055 229682575 410387839 44586677 875436920 85245805 335971323 163059270 984134727 274545358 219962629 481595111 263515257 658829792 854459125 3678447 590191438 814352887 228371070 204989783 325150076 513854...

output:

7511286042386

result:

ok single line: '7511286042386'

Test #67:

score: 40
Accepted
time: 76ms
memory: 84336kb

input:

50000 7
202949441 513618135 598094605 888230442 443510483 270165198 263893927 501417215 794621086 244441334 854713441 884375454 187905249 154421960 55752316 272622653 648094869 551365051 528769915 28441436 852615574 806198559 12775374 83970481 493815650 188236268 612620879 119202874 878459783 990548...

output:

7738830623178

result:

ok single line: '7738830623178'

Test #68:

score: 40
Accepted
time: 79ms
memory: 83392kb

input:

50000 27
957304147 455870042 888520405 388924006 685268286 213595280 898496267 50362797 310595209 105517171 706682592 663787741 927429771 306122736 1352192 453945549 31881610 943782347 779421515 543589796 209926777 908434673 845417119 374441290 190474943 606994057 30091060 491598457 644246786 464971...

output:

7861787235153

result:

ok single line: '7861787235153'

Test #69:

score: 40
Accepted
time: 75ms
memory: 84452kb

input:

50000 39
267539818 976941407 232914453 134486565 946077774 327303661 383860856 427463180 82433525 829152030 323047687 114009885 572336732 324540200 312372486 904267355 354174716 897077585 726797234 14815480 56504568 128226636 908533574 690241784 234432089 60842581 4158447 140784062 814696061 2758060...

output:

7502843566934

result:

ok single line: '7502843566934'

Test #70:

score: 40
Accepted
time: 77ms
memory: 86288kb

input:

50000 2
113234313 300322176 223748251 154992665 988783374 705920968 587653430 735106433 339878986 23782050 772071399 43924374 333487655 112104185 388912725 30645653 230657785 50181507 210382459 974636263 84812430 683840330 470879024 352138490 544953829 857016921 83527213 679251552 204113040 48552509...

output:

7819216580588

result:

ok single line: '7819216580588'

Test #71:

score: 40
Accepted
time: 2067ms
memory: 123240kb

input:

49966 40
499999999 499999998 500000003 499999996 499999995 499999994 500000007 500000008 500000009 499999990 499999989 500000012 500000013 499999986 500000015 499999984 499999983 499999982 500000019 500000020 500000021 500000022 500000023 499999976 499999975 500000026 500000027 499999972 500000029 5...

output:

1000099763

result:

ok single line: '1000099763'

Test #72:

score: 40
Accepted
time: 1255ms
memory: 114908kb

input:

49985 29
499999999 500000002 500000003 499999996 500000005 500000006 499999993 499999992 499999991 499999990 500000011 499999988 499999987 499999986 499999985 500000016 499999983 499999982 500000019 500000020 500000021 499999978 499999977 500000024 499999975 500000026 499999973 500000028 499999971 5...

output:

1000099847

result:

ok single line: '1000099847'

Test #73:

score: 40
Accepted
time: 2746ms
memory: 131968kb

input:

49940 48
500000001 500000002 500000003 499999996 499999995 500000006 499999993 500000008 500000009 500000010 499999989 499999988 500000013 499999986 500000015 499999984 499999983 500000018 499999981 499999980 499999979 499999978 500000023 500000024 499999975 500000026 499999973 499999972 499999971 4...

output:

1000099681

result:

ok single line: '1000099681'

Test #74:

score: 40
Accepted
time: 1872ms
memory: 121584kb

input:

49985 38
500049985 500049984 499950017 500049982 500049981 500049980 500049979 500049978 499950023 499950024 500049975 500049974 499950027 500049972 500049971 499950030 500049969 499950032 500049967 500049966 499950035 499950036 499950037 499950038 500049961 499950040 500049959 500049958 499950043 5...

output:

1000099850

result:

ok single line: '1000099850'

Test #75:

score: 40
Accepted
time: 2886ms
memory: 131900kb

input:

49941 50
500049941 499950060 500049939 500049938 500049937 499950064 500049935 500049934 500049933 499950068 499950069 499950070 500049929 499950072 499950073 500049926 500049925 500049924 499950077 499950078 500049921 499950080 500049919 499950082 499950083 499950084 499950085 500049914 500049913 4...

output:

1000099726

result:

ok single line: '1000099726'

Test #76:

score: 40
Accepted
time: 2918ms
memory: 131688kb

input:

49919 50
499950081 499950082 499950083 499950084 499950085 500049914 499950087 500049912 499950089 499950090 500049909 500049908 499950093 499950094 500049905 500049904 499950097 500049902 499950099 499950100 499950101 499950102 499950103 499950104 499950105 499950106 499950107 499950108 499950109 5...

output:

1000099672

result:

ok single line: '1000099672'

Test #77:

score: 40
Accepted
time: 145ms
memory: 123584kb

input:

49975 37
502348825 502998440 497351431 503697928 495252755 501549070 503347923 497401664 501349109 496352482 503897270 495852988 504846411 501199088 498001560 496852520 501298934 495104116 496453053 501548636 500199820 496902852 502847321 500949088 500849167 500299700 496803264 497152964 502547297 4...

output:

37134315836

result:

ok single line: '37134315836'

Test #78:

score: 40
Accepted
time: 147ms
memory: 125532kb

input:

49938 40
503545598 503895086 498601792 496854095 498901452 495506030 498901496 497902898 503744750 503245385 496305328 504243795 503145338 500149775 496954636 496455467 504592824 502545971 495806720 499251215 497404264 499101494 497104872 500948385 498053354 497604176 502096304 495707654 497254950 5...

output:

38819676074

result:

ok single line: '38819676074'

Test #79:

score: 40
Accepted
time: 107ms
memory: 103016kb

input:

49944 12
501698096 496953477 499150986 497253245 498801440 496404392 498651674 503895086 501747760 498851495 502596568 502396784 501597824 495955589 499650490 499600568 500748920 497853139 497503700 501248125 502246580 503893994 498102964 502396208 498801920 497454131 504742210 501797012 499600672 5...

output:

37727215760

result:

ok single line: '37727215760'

Test #80:

score: 40
Accepted
time: 143ms
memory: 131812kb

input:

49956 46
500000066 499999910 500000237 500000052 500000150 499999862 499999706 499999656 500000495 500000910 499999835 499999532 500000468 499999566 500001155 500001392 499999745 499999820 500000171 500000660 500001407 499999098 499998298 499999184 500001250 500000572 500001674 500000336 499997303 4...

output:

38801056804

result:

ok single line: '38801056804'

Test #81:

score: 40
Accepted
time: 110ms
memory: 96924kb

input:

49932 4
500000097 500000076 499999700 499999628 500000320 500000072 499999741 499999344 500000117 500000450 500000275 499998956 499999168 499998866 499999985 499998448 499999745 500001080 499999962 500001780 499999958 499999626 500000069 500001728 499998625 499998232 499998731 500001876 499998637 49...

output:

36898197128

result:

ok single line: '36898197128'

Test #82:

score: 40
Accepted
time: 70ms
memory: 90784kb

input:

49919 0
499999903 499999920 500000084 500000096 500000335 499999880 499999433 499999336 499999244 499999650 500000121 499999556 500000949 499998894 499999280 499999152 499999813 499998272 499999639 499998700 499998467 500001364 499998275 500001176 499998875 500001222 499997732 500000532 500001653 50...

output:

38023400194

result:

ok single line: '38023400194'

Test #83:

score: 40
Accepted
time: 105ms
memory: 102924kb

input:

49982 49
554203595 516917742 485998673 448238170 487204182 500961559 470230146 471889200 437362629 418978913 468897372 453498904 466766412 466148536 494419656 497420310 454410786 448161600 466962705 477584375 490572585 466682798 429987517 391622015 343251433 325809604 369705410 349590603 383369009 3...

output:

1191546489408

result:

ok single line: '1191546489408'

Test #84:

score: 40
Accepted
time: 107ms
memory: 98476kb

input:

49914 48
572536170 584618551 580424092 561788329 569890713 569404419 572008386 562105121 521108449 563688171 612834397 638707827 688453349 715794874 757707706 778462799 824881115 873221468 891959636 898560213 900704391 937450610 890611496 929532915 971568603 992046311 960364920 972233679 971592918 9...

output:

1147190454265

result:

ok single line: '1147190454265'

Test #85:

score: 40
Accepted
time: 90ms
memory: 97244kb

input:

49927 50
455014876 424956874 465732745 466272861 475055954 511715449 483321347 527676050 544906899 568202252 603901666 638044422 605850638 623340328 623566146 576087099 543079385 550616762 566396270 589182301 615717302 656972559 673827416 720230698 734164876 701554735 733903772 761602348 746086385 7...

output:

1158406459915

result:

ok single line: '1158406459915'

Test #86:

score: 0
Wrong Answer
time: 1586ms
memory: 129860kb

input:

50000 50
500025000 499975001 500024999 499975002 500024998 499975003 500024997 499975004 500024996 499975005 500024995 499975006 500024994 499975007 500024993 499975008 500024992 499975009 500024991 499975010 500024990 499975011 500024989 499975012 500024988 499975013 500024987 499975014 500024986 4...

output:

1178207275

result:

wrong answer 1st lines differ - expected: '1000049849', found: '1178207275'