QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#28221#2356. Partition of QueriesWu_RenAC ✓23ms44440kbC++17821b2022-04-12 20:21:262022-04-29 09:17:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-29 09:17:20]
  • 评测
  • 测评结果:AC
  • 用时:23ms
  • 内存:44440kb
  • [2022-04-12 20:21:26]
  • 提交

answer

#include <bits/stdc++.h>
typedef long long ll;
typedef __int128 lll; 
using namespace std;
int n,m,y,suf[1000010],a[1000010],l,r,q[1000010];
ll f[1000010],sufi[1000010],X[1000010],Y[1000010];
char s[1000010];
int main(){
	scanf("%d%d%s",&n,&y,s+1);
	for(int i=1,j=0;i<=n;i++){
		if(s[i]=='?') a[++m]=j,j=0;
		else j++;
	}
	a[++m]=0;
	n=m;
	for(int i=n;i>=1;i--){
		suf[i]=suf[i+1]+a[i];
		sufi[i]=sufi[i+1]+a[i]*(n-i+1ll); 
	}
	f[0]=0;
	l=1,r=0;
	for(int i=1;i<=n;i++){
		f[i]=1e18;
		Y[i]=f[i-1]+sufi[i]-(1ll+n)*suf[i],X[i]=-suf[i];
		while(l<r&&(X[q[r-1]]-X[i])*(Y[q[r]]-Y[i])-(Y[q[r-1]]-Y[i])*(X[q[r]]-X[i])<=0) r--;
		q[++r]=i;
		while(l<r&&(Y[q[l+1]]-Y[q[l]])<=i*(X[q[l+1]]-X[q[l]])) l++;
		f[i]=Y[q[l]]-i*X[q[l]];
		f[i]+=y-(i-1ll-n)*suf[i+1]-sufi[i+1];
	}
	printf("%lld\n",f[n]-y);
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 18116kb

input:

6 5
++??+?

output:

6

result:

ok single line: '6'

Test #2:

score: 0
Accepted
time: 0ms
memory: 16140kb

input:

6 8
++??+?

output:

7

result:

ok single line: '7'

Test #3:

score: 0
Accepted
time: 3ms
memory: 18116kb

input:

5 1
+++++

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 2ms
memory: 16080kb

input:

10 0
++?+??++??

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 18104kb

input:

12 100
+?+++??+??++

output:

19

result:

ok single line: '19'

Test #6:

score: 0
Accepted
time: 3ms
memory: 16084kb

input:

1 1
?

output:

0

result:

ok single line: '0'

Test #7:

score: 0
Accepted
time: 3ms
memory: 18120kb

input:

9 7
++++++++?

output:

7

result:

ok single line: '7'

Test #8:

score: 0
Accepted
time: 2ms
memory: 18188kb

input:

9 8
++++++++?

output:

8

result:

ok single line: '8'

Test #9:

score: 0
Accepted
time: 2ms
memory: 16008kb

input:

10 15
++++++++??

output:

15

result:

ok single line: '15'

Test #10:

score: 0
Accepted
time: 2ms
memory: 18184kb

input:

5 3
+?+?+

output:

3

result:

ok single line: '3'

Test #11:

score: 0
Accepted
time: 2ms
memory: 16080kb

input:

10 5
+?+?+??+??

output:

10

result:

ok single line: '10'

Test #12:

score: 0
Accepted
time: 2ms
memory: 18148kb

input:

10 7
+?+?+??+??

output:

12

result:

ok single line: '12'

Test #13:

score: 0
Accepted
time: 1ms
memory: 16076kb

input:

15 4
+?+?+??+??+??+?

output:

14

result:

ok single line: '14'

Test #14:

score: 0
Accepted
time: 2ms
memory: 18024kb

input:

15 6
+?+?+??+??+??+?

output:

18

result:

ok single line: '18'

Test #15:

score: 0
Accepted
time: 2ms
memory: 18104kb

input:

19 8
+?+?+??+??+??+?++??

output:

28

result:

ok single line: '28'

Test #16:

score: 0
Accepted
time: 6ms
memory: 18128kb

input:

20 9
+?+?+??+??+??+?++???

output:

30

result:

ok single line: '30'

Test #17:

score: 0
Accepted
time: 1ms
memory: 15980kb

input:

500 100
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++++...

output:

2710

result:

ok single line: '2710'

Test #18:

score: 0
Accepted
time: 2ms
memory: 18196kb

input:

10000 100
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++...

output:

56616

result:

ok single line: '56616'

Test #19:

score: 0
Accepted
time: 12ms
memory: 24744kb

input:

500000 3000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...

output:

17820759

result:

ok single line: '17820759'

Test #20:

score: 0
Accepted
time: 18ms
memory: 34772kb

input:

1000000 3000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...

output:

35626062

result:

ok single line: '35626062'

Test #21:

score: 0
Accepted
time: 4ms
memory: 33884kb

input:

1000000 1000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...

output:

19934461

result:

ok single line: '19934461'

Test #22:

score: 0
Accepted
time: 12ms
memory: 35596kb

input:

1000000 10000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...

output:

66661466

result:

ok single line: '66661466'

Test #23:

score: 0
Accepted
time: 22ms
memory: 32900kb

input:

1000000 30000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...

output:

117384143

result:

ok single line: '117384143'

Test #24:

score: 0
Accepted
time: 10ms
memory: 34104kb

input:

1000000 500000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...

output:

490361116

result:

ok single line: '490361116'

Test #25:

score: 0
Accepted
time: 19ms
memory: 32092kb

input:

1000000 1000000
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?...

output:

695515718

result:

ok single line: '695515718'

Test #26:

score: 0
Accepted
time: 23ms
memory: 32820kb

input:

1000000 924
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

924

result:

ok single line: '924'

Test #27:

score: 0
Accepted
time: 9ms
memory: 30480kb

input:

1000000 69971
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

69971

result:

ok single line: '69971'

Test #28:

score: 0
Accepted
time: 6ms
memory: 30976kb

input:

1000000 275229
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

275229

result:

ok single line: '275229'

Test #29:

score: 0
Accepted
time: 10ms
memory: 29388kb

input:

1000000 275886
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

275886

result:

ok single line: '275886'

Test #30:

score: 0
Accepted
time: 10ms
memory: 30840kb

input:

1000000 55
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

2750

result:

ok single line: '2750'

Test #31:

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

input:

1000000 55
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

27500

result:

ok single line: '27500'

Test #32:

score: 0
Accepted
time: 4ms
memory: 32780kb

input:

1000000 0
++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++...

output:

0

result:

ok single line: '0'

Test #33:

score: 0
Accepted
time: 9ms
memory: 29288kb

input:

1000000 4
+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++...

output:

60608

result:

ok single line: '60608'

Test #34:

score: 0
Accepted
time: 11ms
memory: 32776kb

input:

1000000 1
+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...

output:

500000

result:

ok single line: '500000'

Test #35:

score: 0
Accepted
time: 6ms
memory: 31100kb

input:

1000000 1000000
+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...

output:

705858800

result:

ok single line: '705858800'

Test #36:

score: 0
Accepted
time: 9ms
memory: 28684kb

input:

1000000 822
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

7398

result:

ok single line: '7398'

Test #37:

score: 0
Accepted
time: 4ms
memory: 29392kb

input:

1000000 924
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

179256

result:

ok single line: '179256'

Test #38:

score: 0
Accepted
time: 13ms
memory: 31264kb

input:

1000000 0
++++++++++??????????+++++++++++++++++++++++++++++++++++???????????????????????????????????++++++++++++++++++++????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++++++++++++????????????????????????????????????++++????++++++++++++++...

output:

0

result:

ok single line: '0'

Test #39:

score: 0
Accepted
time: 13ms
memory: 29748kb

input:

1000000 69971
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...

output:

180870046

result:

ok single line: '180870046'

Test #40:

score: 0
Accepted
time: 12ms
memory: 30808kb

input:

1000000 69971
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...

output:

180835657

result:

ok single line: '180835657'

Test #41:

score: 0
Accepted
time: 19ms
memory: 31080kb

input:

1000000 822
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...

output:

17939203

result:

ok single line: '17939203'

Test #42:

score: 0
Accepted
time: 20ms
memory: 29948kb

input:

1000000 924
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...

output:

19239363

result:

ok single line: '19239363'

Test #43:

score: 0
Accepted
time: 12ms
memory: 32792kb

input:

1000000 924
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+...

output:

17839350

result:

ok single line: '17839350'

Test #44:

score: 0
Accepted
time: 17ms
memory: 33012kb

input:

1000000 822
?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????...

output:

18116120

result:

ok single line: '18116120'

Test #45:

score: 0
Accepted
time: 10ms
memory: 29516kb

input:

1000000 972519
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...

output:

685792922

result:

ok single line: '685792922'

Test #46:

score: 0
Accepted
time: 13ms
memory: 22920kb

input:

500000 570465
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...

output:

261665426

result:

ok single line: '261665426'

Test #47:

score: 0
Accepted
time: 3ms
memory: 18396kb

input:

100000 74846
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...

output:

18660523

result:

ok single line: '18660523'

Test #48:

score: 0
Accepted
time: 2ms
memory: 16088kb

input:

2879 999609
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...

output:

999126

result:

ok single line: '999126'

Test #49:

score: 0
Accepted
time: 2ms
memory: 16032kb

input:

2879 999609
+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...

output:

999126

result:

ok single line: '999126'

Test #50:

score: 0
Accepted
time: 18ms
memory: 42224kb

input:

1000000 822
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

8220

result:

ok single line: '8220'

Test #51:

score: 0
Accepted
time: 4ms
memory: 38432kb

input:

1000000 924
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

1848000

result:

ok single line: '1848000'

Test #52:

score: 0
Accepted
time: 18ms
memory: 41676kb

input:

1000000 55
+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+????????...

output:

2724973

result:

ok single line: '2724973'

Test #53:

score: 0
Accepted
time: 21ms
memory: 43772kb

input:

1000000 822
+++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????...

output:

6485000

result:

ok single line: '6485000'

Test #54:

score: 0
Accepted
time: 4ms
memory: 18864kb

input:

1000000 55
+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++...

output:

1100000

result:

ok single line: '1100000'

Test #55:

score: 0
Accepted
time: 14ms
memory: 44440kb

input:

1000000 3681
++++++++++?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

368100

result:

ok single line: '368100'

Test #56:

score: 0
Accepted
time: 11ms
memory: 25188kb

input:

1000000 73257
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...

output:

48789162

result:

ok single line: '48789162'

Test #57:

score: 0
Accepted
time: 2ms
memory: 16008kb

input:

32 8
+??+?++??++?+??+?++?+??++??+?++?

output:

45

result:

ok single line: '45'

Test #58:

score: 0
Accepted
time: 1ms
memory: 16072kb

input:

1024 20
+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+...

output:

2726

result:

ok single line: '2726'

Test #59:

score: 0
Accepted
time: 9ms
memory: 23328kb

input:

524288 1000
+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+...

output:

11461382

result:

ok single line: '11461382'

Test #60:

score: 0
Accepted
time: 5ms
memory: 23216kb

input:

524288 10000
+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??...

output:

36801050

result:

ok single line: '36801050'