목록Algorithm/ES (완전탐색) (23)
:: ADVANCE ::
BAEKJOON ONLINE JUDGE 1063 킹 https://www.acmicpc.net/problem/1063 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614..
BAEKJOON ONLINE JUDGE 3055 탈출 https://www.acmicpc.net/problem/3055 BFS 두번 돌리기물이 차는 것과 비버가 움직이는 queue물이 찰 곳으로 비버가 움직일 수 없기 때문에 물을 먼저 채우고 비버를 이동시킨다.끝은 비버가 더이상 움직일 수 없으면 그만둔다. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111..
BAEKJOON ONLINE JUDGE 3055 탈출 https://www.acmicpc.net/problem/3055 동시 이동 시 비버가 이동한 곳에 물이 잠기므로 비버는 물이 이동할 곳으로 갈 수 없다.따라서 물이 먼저 이동한 후에 비버가 이동해야 한다. 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115#include #inclu..
BAEKJOON ONLINE JUDGE 2412 암벽 등반 https://www.acmicpc.net/problem/2412 이진탐색 문제집에서 본 문제지만bfs로도 풀리는 문제탐색 시간을 줄이기 위해 x, y를 오름차순 정렬자신의 x와 왼쪽으로 2보다 작은 지점들만 검사, +2 보다 작은 지점들만 검사하여 시간을 줄임-> y도 x에 따라서 정렬을 한 후에 이진탐색으로 위치를 찾아서 거기까지만 탐색하게 하면 시간을 더 줄일 수 있을 듯 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566#include #include #include #i..
BAEKJOON ONLINE JUDGE 한국정보올림피아드 시.도 지역본선 2005 2589 보물섬 https://www.acmicpc.net/problem/2589 10분 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869#include #include using namespace std; int height, width;char map[51][51]; int bfs(int starty, int startx){ int visit[51][51] = { 0, }; int mx = 0; int dy[4] = { -1, 0, 0, 1..
BAEKJOON ONLINE JUDGE 한국정보올림피아드 1999 2644 촌수계산 https://www.acmicpc.net/problem/2644 11분 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152#include #include #include using namespace std; int n, one, two;vector family[101];int visit[101]; void bfs(){ queue que; que.push(one); visit[one] = 1; while (!que.empty()) { int p = que.front(); que.pop(); if (p =..
BAEKJOON ONLINE JUDGE 1260 DFS와 BFS https://www.acmicpc.net/problem/1260 엄청 틀려서 충격먹음!!처음에 풀때는 가볍게 한번에 맞았는데왜 다시 푸는데 엄청 틀렸지... 처음에는 인접행렬로 접근해서 연결된 정점의 순서가 오름차순으로 보장이 되었다.하지만 두번 째는 인접리스트로 데이터를 표현했다.--> 인접리스트는 입력 순서대로 넣기 때문에 순서는 보장하나 정점의 값의 정렬은 보장하지 않는다 !그냥 인접리스트에 있는 순서대로 탐색하면 오름차순으로 탐색하는것이 아닌건 당연!그래서 틀림 21분 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505..
BAEKJOON ONLINE JUDGE 한국정보올림피아드 시.도 지역본선 2012 7569 토마토 https://www.acmicpc.net/problem/7569 3차원 완전탐색 BFS11분 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374#include #include using namespace std; #define Flag 10000000 struct Point { int x, y, z;}; int width, height, length;int map[100][100][100];queue que;i..
BAEKJOON ONLINE JUDGE 한국정보올림피아드 시.도 지역본선 2013 7578 토마토 https://www.acmicpc.net/problem/7576 13분 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364#include #include using namespace std; #define Flag 10000000 int height, width;int map[1000][1000];queue que;int cnt; int bfs(){ int y, x; int dy[4] = { -1, 0, 0, 1 }; int dx[4] = { 0..
BAEKJOON ONLINE JUDGE 1759 암호 만들기 https://www.acmicpc.net/problem/1759 20 분 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465#include int c, n;char input[16];int mo[26];int alpha[26];char output[16]; void init(){ mo[0] = mo['e' - 'a'] = mo['i' - 'a'] = mo['o' - 'a'] = mo['u' - 'a'] = 1;} void dfs(int cnt, int a, int m, int j..