UVA 572 - Oil Deposits

UVA Sep 01, 2020

Problem PDF

Solution:

/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : [email protected]                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
using namespace std;

#define ll long long
#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf("%d",&t)
#define sl(t) scanf("%lld",&t)
#define sf(t) scanf("%f",&t)
#define sdb(t) scanf("%lf",&t)
#define schar(c) scanf("%c",&c)
#define sstring(s) scanf("%s",s)
#define ssi(a,b) scanf("%d%d",&a,&b)
#define ssl(a,b) scanf("%lld%lld",&a,&b)

//Output
#define P(a) printf("%d\n",a)
#define PL(a) printf("%lld\n",a)
#define PF(a) printf("%f\n",a)
#define PDB(a) printf("%lf\n",a)
#define PN(a) printf("%d ",a)
#define PLN(a) printf("%lld ",a)
#define PFN(a) printf("%f ",a)
#define PDBN(a) printf("%lf ",a)

#define CP(a) cout< vi;
typedef  vector vl;
typedef  vector vs;
typedef  pair pii;
typedef  vector vpii;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map msi;

//For Define
#define for0(i,n) for(__typeof(n) i=0;i<(n);i++)
#define for1(i,n) for(__typeof(n) i=1;i<=(n);i++)
#define rfor0(i,n) for(__typeof(n) i=(n);i>=0;i--)
#define rfor1(i,n) for(__typeof(n) i=(n);i>=1;i--)
#define For(i,a,b) for(__typeof(b) i=a;i<=b;i++)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//Debug
#define db(x) cout << #x << " -> " << (x) << endl;
#define db_sarr(i,a) cout<<#a<<"["< "< "< "<r-1 || j<-1 || j>c-1 || s[i][j]!='@')
        return ;

    s[i][j] = '*';

    floodfill(i-1,j);
    floodfill(i-1,j+1);
    floodfill(i-1,j-1);
    floodfill(i,j+1);
    floodfill(i,j-1);
    floodfill(i+1,j);
    floodfill(i+1,j+1);
    floodfill(i+1,j-1);

}


int main()
{
    int i,cnt;

    while(ssi(r,c)==2)
    {
        getchar();
        if(r==0 && c==0)
        break;
        cnt=0;
        for0(i,r)
            cin>>s[i];
        i=0;
        while(i
https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/572/572.cpp

Tags

Shipu Ahamed

CSPO® | Partly Product, Project Manager and Partly Software Engineer.

Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.