int main(){ int f,d,n; while(~scanf("%d%d%d",&n,&f,&d)){ gInit(); V=2+f+d+n+n; int t; for(int i=0;i<f;i++){ scanf("%d",&t); add_edge(0,2+i,t); } for(int i=0;i<d;i++){ scanf("%d",&t); add_edge(2+f+i,1,t); } char ch[210]; for(int j=0;j<n;j++){ scanf("%s",ch); for(int i=0;i<f;i++){ if(ch[i]=='Y') add_edge(2+i,2+f+d+j,1); } } for(int j=0;j<n;j++){ scanf("%s",ch); for(int i=0;i<d;i++){ if(ch[i]=='Y') add_edge(2+f+d+n+j,2+f+i,1); } } for(int j=0;j<n;j++) add_edge(2+f+d+j,2+f+d+n+j,1); printf("%d\n",sap(0,1)); } return 0; }
void SampleGLView::AttachedToWindow(void) { BGLView::AttachedToWindow(); LockGL(); gInit(); gReshape(width, height); UnlockGL(); MakeFocus(); }
void TutGLView::AttachedToWindow( void ) { // Make keyboard/mouse input go to this view when its window has // focus (that'll stay in effect until another view calls MakeFocus() // or the user puts the focus on a control... which won't happen in // this app because there are no other views and no controls). MakeFocus(); // Initialize OpenGL; gInit() sets things up, gReshape() makes sure // OpenGL knows about the view's size/shape. LockGL(); BGLView::AttachedToWindow(); gInit(); BRect r = Bounds(); gReshape( r.IntegerWidth(), r.IntegerHeight() ); UnlockGL(); }
void GrupPacket::startGruping( void ){ #ifdef DEBUG std::cout<<PRINT<<"Reading and processing packet from shared Buffer\n"; #endif int readCount; readCount = 0; Buffer *readBufferObj; __rawNetData__ *packet; bool flag; flag = false; try{ readBufferObj = new Buffer(); packet = new __rawNetData__(); } catch ( const std::bad_alloc &ba ){ std::cerr<<PRINT<<"Exception:"<<ba.what()<<std::endl; } int readReturn; while ( !flag ){ readReturn = readBufferObj->readBuffer( 1 , packet ) ; std::cout<<PRINT<<"read Return:[ "<<readReturn<<" ] \n"; switch ( readReturn ){ case 1: #ifdef ERROR std::cout<<PRINT<<"Read PacketSource POOrt:[ "<<packet->sourcePort <<" ]:: Destination Port:[ "<<packet->destinationPort<<" ]"<<std::endl; #endif readCount++; switch ( packet->sourcePort ){ case 0: flag = !gInit(); break; default: if (! packetHandler ( packet ) ){ std::cerr<<PRINT<<"Error on packet grouping\n"; flag = true; } } // readBufferObj->giveSignal(); // flag = true; break; case -1: std::cerr<<PRINT<<"Error on read packet from buffer"; exit(1); break; case 0: flag = readBufferObj->checkSignal(); std::this_thread::sleep_for ( std::chrono::milliseconds( 100 ) ); break; default: break; //std::cout<<PRINT<<"Unhandled return Value from read Buffer \n"; } } std::cout<<PRINT<<"Total packet read from buffer: [ "<<readCount<< " ] \n"; }