no output please help(https://codeforces.com/contest/977/problem/D)
Difference between en1 and en2, changed 602 character(s)
int main()↵
{↵
   ll n;cin>>n;↵
   ll a[n];↵
   for(int i=0;i<n;i++)↵
   {↵
       cin>>a[i];↵
   }↵
   sort(a,a+n,greater<ll>());↵
   vector<ll> v;↵
   for(ll i=0;i<n;i++)↵
   {↵
       int flag = 0;↵
       v.PB(a[i]);↵
       for(ll j=0;j<n;j++)↵
       {↵

           ll check = v.back();↵
           if( check%3==0 && binary_search(a,a+n,check/3)==true) v.PB(check/3);↵
           else if(binary_search(a,a+n,check*2)) v.PB(check*2);↵
           else {v.clear(); break;}↵
           if(v.size()==n){flag =1; break;}↵
       }↵
       if(flag==1) break;↵
   }↵
   for(auto x:v)↵
   {↵
       cout<<x<<" ";↵
   }↵
   return 0;↵
}↵
pls see the code in given image: -↵
i think the problem is in↵
sort(a,a+n,greater<ll>()) function ↵
because if i use sort(a,a+n) only this got accepted

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English judgeme 2020-07-05 21:55:41 602
en1 English judgeme 2020-07-05 21:51:02 702 why this code is not printing anything?? (published)