### mblazev's blog

By mblazev, history, 8 months ago, ,

So i used Arpa's bigint for today's C: https://codeforces.com/blog/entry/22566 and got skipped. Isn't it allowed to use code written before contest? What's going on here fcspartakm?

• +108

 » 8 months ago, # |   +30 Pinging everyone else to get attention BledDest Vovuh MikeMirzayanov.
 » 8 months ago, # |   +9 s̶h̶o̶u̶l̶d̶'̶v̶e̶ ̶j̶u̶s̶t̶ ̶u̶s̶e̶d̶ ̶p̶y̶t̶h̶o̶n̶
 » 8 months ago, # | ← Rev. 2 →   +3 this might help link. feelsbadman T_T
•  » » 8 months ago, # ^ |   +1 Well yeah, I would guess contest authors are aware of codeforces rules... the code was written and published/distributed before the start of the round,
 » 8 months ago, # | ← Rev. 2 →   +33 Sure it is a false positive plagiarism detection issue. It happens rarely. But did you read the comment from the system? It gives you a standard way to resolve such issues. No need to write posts like this. UPD: Sorry, I don't know why you didn't receive a message about the violation. I'll investigate it.
•  » » 8 months ago, # ^ |   +35 I didn't get any message.
 » 8 months ago, # | ← Rev. 3 →   -8 Hi went through your solution. I am unable to understand couple of things.What is the purpose of substracting and adding 1 for upper k or lower k?Thanks bigint df(bigint a, bigint b) { if (b < 0) a = -a, b = -b; return a / b — (a % b < 0); } bigint dc(bigint a, bigint b) { if (b < 0) a = -a, b = -b; return a / b + (a % b > 0); } 
•  » » 8 months ago, # ^ |   0 Those are div floor and div ceil functions and they do exactly that. The inequalities for k come from requirement that solution is greater or equal to zero.