fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;cin>>n;
  6. int a[n],f=0;
  7. for(int i=0;i<n;i++)
  8. cin>>a[i];
  9. for(int i=0;i<n;i++)
  10. {
  11. f=0;
  12. for(int j=0;j<=i;j++)
  13. {
  14. //cout<<j+__builtin_popcount(j)<<" ";
  15. if(j+__builtin_popcount(j)==a[i])
  16. {
  17.  
  18. f=1;
  19. if(i==n)cout<< "SUPPORTED";
  20. else cout<< "SUPPORTED,";
  21. }
  22. }
  23. if(f==0)
  24. {
  25. if(i==n-1)cout<<"BLEAK";
  26. else cout<< "BLEAK,";
  27. }
  28. }
  29. }
Success #stdin #stdout 0s 5516KB
stdin
4
1 2 3 4
stdout
BLEAK,SUPPORTED,SUPPORTED,BLEAK