QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#647591 | #6841. Occupy the Cities | N_z_ | AC ✓ | 14ms | 12172kb | C++23 | 6.7kb | 2024-10-17 14:49:27 | 2024-10-17 14:49:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct time_helper{
#ifdef LOCAL
clock_t time_last;time_helper(){time_last=clock();}void test(){auto time_now=clock();std::cerr<<"time:"<<1.*(time_now-time_last)/CLOCKS_PER_SEC<<";all_time:"<<1.*time_now/CLOCKS_PER_SEC<<std::endl;time_last=time_now;}~time_helper(){test();}
#else
void test(){}
#endif
}time_helper;
#ifdef LOCAL
#include"dbg.h"
#else
#define dbg(...) (__VA_ARGS__)
#endif
namespace Fread{const int SIZE=1<<16;char buf[SIZE],*S,*T;inline char getchar(){if(S==T){T=(S=buf)+fread(buf,1,SIZE,stdin);if(S==T)return'\n';}return *S++;}}namespace Fwrite{const int SIZE=1<<16;char buf[SIZE],*S=buf,*T=buf+SIZE;inline void flush(){fwrite(buf,1,S-buf,stdout);S=buf;}inline void putchar(char c){*S++=c;if(S==T)flush();}struct NTR{~NTR(){flush();}}ztr;}
#define getchar Fread::getchar
#define putchar Fwrite::putchar
int print_precision=10;bool print_T_endl=1;char print_between=' ';
template<typename T>struct is_char{static constexpr bool value=(std::is_same<T,char>::value||std::is_same<T,signed char>::value||std::is_same<T,unsigned char>::value);};template<typename T>struct is_integral_ex{static constexpr bool value=(std::is_integral<T>::value||std::is_same<T,__int128>::value)&&!is_char<T>::value;};template<typename T>struct is_floating_point_ex{static constexpr bool value=std::is_floating_point<T>::value||std::is_same<T,__float128>::value;};namespace Fastio{struct Reader;struct Writer;template<size_t id>struct read_tuple{template<typename...T>static void read(Reader&stream,std::tuple<T...>&x){read_tuple<id-1>::read(stream,x);stream>>get<id-1>(x);}};template<>struct read_tuple<0>{template<typename...T>static void read([[maybe_unused]]Reader&stream,[[maybe_unused]]std::tuple<T...>&x){}};template<size_t id>struct print_tuple{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){print_tuple<id-1>::print(stream,x);putchar(print_between);stream<<get<id-1>(x);}};template<>struct print_tuple<1>{template<typename...T>static void print(Writer&stream,const std::tuple<T...>&x){stream<<get<0>(x);}};template<>struct print_tuple<0>{template<typename...T>static void print([[maybe_unused]]Writer&stream,[[maybe_unused]]const std::tuple<T...>&x){}};
struct Reader{template<typename T>typename std::enable_if_t<std::is_class<T>::value,Reader&>operator>>(T&x){for(auto &y:x)*this>>y;return *this;}template<typename...T>Reader&operator>>(std::tuple<T...>&x){read_tuple<sizeof...(T)>::read(*this,x);return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1;while(c<'0'||c>'9'){if(c=='-')f*=-1;c=getchar();}x=0;while(c>='0'&&c<='9'){x=(x<<1)+(x<<3)+(c^48);c=getchar();}x*=f;return *this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Reader&>operator>>(T&x){char c=getchar();short f=1,s=0;x=0;T t=0;while((c<'0'||c>'9')&&c!='.'){if(c=='-')f*=-1;c=getchar();}while(c>='0'&&c<='9'&&c!='.')x=x*10+(c^48),c=getchar();if(c=='.')c=getchar();else return x*=f,*this;while(c>='0'&&c<='9')t=t*10+(c^48),s++,c=getchar();while(s--)t/=10.0;x=(x+t)*f;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Reader&>operator>>(T&c){c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();return *this;}Reader&operator>>(char*str){int len=0;char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str[len++]=c,c=getchar();str[len]='\0';return*this;}template<typename T1,typename T2>Reader&operator>>(std::pair<T1,T2>&x){*this>>x.first>>x.second;return *this;}Reader&operator>>(std::string&str){str.clear();char c=getchar();while(c=='\n'||c==' '||c=='\r')c=getchar();while(c!='\n'&&c!=' '&&c!='\r')str.push_back(c),c=getchar();return*this;}Reader(){}}cin;const char endl='\n';
struct Writer{typedef __int128 mxdouble;template<typename T>typename std::enable_if_t<std::is_class<T>::value,Writer&>operator<<(const T&x){for(auto q:x){*this<<q;if(!is_class<decltype(q)>::value)*this<<print_between;}if(!is_class<typename T::value_type>::value&&print_T_endl)*this<<'\n';return *this;}template<typename...T>Writer&operator<<(const std::tuple<T...>&x){print_tuple<sizeof...(T)>::print(*this,x);if(print_T_endl)*this<<'\n';return *this;}template<typename T>typename std::enable_if_t<is_integral_ex<T>::value,Writer&>operator<<(T x){if(x==0)return putchar('0'),*this;if(x<0)putchar('-'),x=-x;static int sta[45];int top=0;while(x)sta[++top]=x%10,x/=10;while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_floating_point_ex<T>::value,Writer&>operator<<(T x){if(x<0)putchar('-'),x=-x;x+=pow(10,-print_precision)/2;mxdouble _=x;x-=(T)_;static int sta[45];int top=0;while(_)sta[++top]=_%10,_/=10;if(!top)putchar('0');while(top)putchar(sta[top]+'0'),--top;putchar('.');for(int i=0;i<print_precision;i++)x*=10;_=x;while(_)sta[++top]=_%10,_/=10;for(int i=0;i<print_precision-top;i++)putchar('0');while(top)putchar(sta[top]+'0'),--top;return*this;}template<typename T>typename std::enable_if_t<is_char<T>::value,Writer&>operator<<(const T&c){putchar(c);return*this;}Writer&operator<<(char*str){int cur=0;while(str[cur])putchar(str[cur++]);return *this;}Writer&operator<<(const char*str){int cur=0;while(str[cur])putchar(str[cur++]);return*this;}template<typename T1,typename T2>Writer&operator<<(const std::pair<T1,T2>&x){*this<<x.first<<print_between<<x.second;if(print_T_endl)*this<<'\n';return *this;}Writer&operator<<(const std::string&str){int st=0,ed=str.size();while(st<ed)putchar(str[st++]);return*this;}Writer(){}}cout;}
#define cin Fastio::cin
#define cout Fastio::cout
#define endl Fastio::endl
template<class Fun>class y_combinator_result{Fun fun_;public:template<class T>explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}template<class ...Args>decltype(auto) operator()(Args &&...args){return fun_(std::ref(*this), std::forward<Args>(args)...);}};template<class Fun>decltype(auto) y_combinator(Fun &&fun){return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));}
void init();void solve(int tc);
main()
{
init();int t=1;
cin>>t;
for(int tc=1;tc<=t;tc++)solve(tc);
}
void init()
{
}
constexpr int inf=1e9;
void solve([[maybe_unused]]int tc)
{
int n;
string s;
cin>>n>>s;
s=' '+s;
vector<int>p;
for(int x=1;x<=n;x++)
if(s[x]=='1')p.emplace_back(x);
vector<array<int,2>>dp(p.size());
dp[0]={p[0]-1,p[0]>1?p[0]:0};
for(int x=1;x<p.size();x++)
{
int len=p[x]-p[x-1]-1;
if(!len)dp[x][0]=dp[x][1]=min(dp[x-1][0],dp[x-1][1]);
else dp[x][0]=min(max(dp[x-1][0],len/2+1),max(dp[x-1][1],(len+1)/2)),dp[x][1]=min(max(dp[x-1][0],(len+1)/2+1),max(dp[x-1][1],len/2+1));
}
cout<<min(max(dp.back()[0],n-p.back()+1),max(dp.back()[1],n-p.back()))<<endl;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
5 3 010 4 0100 7 0001000 5 11111 6 010101
output:
2 2 4 0 1
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
2036 1 1 2 01 2 10 2 11 3 001 3 010 3 011 3 100 3 101 3 110 3 111 4 0001 4 0010 4 0011 4 0100 4 0101 4 0110 4 0111 4 1000 4 1001 4 1010 4 1011 4 1100 4 1101 4 1110 4 1111 5 00001 5 00010 5 00011 5 00100 5 00101 5 00110 5 00111 5 01000 5 01001 5 01010 5 01011 5 01100 5 01101 5 01110 5 01111 5 10000 5...
output:
0 1 1 0 2 2 1 2 1 1 0 3 2 2 2 1 1 1 3 1 1 1 2 1 1 0 4 3 3 3 2 2 2 3 2 2 1 2 1 1 1 4 2 2 1 2 1 1 1 3 1 1 1 2 1 1 0 5 4 4 3 3 3 3 3 2 2 2 2 2 2 2 4 2 2 2 2 1 1 1 3 1 1 1 2 1 1 1 5 2 2 2 2 1 1 1 3 1 1 1 2 1 1 1 4 2 2 1 2 1 1 1 3 1 1 1 2 1 1 0 6 5 5 4 4 4 4 4 3 3 3 3 3 3 3 4 2 2 2 2 2 2 2 3 2 2 2 2 2 2 ...
result:
ok 2036 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 3740kb
input:
1000 100 1011100101100000101100001011101111011001011101100011010110100101110011010111011101100111100010010101 100 0001001110011011010011111011001110001011010001111110111001100000001111000110101001000101000011000110 100 011011010100100100011000110111011111100100101100010000011101011110001000010011011...
output:
3 4 3 4 4 3 4 5 4 3 3 3 3 2 5 3 3 3 3 3 2 4 3 3 3 3 4 3 2 3 6 5 3 3 3 5 2 3 2 3 2 3 5 4 3 3 3 5 3 3 3 2 3 5 3 2 2 3 4 3 3 4 4 3 5 3 5 4 4 2 5 3 3 4 3 3 3 3 3 3 4 3 4 3 3 6 4 4 9 3 3 2 5 2 4 4 2 4 3 3 4 3 2 5 3 5 3 4 3 2 3 2 3 3 4 3 3 4 3 2 3 3 4 3 3 4 4 3 3 4 3 4 3 3 4 5 3 3 3 4 6 4 3 4 3 3 3 4 4 4 ...
result:
ok 1000 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 3936kb
input:
100 1000 101001000101110101101100110011101110001111000111000101100011110111111000000110110110000101100110010000010100011110011101111000110101010001101010101101111101111101010001101100011110000000000010011000000010010101001001100001010011011101110111100010000110001110011010000110000001101011000100010...
output:
6 5 4 5 4 5 4 5 5 5 4 5 6 5 4 4 5 5 4 5 5 6 5 5 4 5 5 7 4 7 5 5 8 6 4 4 5 3 5 5 4 4 5 7 6 5 7 6 4 7 5 5 5 4 4 5 4 4 5 4 6 4 5 4 5 4 6 6 6 4 10 5 5 5 4 4 6 5 5 7 6 4 5 5 6 6 6 7 4 4 4 5 6 5 6 4 5 6 5 3
result:
ok 100 lines
Test #5:
score: 0
Accepted
time: 2ms
memory: 3964kb
input:
1 100000 000101101111111110101100100000101111001010100001111011111000110000110111101101010110010111000000101010001011110001100110110001010000010010000010100100000000001101110110101101001010110111001010100110100111111101000110100111011111101011101100110001011000000000011111011100111110100100100010101...
output:
8
result:
ok single line: '8'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3992kb
input:
1 100000 011010011100000110100111110110111110011001001000000111111100011100110010001110000111111010100110000111000100000001010010100110111001010010100111000000000111110101011101000001010100111100001110010101111100011000001011000111010111110010001111000011101100011110111100010101100010111101010001110...
output:
8
result:
ok single line: '8'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
1000 100 0000000000100010000000001100000000000010010101000010000000000000000000000010010000000000110000000010 100 0000000000000000000000000000000100000000000000000000001100000110000000000000010000010000100101000000 100 000010000000000000000000000000000000000000000000000000000010000000000000000000000...
output:
12 31 27 16 14 27 14 42 13 10 23 16 12 11 28 24 20 15 17 10 23 23 7 22 15 21 12 22 16 12 10 8 19 19 27 13 15 10 10 17 20 23 10 6 28 12 36 12 22 20 14 12 14 11 32 12 9 14 20 12 11 27 12 8 13 11 11 13 13 18 7 12 16 15 21 13 13 27 19 8 20 13 12 15 32 29 17 11 27 17 19 12 23 10 10 23 13 9 9 20 10 15 30 ...
result:
ok 1000 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
1000 100 1000000010000100000000000000000001100000011000000100100000000000110000000100100000000000001000000100 100 0000000000000010011000000010000010000000000000000000000000000000100100000100000000000010000000000000 100 000000010010000000000000001000000000000000000000010000001001000001000001000000010...
output:
10 16 20 17 15 15 19 16 12 21 32 11 43 23 17 14 16 20 9 8 14 40 13 9 13 13 41 13 10 13 18 29 15 22 11 7 17 10 31 13 11 27 15 13 32 19 14 12 19 10 27 16 14 22 23 12 18 14 18 12 13 18 48 18 9 11 13 19 11 40 19 17 10 11 15 11 10 24 9 19 10 22 18 24 14 20 11 10 21 16 11 21 16 13 16 45 26 12 14 10 11 14 ...
result:
ok 1000 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
1000 100 0000000000100000001000000000000000010000000000010000000010100000000000000000000000101000000000000001 100 0000000000010000000000000001001000100000001000000000000010100001000000000000000000100000000000000000 100 000100000000000000000000010000100000000000000100000000000000000010000000100000000...
output:
12 17 11 8 15 16 22 26 22 13 17 14 15 21 10 7 10 51 14 13 22 10 40 21 34 16 16 18 12 17 14 34 22 21 11 16 15 15 14 9 11 14 8 20 25 11 19 20 14 18 42 9 14 30 9 33 18 9 12 9 20 19 17 18 17 19 13 14 32 16 14 27 18 14 17 12 9 58 34 8 30 14 16 19 16 21 13 23 28 15 33 10 11 41 19 27 24 15 11 17 18 21 14 1...
result:
ok 1000 lines
Test #10:
score: 0
Accepted
time: 5ms
memory: 5364kb
input:
1 1000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
435
result:
ok single line: '435'
Test #11:
score: 0
Accepted
time: 0ms
memory: 5184kb
input:
1 1000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
3424
result:
ok single line: '3424'
Test #12:
score: 0
Accepted
time: 9ms
memory: 7496kb
input:
1 1000000 10100100000000000000000001000000000001001000000010110000000000001000001010001100000101010010000010000001111000000110001101000000110100000010000000010000000000000000010001010000001000100100110001000100011100000011001000001000010100001000000000000010010100000001010000000000001000010000100101...
output:
28
result:
ok single line: '28'
Test #13:
score: 0
Accepted
time: 9ms
memory: 7544kb
input:
1 1000000 10001100000011000000100110010100101010100000001100000100000000001000110000000000000011000100000101000010011100000100100011100000110011110100000100001010000101001000001110000000100100111001000000001001011010001001111011000100001100000000000100001101000100000001000000001000010001100001000000...
output:
25008
result:
ok single line: '25008'
Test #14:
score: 0
Accepted
time: 8ms
memory: 7624kb
input:
1 1000000 10101101010100110100001011000000011100100010001010000000010010000100101010000001000000100011000000000000010000000001000111001101100001000011000001010110010000001000100100000000101001000010010000000010000000010110000100010000101001010000001010000000111000010011000100000000010110010100000010...
output:
50002
result:
ok single line: '50002'
Test #15:
score: 0
Accepted
time: 3ms
memory: 9692kb
input:
1 1000000 11000000011101000010000111101010011000001110000001010011000100111010010000000001000000000011111001001000111000100001000000000100110010010000001000000100100000010010000011000000100001000100001101000000110001000000110000011010110100011110001000010000101001000000100010010110110000000000000111...
output:
19
result:
ok single line: '19'
Test #16:
score: 0
Accepted
time: 11ms
memory: 9656kb
input:
1 1000000 10011000000001100001010001111011101001101110101010000001100001000100010010010001000011100101001100011110101110000000101001001000011101011000000100011100000000001001001000100000110000001000000000011000101000010010000101000110000011100100011100001011101110011001011100000100001000010000101000...
output:
50002
result:
ok single line: '50002'
Test #17:
score: 0
Accepted
time: 7ms
memory: 9680kb
input:
1 1000000 10011000000000001101000010001000000010101000001010110011000000010010001100001100010000110000000000000101000100100010011000001010001000011001010001001000001100000000000110000001010110000000100010010000000000000000100101100010000101001000010110000101010110100000001011000110000001000010000110...
output:
21
result:
ok single line: '21'
Test #18:
score: 0
Accepted
time: 4ms
memory: 10892kb
input:
1 1000000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
150000
result:
ok single line: '150000'
Test #19:
score: 0
Accepted
time: 7ms
memory: 11096kb
input:
1 1000000 11010010111111011011011111000111011110010111101010011110101010111001100110111101001111101011101111010011110101001011110110111111110100010111010101100011011001111111111001100110110101011111001110110011011110011110110101011000010011011010111100111011101111011111110111110110111001111000110011...
output:
100000
result:
ok single line: '100000'
Test #20:
score: 0
Accepted
time: 8ms
memory: 10980kb
input:
1 1000000 11011001111110011111111100010101111111010100010010101111010000011110010101011001011010101001101100001001100011011000100100001101100100110100001000000100100111100110010111100010100110100011001101001111011010001000001010001111100001110011000010000110010100011000001110011101111010000111100001...
output:
50003
result:
ok single line: '50003'
Test #21:
score: 0
Accepted
time: 12ms
memory: 12148kb
input:
1 1000000 10100110111101111110101011000111101110011111011110101001010110101011011101011100011111011111111011010111001101111100001011111011100010110100011001110011100000011011101111011110110011001000010011111111110101001110110111111101010010100110110111001101010100101111011011010111110110011101111010...
output:
50002
result:
ok single line: '50002'
Test #22:
score: 0
Accepted
time: 8ms
memory: 12016kb
input:
1 1000000 11111111110100101111101000101101100010010111101101001001100011111001111010101100001000011010000010011101111100100110011101101011010110110001110111111011001111110010110010101111100110010000001010010110010111110101001001001111011101111110111011100011110101010111111110110110111101111111011111...
output:
40000
result:
ok single line: '40000'
Test #23:
score: 0
Accepted
time: 4ms
memory: 12084kb
input:
1 1000000 11110001001000011010011010100100011101100001111111111011111001011110110010010010010010111010101001001101100111000110001111011111101111101010111111110111101101111000110110011101111000001011100111100100000010001101010011001000110111011110010101000110011010101101010101000010010110101111011100...
output:
30001
result:
ok single line: '30001'
Test #24:
score: 0
Accepted
time: 4ms
memory: 12080kb
input:
1 1000000 11110001011010110101101101101001101100110001101000011100010010101010110000000111111010011101001110100001100011010111101000110110011000100100000001101110010011000111011110100100011011011101110001011010001011100000110110100000011010001111011111111000010000011000100101101000110000000001100101...
output:
20000
result:
ok single line: '20000'
Test #25:
score: 0
Accepted
time: 14ms
memory: 11976kb
input:
1 1000000 11110110100100101100010010101101010011010011000110111100000101011101000000110010101110100100101110111101001100010111010000110010100010101111001100111111100101100110111001100101000010011011011100111000011001001110110010110001001011110100010100111100101001101001010110011001011101011110111111...
output:
10000
result:
ok single line: '10000'
Test #26:
score: 0
Accepted
time: 7ms
memory: 12172kb
input:
1 1000000 10110110111011101100011011010100100110011110101101000100010110011111001110111100010111100101001101101111100101010100110011101000101101000010100100110101110001010100011011111001001011011110111010000000101100100010010100110010001101010110010011111101101111011011111000101100010100111001110111...
output:
5002
result:
ok single line: '5002'
Test #27:
score: 0
Accepted
time: 14ms
memory: 12148kb
input:
1 1000000 11011000001110011101010011011111101111000101001101000111000111000000110000000001000010001101110000110110101010011110110100011001101000010010101011000101000101111111011010100011010100000011101101010011110010100000111111010010011101010011100101001001011011011001111001111000110001101111001000...
output:
10
result:
ok single line: '10'
Test #28:
score: 0
Accepted
time: 1ms
memory: 3916kb
input:
1 100000 111110101000100010100110001101001111100000100010101001000000110111110010011111110011001100010100101001000000110010110110001001110001100000000110000000001110100000010001111010000001100011110111111100100010100111100101001100110011110100011011100111111000101110101101000011101011101111110001010...
output:
50000
result:
ok single line: '50000'
Test #29:
score: 0
Accepted
time: 10ms
memory: 8120kb
input:
1 1000000 10100000111001011000001111001101011111100001011101011001110001000001111011001101000110111010000111100011111100001100111101101001101101111010111110011100001111100100101100101000000110000110001101011000011100000111001001111100100000011011000101100001000000111001101010000010111000110100101100...
output:
500001
result:
ok single line: '500001'
Test #30:
score: 0
Accepted
time: 9ms
memory: 8124kb
input:
1 1000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
500002
result:
ok single line: '500002'
Test #31:
score: 0
Accepted
time: 0ms
memory: 4284kb
input:
1 500000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
146513
result:
ok single line: '146513'
Test #32:
score: 0
Accepted
time: 6ms
memory: 10224kb
input:
1 1000000 11111010101001011110111001010011100110100111111101110101110110111010010001111111001101111100010011111111011011001101011001101001101111010010111111110110111011101011010001001011000010110110101011110111111011101111001010100011011110111110111110100111101010110010111101111100111111011111110110...
output:
500000
result:
ok single line: '500000'
Test #33:
score: 0
Accepted
time: 10ms
memory: 10164kb
input:
1 1000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
output:
500000
result:
ok single line: '500000'