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.
why the answer is no if N>62??
Yeah bro this was pure hard luck
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.
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?
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.
Many people who unable to solve ORTHODOX and after the contest they get to know, itās already on google / net -
to setters -
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ā¦
I have a different solution: CodeChef: Practical coding for everyone
I checked if the OR changes if I remove an element.
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
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
.
Exactly same logic. But didnāt get AC just because of one test case.
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
Why if n>62 answer is always no? Can someone explain please