11507 - Bender B. Rodríguez Problem

All about problems in Volume 115. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
Estigma88
New poster
Posts: 2
Joined: Sun Oct 12, 2008 9:51 pm

11507 - Bender B. Rodríguez Problem

Post by Estigma88 » Sun Oct 12, 2008 9:59 pm

Can someone say to me if this problem has a strange case of entry?

Because I did a machine of states and it gives me wrong answer :cry:

azk84
New poster
Posts: 14
Joined: Sat Sep 13, 2008 7:50 pm
Location: Tehran
Contact:

Re: 11507-Bender B. Rodriguea Problem

Post by azk84 » Mon Oct 13, 2008 7:19 pm

I don't think that it has a strange case, because I solved it with only 4 "if"s and nothing more (We have just 4 states to consider in this problem, and other states don't change direction of wire).

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11507 - Bender B. Rodriguea Problem

Post by saiful_sust » Tue Jan 20, 2009 3:54 pm

Hi...........
Can any one help me
i get WA in this problem.........

:oops: :oops: :oops: :oops:

Code: Select all

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char ch[100009][10],a[100009];

int main()
{
	int i,L,k;
	while(scanf("%d",&L)==1 && L)
	{
		k=0;
		memset(a,0,sizeof(a));
		memset(ch,0,sizeof(ch));
		for(i=0;i<L-1;i++)
		{
			scanf("%s",ch[k++]);
			if(strcmp(ch[k-1],"No")==0)
				k--;
		}
		strcpy(a,ch[0]);
		for(i=1;i<k;i++)
		{
			//printf("start \n");
			if((strcmp(ch[i],"+z")==0 && strcmp("+z",a)==0) || 
				(strcmp(ch[i],"-z")==0 && strcmp("-z",a)==0) || 
				(strcmp(ch[i],"+y")==0 && strcmp("+y",a)==0) || 
				(strcmp(ch[i],"-y")==0 && strcmp("-y",a)==0))
			{
				strcpy(a,"-x");
				//printf("1 = %s\n",a);
			}
			else if((strcmp(ch[i],"+z")==0 && strcmp("-z",a)==0) || 
				(strcmp(ch[i],"-z")==0 && strcmp("+z",a)==0) || 
				(strcmp(ch[i],"+y")==0 && strcmp("-y",a)==0) || 
				(strcmp(ch[i],"-y")==0 && strcmp("+y",a)==0))
			{
				strcpy(a,"+x");
				//printf(" 2 = %s\n",a);
			}
			else if((strcmp(ch[i],"+x")==0 && strcmp("+x",a)==0) || 
				(strcmp(ch[i],"-x")==0 && strcmp("-x",a)==0))
			{
				strcpy(a,"+x");
				//printf(" 3 = %s\n",a);
			}
			else if(strcmp(ch[i],"No")==0)
				continue;
			else if( (strcmp(ch[i],"+z")==0) && ( (strcmp("+y",a)==0) || 
				(strcmp("-y",a)==0) || (strcmp("+x",a)==0) || 
				(strcmp("-x",a)==0 ) ))
			{
				strcpy(a,"+z");
				//printf("4 = %s\n",a);
			}
			else if(strcmp(ch[i],"-z")==0 && (strcmp("+y",a)==0 || 
				strcmp("-y",a)==0 || strcmp("+x",a)==0 || 
				strcmp("-x",a)==0) )
			{
				strcpy(a,"-z");
				//printf("5 = %s\n",a);
			}
			else if(strcmp(ch[i],"+y")==0 && (strcmp("+z",a)==0 || 
				strcmp("-z",a)==0 || strcmp("+x",a)==0 || 
				strcmp("-x",a)==0) )
			{
				strcpy(a,"+y");
				//printf("6 = %s\n",a);
			}
			else if(strcmp(ch[i],"-y")==0 && (strcmp("+z",a)==0 || 
				strcmp("-z",a)==0 || strcmp("+x",a)==0 || 
				strcmp("-x",a)==0))
			{
				strcpy(a,"-y");
				//printf("7 = %s\n",a);
			}
			else
			{
				strcpy(a,"+x");
				//printf("a = %s\n",a);
			}
		}
		printf("%s\n",a);
	}
	return 0;
}


Kneves
New poster
Posts: 1
Joined: Wed Apr 01, 2009 9:45 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by Kneves » Tue Jun 02, 2009 9:55 pm

I get WA too.
Can any one hep me...

Whats wrong?

Code: Select all

#include <stdio.h>

int main() {
	int n;
	char estado[2];
	char acao[3];

	scanf("%d", &n);

	while (n) {
		n--;
		estado[0] = '+';
		estado[1] = 'x';

		while (n--) {
			scanf("%s", acao);
			if (estado[1] == 'x' && acao[0] != 'N') {
				estado[0] = acao[0];
				estado[1] = acao[1];
			} else if (estado[1] == acao[1]) {
				if (estado[0] == acao[0]) {
					estado[0] = '-';
					estado[1] = 'x';
				} else {
					estado[0] = '+';
					estado[1] = 'x';
				}
			}
		}

		printf("%c%c\n", estado[0], estado[1]);
		scanf("%d", &n);
	}
}
Thanks!

