큐빙
/* 1 */ #include #include #include #define f(i, n) for(int i = 0; i < (n); ++i) using namespace std; // original char cb[2][6][3][3]; bool sd;// 초기화 완료 char clr[6] = { 'w', 'y', 'r', 'o', 'g', 'b' }; int dir['Z' + 1]; // turn int src[6][2][4] = {// 기준 p(rotax), 회전방향 +-(rotdr), src p { { 5, 2, 4, 3 },{ 4, 3, 5, 2 } }, { { 4, 3, 5, 2 },{ 5, 2, 4, 3 } }, { { 4, 0, 5, 1 },{ 5, 1, 4, 0 } }, { { 5, 1,..
줄기세포
#include #include #define f(i, n) for(int i = 0 ; i < (n); ++i) using namespace std; int T, tc, R, C, K; int lf[2][650][650], rm[2][650][650], st[2][650][650];// 초기화완료 bool sd; // dfs1 int vst1[650][650], v; int dr[] = { -1, 0, 1, 0 }; int dc[] = { 0, 1, 0, -1 }; int rb, cb;// 초기화 완료 void dfs1(int r, int c) { vst1[r][c] = v; rm[!sd][r][c] = rm[sd][r][c] - 1;// 수명 감소 if (rm[sd][r][c] == 0 && st[s..
SWEA 제주도 여행
#include #include #define f(i, n) for(int i = 0; i < (n); ++i) using namespace std; int T, N, M; int adj[35][35]; struct info { char tp; int tm, st; }; info atr[35]; int ap;// 공항 int ht[35], hts;// 초기화 완료 // dfs int rt[35]; int msts, mrt[35], mrts;// 초기화 완료 bool vst[35]; // tc void bf(int s, int hr, int dy, int sts) { bool go_ht = false; bool go_ap = false; for (int u = 0; u < N; ++u) { if (vst[..
SWEA 1824 혁진이의 프로그램 인증
설계: 결국에는 src에서 dst로 갈 수 있는지 dfs(vst 추가 차원 필요) 코드: 처음에는 visited를 좌표, 메모리 기준으로만 처리했으나 3개의 TC가 통과되지 않아 방향을 추가하여 AC #include #define f(i, n) for(int i = 0; i < (n); ++i) using namespace std; int R, C; char prg[20][20]; int vst[20][20][18][4], v; int rot[4], rots; int dr[] = { -1, 0, 1, 0 }; int dc[] = { 0, 1, 0, -1 }; int ad[16], sb[16]; void edge(int &r, int &c) { if (r == -1) r = R - 1; else if (r..
백준 14889 스타트와 링크
문제: 14889번: 스타트와 링크 예제 2의 경우에 (1, 3, 6), (2, 4, 5)로 팀을 나누면 되고, 예제 3의 경우에는 (1, 2, 4, 5), (3, 6, 7, 8)로 팀을 나누면 된다. www.acmicpc.net 코드: 전체 경우의 수(tb의 상한 + 1, as의 크기)는 1