QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#22336 | #2356. Partition of Queries | ha114514ha# | AC ✓ | 45ms | 56956kb | C++20 | 3.3kb | 2022-03-09 15:35:09 | 2022-04-30 00:54:43 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string.h>
#include<queue>
#include<vector>
#include<map>
#include<bitset>
#include<set>
#include<cmath>
#include<ctime>
#include<random>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define bc(x) __builtin_popcount(x)
#define re register
#define il inline
#define pii pair<int,int>
#define pil pair<int,long long>
#define pll pair<long long,long long>
#define mem0(x) memset(x,0,sizeof(x))
#define mem0x3f(x) memset(x,0x3f,sizeof(x))
#define dbg(x) cerr<<"In Line "<< __LINE__<<" the "<<#x<<" = "<<x<<'\n';
// #pragma GCC optimize(3)
#define int long long
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
namespace IO_BUFF{
mt19937 rnd(time(0)^(ll)(new char));
int rend(int x){
return rnd()%x+1;
}
void rendom_shuffle(int *a,int len){
shuffle(a+1,a+len+1,rnd);
}
const int BS=(1<<24)+5;char Buffer[BS],*HD,*TL;
inline int gc(){
if(HD==TL) TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);
return (HD==TL)?EOF:*HD++;
}
inline int inn(){
int x,ch,s=1;while((ch=gc())<'0'||ch>'9')if(ch=='-')s=-1;x=ch^'0';
while((ch=gc())>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^'0');return x*s;
}
char ssss[19999999],tttt[20];int ssl,ttl;
inline int print(int x)
{
if(x<0)ssss[++ssl]='-',x=(-x);
if(!x) ssss[++ssl]='0';for(ttl=0;x;x/=10) tttt[++ttl]=char(x%10+'0');
for(;ttl;ttl--) ssss[++ssl]=tttt[ttl];return ssss[++ssl]='\n';
}
inline int Flush(){return fwrite(ssss+1,sizeof(char),ssl,stdout),ssl=0,0;}
int read(){
char c=getchar();int x=1;int s=0;
while(c<'0' || c>'9'){if(c=='-')x=-1;c=getchar();}
while(c>='0' && c<='9'){
s=s*10+c-'0';c=getchar();
}
return s*x;
}
}using namespace IO_BUFF;
/*namespace CFConTest{
const int mod=998244353;
inline int add(const int &x,const int &y){
return (x+y>=mod?x+y-mod:x+y);
}
inline int del(const int &x,const int &y){
return (x-y<0?x-y+mod:x-y);
}
int ksm(int x,int k){
int base=1;
while(k){
if(k&1)base=1ll*base*x%mod;
k>>=1;
x=1ll*x*x%mod;
}
return base;
}
};
using namespace CFConTest;*/
const int N=1e6+5;
int n,m,f[N];
char a[N];
int s[N],c[N],d[N],e[N],g[N];
int st[N];
double solve(int x,int y){
return ((f[x]+g[x])-(f[y]+g[y]));
}
double solp(int x,int y){
if(d[x]==d[y]){
if((f[x]+g[x])>=(f[y]+g[y]))return 1e15;
return -1e15;
}
return 1.0*((f[x]+g[x])-(f[y]+g[y]))/(d[x]-d[y]);
}
signed main(){
#ifdef newbiewzs
freopen("data.in","r",stdin);
#else
#endif
n=read();m=read();
scanf("%s",a+1);
for(int i=1;i<=n;i++){
c[i]=c[i-1];
d[i]=d[i-1];
s[i]=s[i-1];
if(a[i]=='+')d[i]++;
if(a[i]=='?')c[i]++;
if(a[i]=='?')s[i]+=d[i];
e[i]=c[i]*d[i];
g[i]=e[i]-s[i];
}
memset(f,10,sizeof(f));
f[0]=0;
int head=1,tail=0;
st[++tail]=0;
int tou=1;
for(int i=1;i<=n;i++){
while(head<tail && 1.0*c[i]*(d[st[head+1]]-d[st[head]])>solve(st[head+1],st[head]))head++;
int k=st[head];
f[i]=s[i]+m-c[i]*d[k]+f[k]+g[k];
while(head<tail && solp(i,st[tail])<solp(st[tail],st[tail-1]))tail--;
st[++tail]=i;
}
int ans=1e15;
for(int i=0;i<n;i++){
ans=min(ans,f[i]+(s[n]-s[i])-(c[n]-c[i])*d[i]);
}
cout<<ans;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 4ms
memory: 19400kb
input:
6 5 ++??+?
output:
6
result:
ok single line: '6'
Test #2:
score: 0
Accepted
time: 2ms
memory: 19148kb
input:
6 8 ++??+?
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 2ms
memory: 17992kb
input:
5 1 +++++
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 4ms
memory: 18072kb
input:
10 0 ++?+??++??
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 2ms
memory: 17944kb
input:
12 100 +?+++??+??++
output:
19
result:
ok single line: '19'
Test #6:
score: 0
Accepted
time: 5ms
memory: 18140kb
input:
1 1 ?
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 9ms
memory: 17872kb
input:
9 7 ++++++++?
output:
7
result:
ok single line: '7'
Test #8:
score: 0
Accepted
time: 3ms
memory: 18016kb
input:
9 8 ++++++++?
output:
8
result:
ok single line: '8'
Test #9:
score: 0
Accepted
time: 2ms
memory: 19124kb
input:
10 15 ++++++++??
output:
15
result:
ok single line: '15'
Test #10:
score: 0
Accepted
time: 5ms
memory: 19316kb
input:
5 3 +?+?+
output:
3
result:
ok single line: '3'
Test #11:
score: 0
Accepted
time: 4ms
memory: 18016kb
input:
10 5 +?+?+??+??
output:
10
result:
ok single line: '10'
Test #12:
score: 0
Accepted
time: 3ms
memory: 19356kb
input:
10 7 +?+?+??+??
output:
12
result:
ok single line: '12'
Test #13:
score: 0
Accepted
time: 4ms
memory: 18068kb
input:
15 4 +?+?+??+??+??+?
output:
14
result:
ok single line: '14'
Test #14:
score: 0
Accepted
time: 4ms
memory: 19748kb
input:
15 6 +?+?+??+??+??+?
output:
18
result:
ok single line: '18'
Test #15:
score: 0
Accepted
time: 3ms
memory: 19200kb
input:
19 8 +?+?+??+??+??+?++??
output:
28
result:
ok single line: '28'
Test #16:
score: 0
Accepted
time: 2ms
memory: 19156kb
input:
20 9 +?+?+??+??+??+?++???
output:
30
result:
ok single line: '30'
Test #17:
score: 0
Accepted
time: 0ms
memory: 18084kb
input:
500 100 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++++...
output:
2710
result:
ok single line: '2710'
Test #18:
score: 0
Accepted
time: 4ms
memory: 18264kb
input:
10000 100 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????++...
output:
56616
result:
ok single line: '56616'
Test #19:
score: 0
Accepted
time: 16ms
memory: 33688kb
input:
500000 3000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
17820759
result:
ok single line: '17820759'
Test #20:
score: 0
Accepted
time: 37ms
memory: 52600kb
input:
1000000 3000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
35626062
result:
ok single line: '35626062'
Test #21:
score: 0
Accepted
time: 40ms
memory: 52752kb
input:
1000000 1000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
19934461
result:
ok single line: '19934461'
Test #22:
score: 0
Accepted
time: 45ms
memory: 51868kb
input:
1000000 10000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
66661466
result:
ok single line: '66661466'
Test #23:
score: 0
Accepted
time: 31ms
memory: 53072kb
input:
1000000 30000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
117384143
result:
ok single line: '117384143'
Test #24:
score: 0
Accepted
time: 37ms
memory: 53172kb
input:
1000000 500000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...
output:
490361116
result:
ok single line: '490361116'
Test #25:
score: 0
Accepted
time: 38ms
memory: 53640kb
input:
1000000 1000000 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?...
output:
695515718
result:
ok single line: '695515718'
Test #26:
score: 0
Accepted
time: 28ms
memory: 56672kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
924
result:
ok single line: '924'
Test #27:
score: 0
Accepted
time: 21ms
memory: 55576kb
input:
1000000 69971 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
69971
result:
ok single line: '69971'
Test #28:
score: 0
Accepted
time: 25ms
memory: 56184kb
input:
1000000 275229 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
275229
result:
ok single line: '275229'
Test #29:
score: 0
Accepted
time: 32ms
memory: 55908kb
input:
1000000 275886 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
275886
result:
ok single line: '275886'
Test #30:
score: 0
Accepted
time: 21ms
memory: 53360kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
2750
result:
ok single line: '2750'
Test #31:
score: 0
Accepted
time: 27ms
memory: 51684kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
27500
result:
ok single line: '27500'
Test #32:
score: 0
Accepted
time: 14ms
memory: 55696kb
input:
1000000 0 ++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++??????????++++++++++...
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 36ms
memory: 52264kb
input:
1000000 4 +++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++...
output:
60608
result:
ok single line: '60608'
Test #34:
score: 0
Accepted
time: 34ms
memory: 56768kb
input:
1000000 1 +?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...
output:
500000
result:
ok single line: '500000'
Test #35:
score: 0
Accepted
time: 25ms
memory: 56956kb
input:
1000000 1000000 +?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?+?...
output:
705858800
result:
ok single line: '705858800'
Test #36:
score: 0
Accepted
time: 14ms
memory: 52992kb
input:
1000000 822 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
7398
result:
ok single line: '7398'
Test #37:
score: 0
Accepted
time: 13ms
memory: 51868kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
179256
result:
ok single line: '179256'
Test #38:
score: 0
Accepted
time: 29ms
memory: 56404kb
input:
1000000 0 ++++++++++??????????+++++++++++++++++++++++++++++++++++???????????????????????????????????++++++++++++++++++++????????????????????+++++++++++++++++++++++++++++++++?????????????????????????????????++++++++++++++++++++++++++++++++++++????????????????????????????????????++++????++++++++++++++...
output:
0
result:
ok single line: '0'
Test #39:
score: 0
Accepted
time: 44ms
memory: 53348kb
input:
1000000 69971 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
180870046
result:
ok single line: '180870046'
Test #40:
score: 0
Accepted
time: 22ms
memory: 51860kb
input:
1000000 69971 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
180835657
result:
ok single line: '180835657'
Test #41:
score: 0
Accepted
time: 31ms
memory: 53200kb
input:
1000000 822 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...
output:
17939203
result:
ok single line: '17939203'
Test #42:
score: 0
Accepted
time: 24ms
memory: 53252kb
input:
1000000 924 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????+...
output:
19239363
result:
ok single line: '19239363'
Test #43:
score: 0
Accepted
time: 22ms
memory: 53056kb
input:
1000000 924 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????+?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+...
output:
17839350
result:
ok single line: '17839350'
Test #44:
score: 0
Accepted
time: 23ms
memory: 53392kb
input:
1000000 822 ?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++?+?+??+??+??+?++?????++??+?+????????????...
output:
18116120
result:
ok single line: '18116120'
Test #45:
score: 0
Accepted
time: 43ms
memory: 52704kb
input:
1000000 972519 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++??...
output:
685792922
result:
ok single line: '685792922'
Test #46:
score: 0
Accepted
time: 14ms
memory: 36808kb
input:
500000 570465 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++???...
output:
261665426
result:
ok single line: '261665426'
Test #47:
score: 0
Accepted
time: 4ms
memory: 21052kb
input:
100000 74846 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++????...
output:
18660523
result:
ok single line: '18660523'
Test #48:
score: 0
Accepted
time: 5ms
memory: 19640kb
input:
2879 999609 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
999126
result:
ok single line: '999126'
Test #49:
score: 0
Accepted
time: 3ms
memory: 18156kb
input:
2879 999609 +?+?+??+??+??+?++?????++??+?+????????????+++?+?+???++?+?+++++++????++??+??+++??++++?++??+??+??+?????++++???+??++?+?++?++???++++???????+??????????++?+??+?+++???+?+???++?++?++++???++?++?????+??????+?++???++??+?++?+??+??++??++??++?+?+?+++??+??++????+?++?++?++??+?+++?+?+???+?+++?++?++++?????...
output:
999126
result:
ok single line: '999126'
Test #50:
score: 0
Accepted
time: 20ms
memory: 54256kb
input:
1000000 822 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
8220
result:
ok single line: '8220'
Test #51:
score: 0
Accepted
time: 31ms
memory: 53120kb
input:
1000000 924 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
1848000
result:
ok single line: '1848000'
Test #52:
score: 0
Accepted
time: 14ms
memory: 53124kb
input:
1000000 55 +?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+?????????+????????...
output:
2724973
result:
ok single line: '2724973'
Test #53:
score: 0
Accepted
time: 30ms
memory: 52660kb
input:
1000000 822 +++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????????????????+++++???????????????????????????????????????????????????????????????????????????????????...
output:
6485000
result:
ok single line: '6485000'
Test #54:
score: 0
Accepted
time: 23ms
memory: 52964kb
input:
1000000 55 +++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++++++++?????+++++++++++++++++++++++++++++++++++++++...
output:
1100000
result:
ok single line: '1100000'
Test #55:
score: 0
Accepted
time: 18ms
memory: 52084kb
input:
1000000 3681 ++++++++++?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...
output:
368100
result:
ok single line: '368100'
Test #56:
score: 0
Accepted
time: 21ms
memory: 52812kb
input:
1000000 73257 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++...
output:
48789162
result:
ok single line: '48789162'
Test #57:
score: 0
Accepted
time: 2ms
memory: 18140kb
input:
32 8 +??+?++??++?+??+?++?+??++??+?++?
output:
45
result:
ok single line: '45'
Test #58:
score: 0
Accepted
time: 1ms
memory: 17836kb
input:
1024 20 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+...
output:
2726
result:
ok single line: '2726'
Test #59:
score: 0
Accepted
time: 14ms
memory: 39020kb
input:
524288 1000 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+...
output:
11461382
result:
ok single line: '11461382'
Test #60:
score: 0
Accepted
time: 16ms
memory: 37788kb
input:
524288 10000 +??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??++??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++??++?+??++??+?++?+??+?++??++?+??+?++?+??++??+?++?+??+?++??++?+??...
output:
36801050
result:
ok single line: '36801050'