You are not logged in. Please login at www.codechef.com to post your questions!

×

Solution failing for larger String value

Hi All, I am new to codechef . I just don't understand why case 3 of subtask 1 is failing?

Subtask #1 (30 points)

1 ≤ T, |s| ≤ 10^3 1 ≤ Sum of |s| over all test cases in a single test file ≤ 10^4.

My solution gives out : Sub-Task Task # Score Result (time) 1 1 NA AC(0.000000) 1 2 NA AC(0.000000) 1 3 NA WA(0.000000)

How can I make it work for string greater than 10^3. for c program the max limit is 4095 characters. For java its much larger . I had submitted the solution in both languages but still the subtask 1 task 3 is WA .If solution is working for strings <10^3 then it should work for larger string as well.I don't understand.Please help me out.

asked 09 Jul '17, 07:47

rishabhdubey9's gravatar image

2★rishabhdubey9
32
accept rate: 0%


Your solution is not working for Subtask #1, as task 3 of subtask 1 is failing.
Then, why are you asking about the solution that would work for string greater than 10^3.
Your logic may be incorrect.
At First, try to pass the subtask 1 completely.

link

answered 09 Jul '17, 09:29

pankaj_chopra's gravatar image

3★pankaj_chopra
329210
accept rate: 21%

Please do not create multiple threads on same thing, you can get reported which will make you unable to ask Q until you earn some karma.

I just don't understand why case 3 of subtask 1 is failing?

It means your logic is incorrect or your program isnt printing correct output or is printing in incorrect format.

or c program the max limit is 4095 characters.

You are applying a correct concept at wrong place. Refer here- https://stackoverflow.com/questions/11488616/why-is-max-length-of-c-string-literal-different-from-max-char

In C you can declare char arrays more than 10^6 and store strings in them.

link

answered 09 Jul '17, 14:24

vijju123's gravatar image

5★vijju123 ♦♦
15.5k12066
accept rate: 18%

Sorry about multiple threads.It was created by mistake because of slow internet connection. Thanks anyways.

(10 Jul '17, 05:12) rishabhdubey92★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,491
×1,314
×49
×41
×26

question asked: 09 Jul '17, 07:47

question was seen: 373 times

last updated: 10 Jul '17, 05:12