10033 - Interpreter

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

Moderator: Board moderators

_.B._
Experienced poster
Posts: 160
Joined: Sat Feb 07, 2004 7:50 pm
Location: Venezuela
Contact:

Exactly!

Post by _.B._ »

Thanks daveon!
That was exactly what I was looking for!

Keep posting! :D
_.
AC/DC J
New poster
Posts: 4
Joined: Sun Sep 18, 2005 6:50 am

10033 - Interpreter - I need a multi-testcase input

Post by AC/DC J »

Can anyobdy show me a multi-testcase input? something like:

in:
2

222
222
100

222
222
100

---
out:
3

3

But, to make it clearer, i would really love if it was in the form:
2\n\n222\n100\n\n222\n100\n\n

This all is because I can't figure out the (blank) line counting on this problem, I don't know how the expected input/output format is.

The way I put above was my guess, but I get WA... well maybe i'm right but my code is the one wrong, but anyway...
AC/DC J
New poster
Posts: 4
Joined: Sun Sep 18, 2005 6:50 am

Post by AC/DC J »

Oh well.. i just got it...

just in case someone ever need the answer to that question:

input:
2\n\n100\n\n100\n
output:
1\n\n1\n\n

No more, no less :D
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Your input taking process is wrong.
Ami ekhono shopno dekhi...
HomePage
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Its tough to generate inputs manually. However, here are some random cases. U can try them.

Input:

Code: Select all

2

299
492
495
399
492
495
399
283
279
689
078
100
000
000
000

456
789
234
453
125
175
183
256
012
100
000
Output:

Code: Select all

16

5
Hope these help.

EDIT : The wrong input set is removed. Sorry for posting it. :oops:
Last edited by Jan on Thu Dec 07, 2006 1:05 pm, edited 1 time in total.
Ami ekhono shopno dekhi...
HomePage
beloni
Learning poster
Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

10033 - input

Post by beloni »

Anyone can tell me if the following code solve correctly the input of problem 10033???

void CPU::read()
{
int w = 0;
while(1)
{
ram[pc][w] = getchar();
while(ram[pc][w] != '\n')
{
w++;
ram[pc][w] = getchar();
}

if(ram[pc][0] == '\n')
break;
else
{
ram[pc][w] = 0;em string
w = 0;
pc++;
}
}
}
beloni
Learning poster
Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

10033 RTE Please help me Jan!!!

Post by beloni »

I have this sample input posted by JAN:
1

299
492
279
283
078
100
123
345

first code: move register 9 with the value 9
second: mul by two the content of register 9
third: move rigister 7 with the value 9
fourth: move register 8 with value 3

fifth: jump to ram position in register 7 if register 8 is not zero
so... in this case reg 7 contains 9, reg 8 conteisn 3 and reg 9 contains 18.
but the ram position in reg 7 is 000 and we have a infinity loop!!!
beloni
Learning poster
Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

a test input

Post by beloni »

3

299
492
495
399
492
495
399
283
279
689
078
100
000
000
000

456
789
234
453
125
175
183
256
012
100
000

299
492
279
283
078
100
123
345
chunyi81
A great helper
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Post by chunyi81 »

My AC code goes into an infinite loop for this test case as well. I guess you can safely assume the judge contains no such cases.
beloni
Learning poster
Posts: 66
Joined: Thu Jan 05, 2006 1:41 pm
Location: Pelotas, RS, Brazil

Post by beloni »

thanks
so... can you give to me an sample input???
tmdrbs6584
Learning poster
Posts: 98
Joined: Sat Jan 21, 2006 12:45 pm
Location: Busan,Corea(Republic of)

Hmm

Post by tmdrbs6584 »

Why don't you make bigger array size?
John Herre
New poster
Posts: 6
Joined: Sat Jun 10, 2006 6:35 pm
Location: Bogota, Colombia

Post by John Herre »

I sent my solution to this problem, and I got ACC, but the last test case makes my program infinite-looping... that's weird... but I have no time to test that manually.

jedihe
smilitude
Experienced poster
Posts: 137
Joined: Fri Jul 01, 2005 12:21 am

Post by smilitude »

I guess, beloni wanted to say
but the ram position in reg '9' is 000 and we have a infinity loop!!!
he is right with that, anyway.. this input is faulty!
fahim
#include <smile.h>
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Thanks beloni for showing me the error. Those cases were randomly generated, and somehow my old code(which was accepted, too) generated those outputs. But my current code goes into an infinite loop for the case. Sorry for posting such faulty case :oops:.
Ami ekhono shopno dekhi...
HomePage
Bandrosh
New poster
Posts: 7
Joined: Wed Dec 20, 2006 10:00 pm

10033 is making me crazy!

Post by Bandrosh »

I have read and re-read this problem so many times that I already know it by heart.

I have searched at the forum and found this sample input and output posted by Jan:

Input:
456
789
234
453
125
175
183
256
012
100
000
Output:
5
Here's the link where I found this input/output:
http://online-judge.uva.es/board/viewto ... ight=10033


What's my problem?
I can't understand how the output can be 5.

First instruction: multiply by 6 the content of register 5
Second: multiply the register 8 content by the content of register 9
Third: set the register 3 the value 4
Fourth: multiply by 3 the content of register 5
Fifth: isn't interpreted
Sixtth: isn't interpreted
Seventh: isn't interpreted
Eighth: set the register 5 the value 6
Nineth: don't go to register 1, beacause the content of register 2 is 0
Tenth: halt interpreter

So we have 6 instructions.
Why is the correct output is 5?
Post Reply

Return to “Volume 100 (10000-10099)”