This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| vector<pair<int, int> > adj[N]; | |
| int dist[N]; | |
| void dijkstra(int ini, int n){ | |
| for(int i = 1; i <= n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 110; | |
| int dist[N][N]; | |
| void floyd(int n){ | |
| for(int k = 1; k <= n; k++){ | |
| for(int i = 1; i <= n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| vector<int> adj[N]; | |
| int dist[N]; | |
| void bfs(int ini, int n){ | |
| for(int i = 1; i <= n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| vector<int> adj[N]; | |
| bool vis[N]; | |
| void dfs(int u){ | |
| vis[u] = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| int parent[N], weight[N]; | |
| int find(int u){ | |
| if(u == parent[u]) return u; | |
| return parent[u] = find(parent[u]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| vector<pair<int, int> > adj[N]; | |
| int dist[N]; | |
| int main(){ | |
| int n, m; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int mdc(int a, int b){ | |
| if(b == 0) return a; | |
| return mdc(b, a%b); | |
| } | |
| int main(){ | |
| int a, b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int mdc(int a, int b){ | |
| if(b == 0) return a; | |
| return mdc(b, a%b); | |
| } | |
| int mmc(int a, int b){ | |
| return a*b/mdc(a, b); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| bool ehprimo(int n){ | |
| if(n == 1) return false; | |
| int sqn = sqrt(n); | |
| for(int i = 2; i <= sqn; i++){ | |
| if(n%i == 0){ | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int N = 1e5 + 10; | |
| bool notprime[N]; | |
| void crivo(int n){ | |
| int sqn = sqrt(n); | |
| notprime[1] = true; |
OlderNewer