saiful_sust
Learning poster
Posts: 97
Joined: Fri Aug 22, 2008 10:18 pm
Location: CSE.SUST.SYLHET

Re: 11507 - Bender B. Rodriguea Problem

Post by saiful_sust » Wed Jun 03, 2009 8:47 pm

PLZ
some one give me some tick test case

dubukuangye
New poster
Posts: 4
Joined: Wed Jul 14, 2010 12:54 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by dubukuangye » Mon Jul 19, 2010 4:06 am

WA?too.

IanSwartz
New poster
Posts: 6
Joined: Wed Sep 18, 2013 11:44 am

Re: 11507 - Bender B. Rodriguea Problem

Post by IanSwartz » Wed Sep 18, 2013 12:20 pm

hi, can someone look at my code, I got WA, but can't see why, thanks in advance ...

got AC, thanks brianfry
Last edited by IanSwartz on Thu Sep 19, 2013 3:13 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11507 - Bender B. Rodriguea Problem

Post by brianfry713 » Thu Sep 19, 2013 1:46 am

Input:

Code: Select all

11
-y +z +y -y No No +y -z +z +z
3
+z -z
18
+z +z +y -z +y +z No +y -z No +z +z +z -y +z +z -z
20
-y No +z +y +z -z No -y +z +y No -y No -y No No +z -y -y
14
+y -z -y -z -z +y -z +y -z No +z -y +y
5
No +y +z -z
17
+z -y -z -y -z No -y -z No +y +y -z -y No -y No
21
-z -z -z -z -y +y +y -y No -y -y -z -z +z +z +y -z +y +y +z
4
-z +z +y
7
+z +z -y No +z -y
15
No -z -z No -y +y -y No No +y +y No No +z
19
+z No -z +y -y No +z -y -z No No No +z -y -y -y +z No
17
+y +z -z -y +z No +z -z +z +z -z No No +y No +z
14
-z +y -y -y +z No +z -z +z No +z -z +z
19
+y -y -z No +z +y +y -z No -y +y +y +z No No +z +y No
17
No No +y +z No -z +z -y +y -y +z No +y -z -y No
5
No +y -y -z
15
+z -z -y +z No No -z +z -z -z -y -z +z -z
15
+z +z +z -z +z +z +z +z -z +y +z +z +y +y
18
+y -y +y +z +z -y +y No No +z -z -z -y +y No -y +y
13
No +y -y -y -y -y +y -z +z -y +z No
14
-z -z +y No -y +z +z No +y +z +z -y -y
14
+y -z -z -y -z +y -z +z +y No -y +y -y
11
-z +z +z No +y -y +z -z +y No
4
-z +y No
17
+z No +y +z +z -z -z -z -z -y +z +z -z -z +z +y
20
No -y No +z No +z +z -y -y -y +y -y -z No -y -y No -y No
16
-y -z +y No +z +y +y +z +y No +y No -y No -z
20
+y No -z No No -z -z No -y -z +z +z +z -z -z -y -y -y -y
21
+z -z -z No -y No No -y -z +y +z +z -z No -z -y -z -y No -z
12
+z No +y +y +z +y -z -z +z +z +y
10
-z -z +y No No -y +z +y -z
8
+z No +y No +y -y No
14
-z -y -z No -z +z -z +y -z -z -y +y +z
19
+y -y +z No +y +z No No +y +z -z +z -y -y -z -z +y -z
9
-z -z -z -y -z No No +y
10
-y No No +z -z +z -z No -z
9
+z No -z -z No -z +z -z
20
+y -y -z No +z +y +y -y +z +y -y No -y -y -y +y -z +y -y
14
No -y -z -y -y -y -y +z -z +z +z -y +y
6
+z +y -z No -z
14
+z +z +y -y +z +z +y No +y +z -z +y -y
9
No -z -y +y -y +z -y -y
13
-y +y -y +y +z -y +z No +z -y +y +z
3
+z -y
21
No No +y +z +y -y No -z -y +z +y +z -z +y No +z -y -z -z No
20
-y +z No -y -y +y -z +y +y -y -y -y No -z -y +y No -z -z
21
-z -z +y -z -y +y -y No -z No +y +z No -y +z +z No +z No +z
2
+z
16
+z -y +y +z -z +z +z -z +z -z -z +z No -z No
14
+y +y -y -y -z -z +z +y No +y +z -y -z
21
-z No +z +y +z No +z No +z -z +y +z +y +z -z -y -y -y -z +y
9
No +z -y -z No -y -y +y
9
No +y -y -z -y -y -y -z
17
-y +y +z -y +y No -y +y -y No +z No +z +z +z +z
14
+z No -z +z -y No +z +z +y +z No +y +z
6
+z +z -z -z -y
7
-y No +y -y -z +y
10
+z No +y +y No +y +y No +z
19
-y No No +y +y +z -z -y +y +z +y No -y -z +y -y No +y
15
+y -z -z +y +z +z +z No -y -y +z -z -z -z
20
No -z -z -z +z No +z -z -y No +z +y +y +y +y No No -z -y
3
+z +y
20
+y No +z +y +y +z -y +y -z -y No -z No -z +z -y +z -y -y
4
-y +z +z
3
-y +y
7
-z -z +z +z +z No
3
-y -z
8
-y -z No -z -y -y +y
19
+z -y -z +y -y No +y -y No -y -z -y +z -y -y -z +y -z
9
-z -y No -z -z -y +z +z
14
+y No +y +z No +z -y No No +z No -y No
16
-y No -y No +y -y No -z No +z -z No -y No -z
10
+y -y +y -y No No +z No +z
7
-z +y +z +y +z -y
3
No -z
8
No +y -y -y No +z No
13
No +z +y No +z +y +y +y -y No +y -z
19
-z No -y -y No No No No -y No No No -y No +y +z +z -y
8
+z -z No -z -z +y +y
5
+z +y -z No
5
-z -z No +y
9
-y -y +z -z +z +z -y -z
8
-z +y +y +z -z -z +z
3
+z +z
10
+y -y +z +z -y +z +z -z +z
14
-z +z -y No +y -z No +z -z No No -y -y
19
+z -z -z No No No +z +y +y -z No -z -z +z No -z +z No
9
-z -y +z +z No +y +y +z
3
-y +y
9
+z -y -z -y +z +y +y +z
13
-y +z -z -y -y -z +z +z -y +y -z +z
16
-y -y -z -y -y No -y +y No +z +z +z -y +y -z
18
-y No +y +z -y +y No -z +z -y -z +y +y +z -z -z No
3
+z No
12
+y +z -y +z -y +y No No -z No +y
14
-z +z +z No No +y No -z No -z -y -y No
20
-y -y +y -y No +z No +y No -y -y +z +y No +z -y -y -y +z
5
No +z -y -y
4
+y +z +y
0
AC output:

