//GNC #include #include #include #include #include #include #include #include #include #include using namespace std; typedef vector array; //typedef set seti; typedef int seti; //typedef pair ipair; //map table; vector table; seti phi; inline int ipair(int a, int b) { return ((a<<11)+b);} seti length(array &data, int from, int to) { if ( from>=to ) return -1;//phi; if ( from+2==to ) return -1;//phi; if ( (to-from)%2==0 ) return -1;//phi; if ( table[ipair(from,to)]!=0 ) //table.count(ipair(from,to)) ) return table[ipair(from,to)]; seti ret=-1; if ( from+1==to ) { ret=data[from];//.insert(data[from]); } else{ int first=data[from]; for ( int i=from+2 ; i0 && s1==s2 ) { //assert ret=s1+first; break; } /*for ( seti::iterator it=s1.begin() ; it!=s1.end() ; ++it ) { if ( s2.count(*it) ) ret.insert(*it+first); }*/ } } table[ipair(from,to)]=ret; //assert(ret.size()<=1); return table[ipair(from,to)]; } int main(void) { int ndata; ifstream cin("balance.in"); while ( cin>>ndata && ndata>0) { array data; for ( int i=0 ; i>a; data.push_back(a); } table.clear(); table.resize(1<<22); cout<<(length(data,0,ndata)>=0?"yes":"no")<0?"yes":"no")<