목록백준 (42)
Deep Learning study
#include using namespace std; int main(){ ios_base::sync_with_stdio(false); int N, dp[20][20][3] = {0,}, r[20][20]; cin >> N; for(int i=1 ; i r[i][j]; dp[1][2][0] = 1; for(int i = 1 ; i
#include #include using namespace std; #define x first #define y second #define INF 1e9 #define WALL 100 int g[10][10]; pair r,b,h; int n,m; bool rdrop = false; bool bdrop = false; void move(pair *a,pair *b,int opt){ int &rx = (*a).x, &ry = (*a).y; int &bx = (*b).x, &by = (*b).y; if(opt == 0){//왼쪽 for(int i=0 ; i m; char c; for(int i=0 ;i c; if(c == '#') g[i][j] = WALL; else if(c == 'O') h.x = i..
#include using namespace std; #define endl '\n' int main(){ ios_base::sync_with_stdio(false); stack stc; int N; string s; cin >> N; for(int i=0 ; i> s; if(s == "pop"){ if(stc.empty()) cout
#include using namespace std; #define pb push_back int N,M; int X[4] = {0,0,1,-1}; int Y[4] = {1,-1,0,0}; int dfs(int x, int y,int arr[][11]){ int ret = 1; for(int i = 0; i = 1 && nextX 0 && nextY > N >> M; for(int i = 1 ; i arr[i][j]; if( arr[i][j] == 2) posV.pb(make_pair(i,j)); else if(arr[i][j] == 0) posZ.pb(make_pair(i,j)); else one..
#include #include #include #include using namespace std; vector v[10001]; int visited[10001]; int finished[10001]; bool dfs(int x){ bool flag = true; visited[x] = 1; for(int nx : v[x]){ if(!visited[nx]) flag = dfs(nx); if(flag == false) break; else if(finished[nx] == 0) return false; } finished[x] = 1; return flag; } int main(){ ios_base::sync_with_stdio(0); int n; cin >> n; map m; for(int i=0 ;..
#include #include using namespace std; struct cost { int a, b; int c; bool operator c; } }cost[100001]; int parent[10001]; long long int sum; int set_find(int); void set_union(int, int,int); int main() { ios_base::sync_with_stdio(false); long long int v, e; cin >> v >> e; for (int i = 1; i cost[i].a >> cost[i].b >> cost[i].c; sort(cost + 1, cost + 1 + e); for (int i = 1; i
#include #include using namespace std; int dx[4] = {0,0,1,-1}; int dy[4] = {1,-1,0,0}; int g[100][100]; int d[100][100]; int main(){ int n,m; scanf("%d %d",&m,&n); for(int i=0 ;i