Edu Round 86 Problem C

Got AC :slight_smile:

1 Like

So annoyed right now!!!

Which compiler are you using locally??

I use Sublime + MinGW.

C++ version ??

I use C++17 so I always submit my code in C++17 option.

I don’t specify the version, so whatever MinGW 8.1.0 uses, and I have no idea how to check.

This problem made me sad :frowning:

Still trying to figure why changing the C++ version matters so much. :confused:

@epsilon_573 Sir,Can you kindly share your approach for this problem?

Find the LCM of a and b, also if GCD(a,b) = min(a,b) answer is always 0. Number which satisfy the condition (i%a)%b == (i%b)%a , occur in [ i * LCM , i * LCM + max(a,b) ) . where i is any positive integer. Just count them and subtract them from R-L+1.

Surprisingly I am using C++14, this makes it more worrying.

@epsilon_573 Sir,how did derived these properties of a &b?

Just write a brute force solution and notice the pattern.

Watch this video of @striver_79 Codeforces Educational Round #86 | Yet Another Counting Problem | Watch till Code explanation - YouTube
He explained it very well.

1 Like

there was no issue with compiler. It was their internal bug. See this Announcement.

No his solution was giving WA even after that.
And when he submitted the same code on C++17 it worked whereas when it was submitted on C++14 it didn’t.
I can’t really say what kind of issue was that though.

Can you ask regarding this issue on the editorial or announcement page of that round.
If you do so just reply about it here.
I am really want to know what was really the issue.

I will do so in the editorial blog post once it is posted as more people will be active on that one.

1 Like

Seems like the issue was float point arithmetic. Compilers are really inconsistent with floating point arithmetic.