Code: Select all

+z
+x
+x
-z
+x
+y
-x
+y
+y
+x
-y
-x
-y
-x
-z
-y
-z
+z
-z
+y
+y
-y
-z
+z
-z
+y
-z
-y
+x
+x
+x
-x
+z
+x
+z
+y
-y
-x
-y
-y
-z
-x
-x
+x
+z
+y
-x
+y
+z
+z
-y
-y
-y
-x
-x
+y
-y
+x
-x
-x
-z
+x
+z
+x
-y
+x
+z
-y
-x
-y
-z
-x
+x
-x
+x
-z
-y
+y
+z
+x
+x
-y
-y
-z
-x
+y
-z
+x
-x
+x
+y
+y
-z
+z
+z
+y
-z
-z
+z
-x
Check input and AC output for thousands of problems on uDebug!

Kenpachi24
New poster
Posts: 20
Joined: Wed Oct 30, 2013 7:06 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by Kenpachi24 » Fri Feb 07, 2014 9:40 am

According to the image, means that the tube belonging to axis z, if fits the following position:

Code: Select all

 \ 
  \ 
   \ 
    \ 
Attachments
problema.jpg
problema.jpg (19.68 KiB) Viewed 2601 times

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by uDebug » Thu Apr 03, 2014 1:24 pm

brianfry713,

Thanks very much for the test cases.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by uDebug » Thu Apr 03, 2014 1:26 pm

Kenpachi24 wrote:According to the image, means that the tube belonging to axis z, if fits the following position:
What are you talking about? The example that's given in the problem? Your question or what you need help on is not really clear.

I've attempted to draw out the example step by step so that things are clear.

This is how the rod (in red) looks in the initial state. Note that it has length 3.

Image

Now, after the first bend (at 2), in the +y direction, the rod looks like so.

Image

Finally, after the second bend (at 1), in the -y direction, the rod is in this position.

Image

Indeed, this is similar to the image given in the problem description.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

facug91
New poster
Posts: 6
Joined: Sat Apr 26, 2014 10:32 pm

Re: 11507 - Bender B. Rodriguea Problem

Post by facug91 » Fri May 02, 2014 9:42 pm

Kenpachi24 wrote:According to the image, means that the tube belonging to axis z, if fits the following position:

Code: Select all

 \ 
  \ 
   \ 
    \ 
I understood what you wanted to say, but the problem is that you have to think in 3D. The test case for what you wanted to draw is:
3
+z +y

And the answer is +z, but the image is wrong. The last segment keep having the same direction, doesn't matter if you bend it or not to +y or -y axis, at least yo move it through the z axis again. I don't know how to draw it, but that's the problem, you have to think tridimensionally.

Post Reply

Return to “Volume 115 (11500-11599)”