ORTHODOX - Editorial

MANY STUDENTS COPY CODE FROM DIRECTLY geeks from geeks (python)
AND ALSO THERE ARE WEAKS TEST CASES LIKE
2 4 5 16 32

2 Likes

bro…dont worry …u just focus on ur soln… :wink:

1 Like

BUT DUE TO THIS CHEATING, ME AND MANY PEOPLE NOT ENJOY THIS CODING CULTURE

2 Likes

its not about enjoying bro,…just keep on coding

codechef needs to improve the test cases strictly
its really disappointing

WHY ARE YOU TAUNTING ME

AND DONT TELL ME WHAT TO DO AND WHAT NOT TO DO

2 Likes

@admin please rectify this. In this recent question also this mistake was made. Twice in such a small duration is not fair for many users. Please recheck the submissions.

3 Likes

i am not taunting you dude…i am just trying to motivate u… dont focus on these ill things (such as codes available on net)…just focus and develop ur skills

5 Likes

i totally agree with u
submissions should be rejudged

1 Like

Many Suffer When Solutions Passes with weak test cases.It’s Totally No fair!!

3 Likes

Very very weak testcases (if there are at all other than samples).
My solution has a bug where I don’t read input array for the case when N > 70, and just say NO, and it still passes.
https://www.codechef.com/viewsolution/35779164

3 Likes

suppose OR value till “i” is 00010100000
now adding one more element to previous subarray will either add more bits to previous OR value(eg…00010100000—>00110100000) or it may not add any bit to previous OR(00010100000---->00010100000). This arises the maximum possibility of 64 numbers ,each changes contributing to new number.

Note : You are confused with rearrange of bits vs adding of new bits.
In this case there is no rearrangement of bits in previous obtained OR values just there is
possibilities of adding of new bit…which can maximum go upto 64 bit (long long).

3 Likes
1 Like

So, there are 62 bits for a number till 10^18 right ? And what about the remaining two bits as long long is 64 bit. And it is signed so 1 bit is for storing the + or - sign. So one bit is remaining . Can anybody explain this?

It totally depends on you !
if you want to cheat or not :smile:

@rajarshi_basu nice problem. Liked the observation.
certainly wasn’t easy.

1 Like

how did you know? only 300 test cases?

i did’t understand fully why for n>62 the answer is NO.

The question didin’t expect O(n^2) time complexity… but it was so bad to know that people got their answers accepted with O(n^2) complexity… plz work hard on testcases…

1 Like

Is this solution correct?.
Can anyone suggest a test case for which this fails?.

#include <bits/stdc++.h>

using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);

int t;
cin>>t;
while(t–)
{
long long int n,flag=0;
cin>>n;

    long long int a[n],i,j,ans=0;
    
    for(i=0;i<n;++i)
      cin>>a[i];
   
   sort(a,a+n,greater<long long int>());
   ans=a[0];
    for(i=1;i<n;++i)
    {
        if(ans==(ans|a[i]))
         {
             flag=1;
             break;
         }
         
        else
        ans|=a[i];
    }
    
    if(flag==1)
      cout<<"NO"<<endl;
      
    else
      cout<<"YES"<<endl;

}

 return 0;

}