Introducing Regexps

Back to General discussions forum

Tor Lobo     2014-09-11 09:38:01
User avatar

I'm getting odd answers from this. Here's one example. (Note that the "your code returned" and "instead of" information is identical). And "Sorry, for test data" - I have no idea what that means.

Your answer is Wrong Expected answer was: Sorry, for test data

0B21200 0xa 2H 055 537 0b1100000 642 012 0X2G 111010101b 100 4BH 2350 0x8 069 J2JH 0X3D 0X8 0b10002002 2h 49 0b201 0X7A2 2H 0b1001000010101 0xe 80 1010010110110b 05 0b11200 0b10122 11B 9C

Your code returned

0B21200 hex hex oct dec bin dec oct 0X2G bin dec hex dec hex 069 J2JH hex hex 0b10002002 hex dec 0b201 hex hex bin hex dec bin oct 0b11200 0b10122 bin 9C

instead of

0B21200 hex hex oct dec bin dec oct 0X2G bin dec hex dec hex 069 J2JH hex hex 0b10002002 hex dec 0b201 hex hex bin hex dec bin oct 0b11200 0b10122 bin 9C

Rodion (admin)     2014-09-11 13:49:47
User avatar

Hi!

Have you noticed that for this task you should submit solution written as regexps themselves, not the code in Java for example? Is not this just a case?

It seems that the message returned on error is misguiding anyway - I'll try to take care about it now!

UPD I've tried to teach the server to return more clear error message when the "solution" does not look like containing regexps. However it could not be always determined exactly, of course...

Tor Lobo     2014-09-12 09:11:20
User avatar

Hi, I tried submitting the Java code once, but after that have been using the form suggested. My problem is that I seem to have the correct answer (the two answers match exactly), but it keeps being graded as "Wrong". For example, my latest submission resulted in this:

Expected answer was: Sorry, for test data

4 0X7BJ 25BH 091a 0B1002011 036 1461H 03588 0XD9D 04581 111b 2905 0b20 0B101020000 31H 0x3 3ABB 1211b 10B 157 100121101b 085 07A7 101B 910 25AH DEHH 0b11110110100 0b2011001 0b111 1021100b 0XI8J 11100011B 0b101000122

Your code returned

dec 0X7BJ hex 091a 0B1002011 oct hex 03588 hex 04581 bin dec 0b20 0B101020000 hex hex 3ABB 1211b bin dec 100121101b 085 07A7 bin dec hex DEHH bin 0b2011001 bin 1021100b 0XI8J bin 0b101000122

instead of

dec 0X7BJ hex 091a 0B1002011 oct hex 03588 hex 04581 bin dec 0b20 0B101020000 hex hex 3ABB 1211b bin dec 100121101b 085 07A7 bin dec hex DEHH bin 0b2011001 bin 1021100b 0XI8J bin 0b101000122


My answer and the expected answer match exactly, but it still was graded "Wrong".

Rodion (admin)     2014-09-12 09:37:56
User avatar

Quite interesting... I'll try to check your regexp code now.

UPD Oh, I see now - you have a spare space before "bin" and it leads to spare spaces appearing in the answer (they are not visible when rendering html, sorry).

I'll try to improve regexp processor so it will eliminate spare spaces.

Aghiad     2015-01-03 22:00:40
User avatar

hi i am trying to solve the regexp introduction without succeeding, i don't know why. Every thing seems to be quite good can you please help me.

Rodion (admin)     2015-01-04 05:53:27
User avatar

Hi!

It seems you are trying to submit Python code. But this problem requires you to submit only regexps themselves, as described in problem statement. You should be able to check how they will work by clicking "Regexp" button below the code area. Hope this may help... Feel free to ask more if I failed to explain well :)

Aghiad     2015-01-04 14:15:10
User avatar

Thanks ,i have solved it after many tries..... I don't know why you have chosen to enter the solution in regexp instead of solving the problem as usual. anyway thanks a lot for helping and for the great site.;)

Rodion (admin)     2015-01-04 14:20:03
User avatar

> I don't know why you have chosen to enter the solution in regexp

Well, it was an attempt to create new class of problems concentrating on regexps (like ones requiring Brainfuck) - but up to now I failed to invent many various problems to be used with regexps :)

I confess that not all problems are curious or interesting - but after some people solved them it becomes too late to remove them :)

Matthew Cole     2015-01-06 08:36:56

Admin,

I got a failed response for the following test set: 25 02083 03145 1ahh 0b111000001011 A 1H 0x203 0X741 28h 1010011101110b 0B12 0x3ff 8H ad1h 1001010111100B 110221b 0X20AF 075 0B100 8 1d6h 01445 0b1021 305 0b2110 042 0757 0545 5H 0x3 0b202121 06 0b1 112011b 16

Your code returned: dec 02083 oct hexh bin A hex hex hex hex bin 0B12 hex hex hex bin 110221b hex oct bin dec hex oct 0b1021 dec 0b2110 oct oct oct hex hex 0b202121 oct bin 112011b dec

instead of: dec 02083 oct 1ahh bin A hex hex hex hex bin 0B12 hex hex ad1h bin 110221b hex oct bin dec hex oct 0b1021 dec 0b2110 oct oct oct hex hex 0b202121 oct bin 112011b dec

Specifically, your solution thinks 'ad1h' is not a valid hex. (I also seem to be returning 'hexh' for '1ahh', but I just fixed that in my now valid solution).

Thanks!

Quandray     2015-01-06 08:45:24
User avatar

The problem statement says
hexadecimal could be instead suffixed by h but then it should not start with letter;
so 'ad1h' isn't valid hex

Rodion (admin)     2015-01-06 08:45:54
User avatar

Matthew, Hi!

I believe the reason for ad1h not recognized as hex is that problem statement says: hexadecimal could be instead suffixed by h but then it should not start with letter; - I suspect it is a common rule in programming languages which use such notation since such character sequences are instead recognized as identifiers (like variable names). E.g. if we want to write ad1h in assembly source, we prepend it with zero: 0ad1h.

I'm sorry for this problem contains such clumsy cases - but I'm afraid that the number of clumsy cases was the main feature of this clumsy problem. I'm glad you solved it inspite of these difficulties! :)

Please login and solve 5 problems to be able to post at forum