목록boj (4)
Deep Learning study
#include using namespace std; #define FOR(i,a,b) for(int i=a ; i=0 && a=0 && b > N >> M; FOR(i,0,N) FOR(j,0,M) cin >> A[i][j]; FOR(i,0,N) FOR(j,0,M){ dfs(i,j,1,A[i][j]); ex(i,j); } cout
#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