SPOON - Editorial

PROBLEM LINKS

Practice
Contest

DIFFICULTY

HARD!! // Actually it is CAKEWALK !! Nice Scare :smiley:

EXPLANATION

This was the easiest problem of the set. All one had to do is to examine all start positions (i,j) and make one horizontal check for 5 consecutive characters and one vertical scan. Refer to setter’s or testers solution for a reference. Somethings to take care of :

  • Match performed should be case-insensitive.
  • Beware of boundaries. Check (i,j) for horizontal match only if there are 5 or more characters. Same for vertical.
  • Be sure not to go out of the boundary - off by 1 errors are common.

SETTER’S SOLUTION

Can be found here.

TESTER’S SOLUTION

Can be found here.

I’m lucky I didn’t participate in that contest

DIFFICULTY
HARD

EXPLANATION
This was the easiest problem of the set.

Just kidding :wink: Please, fix the difficulty (I’m not sure about difficulty levels, cakewalk?)

4 Likes

“I’m lucky I didn’t participated in that contest”
-lol :smiley:

plz tell me where i am wrong
#include <stdio.h>
#include<string.h>
#include<ctype.h>
int main(void) {
// your code goes here
int t,r,c,i,j;
char m[101][101];
scanf("%d",&t);
while(t–)
{
scanf("%d%d",&r,&c);
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
scanf("%c",m[i][j]);
}
int flag=0;
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if((m[i][j]==‘s’ ||m[i][j]==‘S’) && j+4<c )
{
if((m[i][j+1]==‘P’ ||m[i][j+1]==‘p’) && (m[i][j+2]==‘O’ || m[i][j+2]==‘0’)&&(m[i][j+3]==‘O’ || m[i][j+3]==‘0’)&&(m[i][j+4]==‘N’||m[i][j+4]==‘n’))
{
flag=1;
break;
}}
if((m[i][j]==‘s’ ||m[i][j]==‘S’) && i+4<r )
{
if((m[i+1][j]==‘P’ ||m[i+1][j]==‘p’) && (m[i+2][j]==‘O’ || m[i+2][j]==‘0’)&&(m[i+3][j]==‘O’ || m[i+3][j]==‘0’)&&(m[i+4][j]==‘N’||m[i+4][j]==‘n’))
{
flag=1;
break;
}}
}
if(flag)
break;
}
if(flag==1){
printf(“There is a spoon!\n”);}
else{
printf(“There is indeed no spoon!\n”);
}}
return 0;
}

link text
someone please check my solution as to why i am getting wrong answer for it

Please someone give me some reputation to vote :).

1 Like

https://www.codechef.com/viewsolution/17406291

why am i getting WA??? Also can someone share how much did you take to solve this