/// Raihan Ruhin /// CSE, Jahangirnagar University. /// Dhaka-Bangladesh. /// id: raihanruhin (topcoder / codeforces / codechef / hackerrank / uva / uvalive / spoj), 3235 (lightoj) /// mail: raihanruhin@ (yahoo / gmail / facebook) /// blog: ruhinraihan.blogspot.com //#include<bits/stdc++.h> #include<iostream> using namespace std; #define SET(a) memset(a,-1,sizeof(a)) #define CLR(a) memset(a,0,sizeof(a)) #define PI acos(-1.0) #define MOD 1000000007 #define MX 100010 int main() { //ios_base::sync_with_stdio(0);cin.tie(0); int kk=1, tc, n, x, pos, arr[22]; string s; cin>>tc; while(tc--) { int rev=0; cin>>n; for(int i=0; i<n; i++) cin>>arr[i]; /*if(n%2==0) { cout<<"YES\n"; //break; goto finish; }*/ for(int i=0; i<n; i++) if(!arr[i]) { if(i%2==1) { cout<<"YES\n"; goto finish; //else cout<<"NO\n"; } break; //cout<<"Case "<<kk++<<": "<< <<"\n"; } //if(n%2) rev=1; for(int i=n-1; i>=0; i--) { if(!arr[i]) { if(rev%2==1) { cout<<"YES\n"; goto finish; //else cout<<"NO\n"; } break; //cout<<"Case "<<kk++<<": "<< <<"\n"; } rev++; } cout<<"NO\n"; finish: int a=1; } return 0; }
Tuesday, 31 March 2015
UVA 1561 Cycle Game (ZOJ 2686, UVALive 2813, Regionals 2003 >> Asia - Seoul)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment