Tags » BF's

LightOJ 1238 - Power Puff Girls

User : Singular
Link : 1238 – Power Puff Girls
Algo : BFS


/* Bismillahir Rahmanir Rahim
 * Rimon Mostafiz
 * User : Singular
 * Task : LightOJ 1238 - Power Puff Girls
 * Algo : BFS
 */

//#pragma warning (disable: 4786)
//#pragma comment(linker, "/STACK:16777216")
//#define _CRT_SECURE_NO_WARNINGS 1

#include <bits/stdc++.h>
using namespace std;

#define sdi(a)          scanf("%d", &a)
#define sdii(a, b)      scanf("%d %d", &a, &b)
#define pdi(a)          printf("%d\n", a)
#define pdii(u, v)      printf("%d %d\n", x, y)
#define rep(i, n)       for(int i = 0;      i <  (int)n;       i++)
#define repv(i, n)      for(int i = n-1;    i >= 0;            i--)
#define repl(i, n)      for(int i = 1;      i <= (int)n;       i++)
#define replv(i, n)     for(int i = n;      i >= 1;            i--)
#define repe(i, a, b)   for(int i = int(a); i <= (int)b;       i++)
#define foreach(i, n)   for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define CLR(p)          memset(p, 0, sizeof(p))
#define SET(p)          memset(p, -1, sizeof(p))
#define MEM(p, v)       memset(p, v, sizeof(p))
#define CPY(d, s)       memcpy(d, s, sizeof(s))
#define ld              long double
#define pi              acos(-1.0)
#define pii             pair < int, int >
#define psi             pair < string, int >
#define MP(x, y)        make_pair(x, y)
#define ff              first
#define ss              second
#define ALL(p)          p.begin(), p.end()
#define SZ(c)           (int)c.size()
#define PB(x)           push_back(x)

typedef  long long i64;
typedef unsigned long long ui64;
typedef long double d64;

template< class T > T _abs(T n) { return (n < 0 ? 460 more words
Acm Solution

LightOJ 1012 - Guilty Prince

User : Singular
Link : 1012 – Guilty Prince
Algo : DFS / Flood Fill / BFS

/* Bismillahir Rahmanir Rahim
 * Rimon Mostafiz
 * User : Singular
 * Task : LightOJ 1012 - Guilty Prince
 * Algo : dfs / flood fill
 */

//#pragma warning (disable: 4786)
//#pragma comment(linker, &quot;/STACK:16777216&quot;)
//#define _CRT_SECURE_NO_WARNINGS 1

#include &lt;bits/stdc++.h&gt;
using namespace std;

#define sdi(a)          scanf(&quot;%d&quot;, &amp;a)
#define sdii(a, b)      scanf(&quot;%d %d&quot;, &amp;a, &amp;b)
#define pdi(a)          printf(&quot;%d\n&quot;, a)
#define pdii(u, v)      printf(&quot;%d %d\n&quot;, x, y)
#define rep(i, n)       for(int i = 0;      i &lt;  (int)n;       i++)
#define repv(i, n)      for(int i = n-1;    i &gt;= 0;            i--)
#define repl(i, n)      for(int i = 1;      i &lt;= (int)n;       i++)
#define replv(i, n)     for(int i = n;      i &gt;= 1;            i--)
#define repe(i, a, b)   for(int i = int(a); i &lt;= (int)b;       i++)
#define foreach(i, n)   for(__typeof((n).begin())i =(n).begin();i!=(n).end();i++)
#define CLR(p)          memset(p, 0, sizeof(p))
#define SET(p)          memset(p, -1, sizeof(p))
#define MEM(p, v)       memset(p, v, sizeof(p))
#define CPY(d, s)       memcpy(d, s, sizeof(s))
#define ld              long double
#define pi              acos(-1.0)
#define pii             pair &lt; int, int &gt;
#define psi             pair &lt; string, int &gt;
#define MP(x, y)        make_pair(x, y)
#define ff              first
#define ss              second
#define ALL(p)          p.begin(), p.end()
#define SZ(c)           (int)c.size()
#define PB(x)           push_back(x)

typedef  long long i64;
typedef unsigned long long ui64;

template&lt; class T &gt; inline T _lcm(T a,T b) {if(a&lt;0)return lcm(-a,b);if(b&lt;0)return lcm(a,-b);return a*(b/__gcd(a,b));}
template&lt; class T &gt; T _power(T N,T P){ return (P==0)? 749 more words
Acm Solution

Hard Question 10

Problem:

Given two words of equal length that are in a dictionary, write a method to transform one word into another word by changing only one letter at a time. 158 more words

Technical And Interview And Data Science

ICCF 2014 - Problem C: Least Number of Moves

I can still remember my first ICCF participation. I was not given the chance to participate in the ICCF Open Programming Competition since I was not good enough back then. 913 more words

Iccf2014

Choose your deque carefully: speeding up breadth-first search

The task of finding a shortest path in an unweighted graph is fundamental also, and you are probably familiar with breadth-first search (in short BFS), which does just that. 1,340 more words

Can I get a Reset? (In Memory of Graham Joyce)

I had intended to write this post about the British Fantasy Convention in York which I attended a few days ago. There was going to be mention of the different approaches to the writing process described by… 1,200 more words

BFS

Review for Nick Nightmare Investigates

For a fabulous review of Nick Nightmare Investigates go to the BFS reviews

Remember – this book is only available direct from the Alchemy Press!  

The Alchemy Press