Skip to content

Instantly share code, notes, and snippets.

View alculquicondor's full-sized avatar

Aldo Culquicondor alculquicondor

View GitHub Profile
@alculquicondor
alculquicondor / partyproblem.m
Created March 27, 2012 02:51
Cocktail Party Problem
dir = strcat(pwd, "/");
f1 = strcat(dir, input("audio 1: ","s"));
f2 = strcat(dir, input("audio 2: ","s"));
[y, FS, BPS] = wavread(f1);
[z, FS, BPS] = wavread(f2);
FS
%y = lin2mu(y(1:400000),0);
%z = lin2mu(z(1:400000),0);
y = lin2mu(y(1001:50000),0);
z = lin2mu(z(1001:50000),0);
@alculquicondor
alculquicondor / progressbar.c
Created September 21, 2012 03:56
Console progress bar
#include <stdio.h>
#include <unistd.h>
int main() {
setvbuf(stdout, NULL, _IONBF, 0);
for(int i=0; i<100; i++) {
usleep(70000);
printf("\r");
switch(i%4) {
case 0: printf("/"); break;
@alculquicondor
alculquicondor / CF_240F.cpp
Created October 25, 2012 02:21
Codeforces 240F
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#define MAXN 100001
#define MAXST 262144
#define left(i) (i<<1)+1
#define center(l, r) (l+r)>>1
using namespace std;
@alculquicondor
alculquicondor / unionRange.cpp
Created October 26, 2012 22:43
Union Range
int C[MAXN], next[MAXN];
inline int findSet(int i) {
return (C[i] == i) ? i : (C[i] = findSet(C[i]));
}
inline int findNext(int i) {
return (next[i] == i) ? i : (next[i] = findNext(next[i]));
}
inline void unionSet(int i, int j) {
C[findSet(i)] = findSet(j);
}
@alculquicondor
alculquicondor / LA5780.cpp
Created October 30, 2012 20:37
LA 5780 - The Agency
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define foreach(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
vector<int> up, down, eq;
long long sumon;
#include <iostream>
#define MAXN 1001
using namespace std;
int main() {
int n, k, d[MAXN], s[MAXN], m[MAXN];
cin>>n>>k;
for(int i=0; i<n; i++)
cin>>d[i];
@alculquicondor
alculquicondor / CF_242A.py
Created November 11, 2012 17:41
Codeforces 242A
x, y, a, b = [int(x) for x in raw_input().split()]
A = []
for i in range(a if a>b else b+1, x+1):
for j in range(b, min(i, y+1)):
A.append((i, j))
print len(A)
for x in A:
print x[0], x[1]
@alculquicondor
alculquicondor / lat2012E.cpp
Created November 12, 2012 23:12
Latinamerica Regional 2012 E
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int W, D, A, K;
int p1[10], q1[10], p2[10], q2[10];
inline double y1(double x) {
@alculquicondor
alculquicondor / UVA12530.cpp
Created November 13, 2012 20:47
UVA 12530
#include <cstdio>
#include <vector>
#include <cstring>
#define MAXN 3000
using namespace std;
char T[60][60];
int r, c, dx[] = {-1, 1, 0, 0}, dy[] = {0, 0, -1, 1};
vector<int> adj[MAXN];
int pi[MAXN];
@alculquicondor
alculquicondor / pstring.cpp
Created November 20, 2012 22:46
SPOJ PSTRING
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int INF = 1<<30;
int M[10005][1005], n, m, pi[1005], c;
int A[1005], B[1005], savej[1005];
string T, P;