Skip to content

Instantly share code, notes, and snippets.

View mikebsg01's full-sized avatar
📚
Creativity Is Intelligence Having Fun!

Michael Serrato mikebsg01

📚
Creativity Is Intelligence Having Fun!
View GitHub Profile
@mikebsg01
mikebsg01 / DFS.cpp
Last active November 27, 2017 10:00
Problem: Printing All Paths from a given source to a destination with Depth-First Search (DFS) Algorithm - By: Michael Serrato
/*
* ALGORITHM: Depth-First Search (DFS)
*
* @author Michael Serrato <mikebsg01@gmail.com>
*/
#include <iostream>
#include <algorithm>
#include <cctype>
#include <vector>
#include <deque>
@mikebsg01
mikebsg01 / MaxHeapSort.cpp
Last active November 19, 2017 12:31
Max-Heap Sort (Algorithm) - By: Michael Serrato
/*
* ALGORITHM: MAX-HEAP SORT
*
* @author Serrato Guerrero Michael Brandon <mikebsg01@gmail.com>
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
@mikebsg01
mikebsg01 / Open-HashTable.cpp
Last active November 19, 2017 12:32
Open Hash Table (Data Structure) - By: Michael Serrato
/*
* PROGRAM: OPEN HASH TABLE
*
* @author Serrato Guerrero Michael Brandon <mikebsg01@gmail.com>
*/
#include <stdio.h>
#include <malloc.h>
/* ------------------------------- E S T R U C T U R A S ------------------------------- */
struct pair {
@mikebsg01
mikebsg01 / BinarySearchTree.cpp
Last active November 19, 2017 12:32
Binary Search Tree (Data Structure) - By: Michael Serrato
/*
* PROGRAM: Binary Search Tree (Data Structure)
*
* @author Serrato Guerrero Michael Brandon <mikebsg01@gmail.com>
*/
#include <iostream>
#include <cstdlib>
using namespace std;
struct Nodo {
@mikebsg01
mikebsg01 / Cameras.cpp
Last active March 12, 2017 21:23
ACM ICPC - Training 11/03/2017 - Problem: C. Cameras - SOLUTION: Barrido (Special Case)
#include <bits/stdc++.h>
#define MAXN 200001
#define printArray(array, n)\
for (int x = 0; x < n; ++x) {\
cout << array[x] << " ";\
}\
cout << endl;
#define view(x) cout<<#x<<": "<<x<<endl;
using namespace std;
@mikebsg01
mikebsg01 / Alphabet.cpp
Last active March 12, 2017 21:21
ACM ICPC - Training 11/03/2017 - Problem: A. Alphabet - SOLUTION: Longest Common Subsequence (DP)
#include <bits/stdc++.h>
#define MAXN 28
#define MAXM 52
#define printMatrix(matrix, n, m)\
for (int x = 0; x <= n; ++x) {\
for (int y = 0; y <= m; ++y) {\
cout << matrix[x][y] << " ";\
}\
cout << endl;\
}
@mikebsg01
mikebsg01 / gist:8da14f4f5218bd2c8e96
Created January 24, 2015 10:42
Entrenamiento IOI - Etapa #2 - Problem: IOI07 Miners - Judge: SPOJ - 24/01/2015 - Puntaje: 100% (AC) - DP (Dynamic Programming) & Mathematics.
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#define MAXN 100005
#define REP(i,x,y)\
for(i=((int) x); i<=((int) y); ++i){
#define END }
using namespace std;
int N;
@mikebsg01
mikebsg01 / gist:ca3d351843adfab2e9ac
Last active March 12, 2017 21:48
Entrenamiento IOI - Etapa #2 - Problem: A Game With Numbers - Judge: SPOJ - 12/31/2014 - Puntaje: 100% (AC) - Mathematics.
#include <iostream>
using namespace std;
unsigned long long int N;
int main(){
cin>>N;
if(N%10==0)
cout<<2<<"\n";
else
cout<<1<<"\n"<<N%10<<"\n";
return 0;
@mikebsg01
mikebsg01 / gist:fc554ae373988bef5aad
Last active March 12, 2017 21:52
Entrenamiento IOI - Etapa #2 - Problem: Industrial Nim - Judge: Codeforces - 09/01/2015 - Puntaje: 100% (AC) - (Theory Of Games).
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
int N;
lli sum = 0;
lli x,m,y,a,b;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int i;
@mikebsg01
mikebsg01 / gist:7fb047a2cf2e719c13bd
Last active March 12, 2017 21:53
[ SOLUCIÓN MEJORADA ] - Entrenamiento IOI - Etapa #2 - Problem: 4 Values whose Sum is 0 - Judge: ACM-ICPC Live Archive - 15/12/2014 - Puntaje: 100% (AC) - Meet In The Middle + Barrido.
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#define all(v) v.begin(), v.end()
#define ver(x) cout<<#x<<": "<<x<<"\n";
#define verP(x) cout<<#x<<": "<<*x<<"\n";
#define name(x) cout<<#x<<" \n";
#define MAXSZ 16000002
using namespace std;