fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. long long int d,t,a;
  6. cin>>t;
  7. while(t--){
  8. long long int count=0;
  9. cin>>d;
  10. while(d--){
  11. cin>>a;
  12. if(a!=0&&a!=1)
  13. count++;
  14. }
  15.  
  16. if(count>1)
  17. cout<<"no" << endl;
  18. else
  19. cout<<"yes" << endl;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 3464KB
stdin
3
2
0 1
2
1 2
2
5 6
stdout
yes
yes
no