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 / boggle.cpp
Created August 31, 2014 07:33
Solución a "Boggle" 100pts. Preselectivo 2015 - Etapa 1 - Problemset #8
#include <stdio.h>
#include <string.h>
#define TABLERO 4
/*
Program: Boggle
Encoded by Michael Serrato.
*/
int N;
char tablero[5][5];
int mapa[5][5] = {0}; /* Mapa: Sirve como auxiliar
@mikebsg01
mikebsg01 / gist:2f81ccc0fe6209e52758
Created November 10, 2014 04:49
Noticias - 100pts (AC)
#include <bits/stdc++.h>
using namespace std;
int N, M;
int raiz[1000015];
int rango[1000015];
int encontrar(int n) {
if( raiz[n] == n )
return n;
else raiz[n] = encontrar( raiz[n] );
return raiz[n];
@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 / 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 / gist:6be6c7a6223cdcb607e4
Last active March 12, 2017 21:27
Problema Acciones (AC) - IOI-Etapa1-Problemset8
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <utility>
#define optimize ios_base::sync_with_stdio(0);cin.tie(0);
#define all(v) v.begin(), v.end()
#define first(v, n) v.begin(), v.begin()+n
#define second(v, n) v.begin()+n, v.begin()+(2*n)
@mikebsg01
mikebsg01 / gist:0b79c10b194044812995
Last active March 12, 2017 21:46
Creador de Grafos - 40pts (PA) [Terminar]
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define sz size
#define PS push
using namespace std;
typedef long long int lli;
int N;
@mikebsg01
mikebsg01 / gist:c969ddaefc6b3e9594c7
Last active March 12, 2017 21:47
Problema Inversiones (AC) - IOI-Etapa1-Problemset15 [Optimizar Solución]
#include <bits/stdc++.h>
#define X first
#define Y second
#define sz size
using namespace std;
typedef long long int lli;
int C,N;
lli Limite = 0;
lli AC = 0;
@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;