Whats the problem in this code? I cant find it
Whats the problem in this code? I cant find it
can any tell whats wrong withthis code
am getting correct answer in PC i gave the sample inputs getting same sample output but complilng in CodeChef showing wrong sir.please help me
Why goes it give a WA? I’m sure my solution is similar to what the editorial says.
https://www.codechef.com/viewsolution/12383128
“If K = N, there is no other option than Chef answers all the questions correctly and gets WN dollars of profit.”
for (j=0; j<1001; j++)
W[i]=0;
The above line is wrong. make it,
for (j=0; j<1001; j++)
W[j]=0;
This gives 100pts
You are not considering the case where all the answers are correct.
Your modified code :
https://www.codechef.com/viewsolution/8530809
This gives AC
Thanks for pointing it out. Really feeling bad that I missed 80 points due to that!
@prasadram126 Please change long int to long long int and then try again. The constraints of the problem are such that they need a datatype as large as long long int.
This is the link to your updated solution.
https://www.codechef.com/viewsolution/8535868
@anuragkumar33 I think you need to make arrays A and B a little bit bigger (say, 1010), because string of length N needs N + 1 byte of memory (string itself plus ‘\0’).
If cnt = n, Chef answers all questions correctly and there is no other option than Chef gets W_n dollars of profit, because he can’t leave the game when he wants. For example, for test
3
ABC
ABC
10 100 20 30
answer is 30, not 100.
And again, for test
3
ABC
ABC
10 100 20 30
answer is 30, not 100.
@raunak_parijat thanks for you help , i have one question, in the problem page value of wi at max 10^9 i have tested my code with 10^9 it’s working fine .So can you please give me any test case where it’s giving WA?
can anyone help me . my solution is not working ???
https://www.codechef.com/viewsolution/32110633
it will be a great help.
I tried this Question
Here is my solution,
https://www.codechef.com/viewsolution/34755104
I tried it and it didn’t passed can someone tell me What’s wrong with the code ?
do not use cout<<endl;
you do not need to print newline while taking input from test file.
try initializing m with m = arr[0]; or m = INT_MIN;
go ahead !!