#include <iostream> #include <cstdio> #include <cstring> using namespace std; int xwin[8]; int owin[8]; /* 1 XX. XX. OOO */ string str[4]; bool rowcheck(char c) { for(int i=0;i<3;i++) { if(str[i][0]==str[i][1] && str[i][0]==str[i][2] && str[i][0]==c) return 1; } return 0; } bool diagncheck(char c) { if(str[0][0]==str[1][1] && str[1][1]==str[2][2] && str[1][1]==c) return 1; if(str[0][2]==str[1][1] && str[1][1]==str[2][0] && str[1][1]==c)
Month: December 2015
1099
DP+bitmask #include <iostream> #include <cstdio> #include <vector> #include <queue> #include <sstream> #include <string> #include <cstring> //#include <fstream> #include <cmath> using namespace std; int sizes[16]; int n; int row,col; int sum[32780];//1<<n-1=state int dp[105][32780];//[width or height][state] int _min(int a,int b) { if(a<b) return a; return b; } //karnighan's bit count algorithm int check(int x) { int res=0;
10874
#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <cstring> #include <cmath> #define ll long long #define INF 500000000 using namespace std; struct point{ int left; int right; }; point arr[20005]; ll dp[20005][2]; void init() { for(int i=0;i<20005;i++) for(int j=0;j<2;j++) dp[i][j]=INF; } ll _min(ll a,ll b) { if(a<b) return a; return b; }
10898
#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <cstring> #include <cmath> #define INF 100000000 #define ll long long using namespace std; int MX,cnt; int Item,Combo,noOfOrder; ll bestDp[1000000]; ll packPrice[1000000]; int packages[20]; void init() { cnt=0; for(int i=0;i<1000000;i++) { bestDp[i]=INF; packPrice[i]=0; } for(int i=0;i<20;i++) packages[i]=0; } ll _min(ll a,ll b) { if(a<b) return
10849
two positions of a NxN chess board can be connected by pawns move(diagonally) iff both of them are on black/white position, this can be checked by checking the pair. if both of the x,y (start position ) and X,Y(end position) are odd,odd or even,even then they can be connected or both of the pair are