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 <iostream> | |
| #include <cmath> | |
| #define MAX_N 505 | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| using namespace std; | |
| int N; | |
| int dx[] = {-1,0,1,0}; | |
| int dy[] = {0,1,0,-1}; | |
| bool visitado[MAX_N][MAX_N]; | |
| int Mapa[MAX_N][MAX_N]; |
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 <iostream> | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| #define MAX_N 2005 | |
| using namespace std; | |
| typedef struct coord{ | |
| short x; | |
| short y; | |
| }Coord; |
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 <iostream> | |
| #include <algorithm> | |
| using namespace std; | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| #define MAX_NAVES 100002 | |
| #define MAX_K 1002 | |
| typedef unsigned long int UL; | |
| struct punto{ | |
| UL x; |
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 <iostream> | |
| using namespace std; | |
| #define MAX_LETRAS 26 | |
| int MapaMexicanos[MAX_LETRAS]; | |
| int MapaColombianos[MAX_LETRAS]; | |
| int Costos[MAX_LETRAS]; | |
| string letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | |
| int getNumLetra(char a){ |
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 <iostream> | |
| using namespace std; | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| #define MAX_ROWS 1001 | |
| int M[MAX_ROWS][MAX_ROWS]; | |
| int T[MAX_ROWS][MAX_ROWS]; | |
| int suma(int a,int b,int q,int r){ |
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 <iostream> | |
| #define MAX_N 30002 | |
| using namespace std; | |
| int N[MAX_N]; | |
| int main(){ | |
| int n; | |
| cin>>n; | |
| int cont = 0; | |
| for(int i=0;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 <iostream> | |
| #include <algorithm> | |
| #include <queue> | |
| #define MAX_ROWS 502 | |
| #define MAX_ADY 4 | |
| #define INF 1 | |
| using namespace std; | |
| int dx[] = {-1,0,1,0}; | |
| int dy[] = {0,1,0,-1}; |
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 <iostream> | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| #define MAX_NODOS 1000002 | |
| int Parent[MAX_NODOS]; | |
| int PersonasConocidas[MAX_NODOS]; | |
| using namespace std; | |
| int Find(int x){ | |
| if(Parent[x] ==x) return x; |
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 <iostream> | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| #define MOD 1000000007 | |
| using namespace std; | |
| typedef long long ULL; | |
| ULL formas(ULL N){ | |
| ULL Bant = 2; | |
| ULL Bpost = 3; | |
| ULL Nant = 1; |
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
| /** | |
| https://www.hackerearth.com/practice/data-structures/advanced-data-structures/fenwick-binary-indexed-trees/practice-problems/algorithm/spartans-leonidas-vs-xerxes-monk/ | |
| */ | |
| #include <iostream> | |
| #define MAX_N 100002 | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| int Soldiers[MAX_N]; | |
| int segTree[3*MAX_N]; | |
| using namespace std; |