"I want to ask a question" - Ask them all here!

Has anyone tried “Make array great again(maga)” problem of Jan cook off by sorting method?? I sorted the array and then replaced 2nd element with 2nd last element 4th element with 4th last element. but it is giving WA. So, what is the problem in this approach?
Code

Sorting? Why did you sort,can you explain a bit more? The operations allowed were quite restricting, you can only swap elements at a[i] and a[n-i+1] (1 based indexing)- so where did sorting come from?

I got 310 laddus as i was in top 20 in India in january long,however it is showing that u have 930 laddus,is it a bug?

Any picture/screenshot you can give?

is there no editorial for 3rd question(MAGA) of JAN COOKOFF or am i missing it ?

They have fixed it.

Thanx for ur help!!

help me with this question

https://discuss.codechef.com/questions/121647/question-from-hackerrank

Why it gives me a WA. https://www.codechef.com/problems/MULTHREE. Here is my code https://www.codechef.com/viewsolution/17130626


how to implement priority queue here?? @vijju123

Have a look at my solution in case you are trying in c++

i have checked your solution but i am not able to understand?? plz jz explain in simple few words!!

What I did was, first I sorted trainers w.r.t. day of coming. Then, inside the loop, for each trainer who arrives at day=i, I add them to the queue. The queue sorts all the trainers (who came today and before) on basis of sadness.
Trainer at top has most sadness. We take, and remove the top element.

Now, we know the total sadness when no one takes lecture. We let trainer at top take lecture, and remove the count from total. If trainer has more lectures remaining, we add him again to the queue. This way, we greedily choose the trainer who takes lecture at a given day, and has arrived.

Please use this thread only if you have 1 karma or less.

Does codechef long have system tests like codeforces? If it has, then is it only for the challenge problem or for each problems?

https://www.codechef.com/viewsolution/17293555

i am getting W/A! but it passes all my testcases.

also how do you make test cases?

Only for challenge problem. Also, in challenge problem, your solution runs agaisnt all (to ascertain your AC doesnt change to WA or TLE after contest during rejudge)- just that score is calculated using few selected ones instead of whole.

Pretest-Systest concept is not yet followed at codechef.

Here-

 Input
1
abcdefghijklmnnooppqqrrssttuuvvwwxxyyzzzza
Your Output
14
Expected Output
I think 26 because all alphabets are present.

abcdefghijklmn this the greatest substring that could be obtained which has all distinct characters! after that some letter repeat. how come 26? i am interpreting the question wrong way?

got it!! Uh i mistook the question…and here i spent almost 2 hours running behind this! all it needed was set() method thats it! just 2 lines of code (in python)

sorry, and thank you

Yup. Subsequence need not be continuous. Take it as “subset” :slight_smile: