void Work(void) { Set S; S.n = 1; Make(1, n, S); for (long i = 1; i <= n; i++) if (i != ID) AddMain(S, w[i]); for (long i = 1; i <= n; i++) if (i != ID) AddMain(S, -w[i]); printf("%ld %ld\n", w[ID], S(1).r + 1); }
/*! \b parameters: \arg \b pNewSurface Pointer to a new surface object \arg \b pName Name of the file that contains the image \arg \b pBlockSize Width of the blocks \arg \b pType Type of surface (see ::IND_Type) \arg \b pQuality Quality of surface (see ::IND_Quality) \arg <b>pR, pG, pB</b> Color from which the colorkey will be applied, this areas will become transparent. \b Operation: This function returns 1 (true) if the parameter surface object exists and it is added satisfactory to the manager loading the image directly from a file. This method is useful for creating scrolls because we can specify the width of the block. Blocks outside the viewport will be automatically discarded. Graphic formats supported (Thanks to http://openil.sourceforge.net): bmp, png, tga, jpg and pcx. */ bool IND_SurfaceManager::Add (IND_Surface *pNewSurface, char *pName, int pBlockSize, IND_Type pType, IND_Quality pQuality, byte pR, byte pG, byte pB) { // Image loading IND_Image *mNewImage = new IND_Image; if (!mImageManager->Add (mNewImage, pName)) return 0; // Color key mNewImage->SetAlpha (pR, pG, pB); // Surface creation if (!AddMain (pNewSurface, mNewImage, pBlockSize, pBlockSize, pType, pQuality)) { mImageManager->Delete (mNewImage); return 0; } // Free image mImageManager->Delete (mNewImage); return 1; }
/*! \b parameters: \arg \b pNewSurface Pointer to a new surface object \arg \b pImage Pointer to a ::IND_Image object \arg \b pBlockSize Width of the blocks. \arg \b pType Type of surface (see ::IND_Type) \arg \b pQuality Quality of surface (see ::IND_Quality) \b Operation: This function returns 1 (true) if the parameter surface object exists and it is added to the manager loading the image directly from a file. This method is useful for creating scrolls because we can specify the width of the block. Blocks outside the viewport will be automatically discarded. */ bool IND_SurfaceManager::Add (IND_Surface *pNewSurface, IND_Image *pImage, int pBlockSize, IND_Type pType, IND_Quality pQuality) { if (!AddMain (pNewSurface, pImage, pBlockSize, pBlockSize, pType, pQuality)) return 0; return 1; }
/*! \b parameters: \arg \b pNewSurface Pointer to a new surface object \arg \b pImage Pointer to a ::IND_Image object \arg \b pType Type of surface (see ::IND_Type) \arg \b pQuality Quality of surface (see ::IND_Quality) \b Operation: This function returns 1 (true) if the parameter surface object exists and it is added to the manager, loading the image directly from a ::IND_Image object. */ bool IND_SurfaceManager::Add (IND_Surface *pNewSurface, IND_Image *pImage, IND_Type pType, IND_Quality pQuality) { // Surface creation if (!AddMain (pNewSurface, pImage, 0, 0, pType, pQuality)) return 0; return 1; }
/*! \b parameters: \arg \b pNewSurface Pointer to a new surface object \arg \b pName Name of the file that contains the image \arg \b pBlockSize Width of the blocks \arg \b pType Type of surface (see ::IND_Type) \arg \b pQuality Quality of surface (see ::IND_Quality) \b Operation: This function returns 1 (true) if the parameter surface object exists and it is added satisfactory to the manager loading the image directly from a file. This method is useful for creating scrolls because we can specify the width of the block. Blocks outside the viewport will be automatically discarded. Graphic formats supported (Thanks to http://openil.sourceforge.net): bmp, png, tga, jpg and pcx. */ bool IND_SurfaceManager::Add (IND_Surface *pNewSurface, char *pName, int pBlockSize, IND_Type pType, IND_Quality pQuality) { IND_Image *mNewImage = new IND_Image; if (!mImageManager->Add (mNewImage, pName)) return 0; if (!AddMain (pNewSurface, mNewImage, pBlockSize, pBlockSize, pType, pQuality)) return 0; mImageManager->Delete (mNewImage); return 1; }
/*! \b parameters: \arg \b pNewSurface Pointer to a new surface object \arg \b pName Name of the file that contains the image \arg \b pType Type of surface (see ::IND_Type) \arg \b pQuality Quality of the surface (see ::IND_Quality) \b Operation: This function returns 1 (true) if the parameter surface object exists and it is added by loading the image directly from the file. Graphic formats supported (Thanks to http://openil.sourceforge.net): bmp, png, tga, jpg and pcx. */ bool IND_SurfaceManager::Add (IND_Surface *pNewSurface, char *pName, IND_Type pType, IND_Quality pQuality) { // Loads the image IND_Image *mNewImage = new IND_Image; if (!mImageManager->Add (mNewImage, pName)) return 0; // Surface creation if (!AddMain (pNewSurface, mNewImage, 0, 0, pType, pQuality)) { mImageManager->Delete (mNewImage); return 0; } // Free image mImageManager->Delete (mNewImage); return 1; }
inline void Add(const Set &s, Set& ret, long l, long r) { ret = s; for (long i = l; i <= r; i++) AddMain(ret, w[i]); }