fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t,n,s; cin >> t;
  6. while(t--){
  7. /*string s;*/ cin >> n >> s;
  8. if(s == 0 || s == 1 || s == 10 || s == 01) cout << "YES\n";
  9. else cout << "NO\n";
  10. }
  11. return 0;
  12. }
Success #stdin #stdout 0.01s 5280KB
stdin
4
1
1
2
00
2
01
4
1010
stdout
YES
YES
YES
NO