ORTHODOX - Editorial

Please format your code

Thank you very much.
After adding just one more if statement it got accepted.

Seriously , same. And then i just saw submissions rising like a missile. The gfg and leetcode makes sense now.

2 Likes

why the answer is no if N>62??

5 Likes

Yeah bro :slight_smile: this was pure hard luck :sob:

2 Likes

I donā€™t Understand I had done the same thing except this if (n >= 100) { cout << "NO\n";ā€¦I got Tle First then i had to rethink and this cost me 1.30 hours i could have been in top 1000 now i am in late 2000ā€¦ thatā€™s patheticā€¦

The complexity of this solution is O(n^2). So how is it getting accepted within one second? Is it due to weak test cases?
Someone please reply and clear this dilemma.

2 Likes

Along with the weak test cases, donā€™t you think time limit was a bit off? O(N^2) within one second, maybe they havenā€™t put the worst cases as the test case?

1 Like

Its n ^ 2 when n <= 62, otherwise itā€™s always a NO.
So for n <= 62, you can simply do brute force, wonā€™t TLE.

1 Like

Many people who unable to solve ORTHODOX and after the contest they get to know, itā€™s already on google / net -

to setters -

Screenshot_2020-07-20 dil se bura lagta hai bhai - Google Search

21 Likes

O(N^2) will work fine if n is 70. Also only 300 testcases were there.

No,the test cases arenā€™t weak. For n>62 we are printing NO in the worst case also Complexity will be O(64*64) which is very less.Hence, it will not give u TLEā€¦

2 Likes

I have a different solution: CodeChef: Practical coding for everyone
I checked if the OR changes if I remove an element.

1 Like

You are Right How Can O(n^2) Solution Pass in 1 Second?
if we calculate
300 * (10^5) * (10^5)=3 * (10^12)

How (3*(10^12)) Complexity can pass in One Second(10^8).
Thats Why i didnā€™t write O(n^2) Approach because i didnā€™t want to cost a penalty but here i am seeing O(n^2) Appoach gets an AC.
This is Genuinely not fair.
@admin

4 Likes

Sahi mein bhai, yaar main pichle 1.30 ghante se testcase dhundh raha hu. Or solution Net pe tha. Or mere to solution ka Counter testcase bhi ye tha
1 1 0. :disappointed:

1 Like

Exactly same logic. But didnā€™t get AC just because of one test case.

3 Likes

Then why did this solution get accepted? CodeChef: Practical coding for everyone
Maybe I am making some mistake in calculating complexity, please correct me if I am wrong.

Let me guessā€¦ N==1 ?

Another code that goes on to check for O(n^2) and gets AC: CodeChef: Practical coding for everyone

2 Likes

Why if n>62 answer is always no? Can someone explain please