Codeforces Round #380 (Div. 1, Rated, Based on Technocup 2017 – Elimination Round 2), problem: (B) Sea Battle Solution in C/C++

Hi Guys , I Just Tried to solve the Sea Battle problem , hope you might like it , please share if you’ve any better code .

typedef unsigned u;
char S[222222];u Q[222222],Qi;
int main()
u n,a,b,i,j,k;
for(i=-1,j=0;++i<n;) { //printf(“!%u \’%c\’ %u\n”,i,S[i],j); if(S[i]==’1′)j=0; else if(++j==b) {Q[Qi++]=i;j=0;} //printf(“>%u \’%c\’ %u\n”,i,S[i],j);
for(i=a-1;++i<Qi;)printf(“%u%c”,Q[i]+1,i+1!=Qi?’ ‘:’\n’);
return 0;

Leave a Reply

Your email address will not be published. Required fields are marked *