I am stuck on questions "B" and "J" of PSUT Coding Marathon (http://codeforces.com/gym/100687).

My code for "J" ( I believe this is the classroom — lecture greedy problem) : http://pastebin.com/Lnp4VMJL

My code for "B" ( I can only see this as a trivial question, unless I havn't understood the question well enough) : http://pastebin.com/bHL0xcqY

Any hints / cases for any of these questions would be helpful. Thanks!

For problem B, one detail that isn't really made clear from the problem statement is that all the test IDs have to be distinct. So if one them exactly matches the student's id it has to be that one. Also, I think if there are 10 of the form 12? and the student's id is 123, it has to match one of those.

I did check that if one of them matches perfectly, I print that as the answer. I didnt get your second part.

Suppose you have 10 IDs that are "1?" (all grade 10), 1 ID that is "??" (grade 20) and the ID you want to match is 15. Then, one of those "1?" IDs must be the match because they must be exactly the set {10, 11, 12, 13, 14, 15, 16, 17, 18, 19}, so the answer is 10

okay, I will try this. Did you see "J" ?

But this case wouldn't arise in the problem since it's given that every ID contains at most 1 question mark.

Do you mean to check the ID with the least '?' .

Did you get any bug in J? I am also getting WA and my solution is similar to yours. Thanks.