[Community Puzzle] Graffiti on the fence

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @java_coffee_cup,validated by @pluieciel,@JBM and @cg123.
If you have any issues, feel free to ping them.

Hi,
I pass all tests, but after submission, the fifth validator fail…
I can’t find why, can you give more information ?
Thanks

can you pass this?

2
2
1 2
0 1

Yes : “All painted”

Could be some obscure error.
Added some extra test cases. Try run your test again.

You can also invent some test data by yourself, as crazy as possible, for self-debugging.

All the tests are passed except the 5th… :confused:

I don’t pass if st > ed…

As defined in constraint, it is always st < ed
I have a validator in my code to monitor this constraint.

I also did a minor update in testcases/validators to make them more alike each other.

Can you copy/paste the 5th in the tests set ?

Double checked there is no extra spaces or unwanted chars in the test case. The validator structure looks alike the test cases.

Hi There :slight_smile:

Can someone give me a little clue on how to do this without an array? I can run the first 5 tests successfully but with long fence it doesn’t work anymore. I use a string instead of an array. But the string length is limited.

I don’t understand what means array forbidden here. Since I did it with an array does it only meant we couldn’t compute a array of every part of the wall, to apply the graffiti?

“Forbidden” doesn’t mean you cannot use any array at all. Array is allowed but its length cannot always be equal to the size of full data range.

1 Like

Test case “Long Fence 1” is a good example showing how unnecessary it is to allocate memory equals to the full range of data. Your calculation is just within 0…12. Don’t you feel how ridiculously wasteful it is to request 2GB of memory to do this simple calculation?

Suppose you are using paper and pencil to calculate the answer, you will not write 2 billion numbers on paper. You will just write a few numbers, may be with some diagrams, to get the correct result.

Write a program to simulate what you would do on paper.

4 Likes

Ah Okay! Thanks

I can´t pass the validator 4, i tested my Code as good as i can.
I can’t find my mistake. Have all options covered in my opinion?

I do not pass validator 4 despite before submitting all test cases are passed. What’s the validator 4? I need to see the input to understand. Thanks a lot.

1 Like

@Tonsias, @Keyser_D_Soze
hi, what result would you have for the following test?
7
3
1 4
3 6
0 2

1 Like

@cg123
Solution is All painted

oh, i understand my mistake now, thanks

Ok, I understood, thanks cg123, i think that put this test in test cases is a good idea.

Thanks @cg123 for the nice testcase that caught this “obvious but undetectable” error. I added it to the puzzle.