Skip to content

Instantly share code, notes, and snippets.

It's probably about Segment Trees

Juan Lopes juanplopes

It's probably about Segment Trees
Block or report user

Report or block juanplopes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am juanplopes on github.
  • I am juanplopes ( on keybase.
  • I have a public key ASAbnYPzQC3kur2g1skku3Eodfvw_egjtxXfetmlGRTC-wo

To claim this, I am signing this object:

juanplopes / fighting_the_zombie.cpp
Created Jan 10, 2017
Hacker Cup 2017 solutions
View fighting_the_zombie.cpp
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <iomanip>
using namespace std;
int DD[6] = {4, 6, 8, 10, 12, 20};
double D[6][25][500];
juanplopes /
Created Nov 3, 2016
Generates ILP problem to be solved by glpsol
from collections import defaultdict
def name1(i):
return chr(ord('A')+i)
def name2(x, n):
return ''.join(name1(i) for i in xrange(n) if x&(1<<i))
def print_model(L, U, n, G):
for x in range(1, 2**n):
View test.cpp
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int T[100];
vector<set<int> > V;
bool test(int C, set<int> &X, set<int> &Y) {
int count = 0;
juanplopes /
Created Oct 23, 2016
Downloads problems, best submissions and leaderboard from IEEExtreme 10 competition
#!/usr/bin/env python2
from collections import defaultdict
import requests, json, zipfile
EXT = {'python': 'py'}
juanplopes /
Created Jul 28, 2016
Modifiable binary heap
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
public class UpdateHeap<V> implements Iterable<V> {
private final Comparator<V> comparator;
private final HashMap<V, Entry> map;
private Entry[] heap;
View gist:558a46c06eb52aeff5c64a3861943105
def push(stack, el): stack+(el,);
def pop(stack): (stack:take(len(stack)-1), stack:get(len(stack)-1));
def memset(state, key, value): (state |> @filter({0}!=key)) + ((key, value),);
def memget(state, key): state |> last({1}):if({0}==key)# ?? 0;
def memadd(state, key, value): memset(state, key, memget(state, key)+value);
def findclosing(code, i):
(1, i+1):unfold(fun(count, i):
i >= len(code) or count == 0 ? null,
code:get(i) == '[' ? (i, (count+1, i+1)),
juanplopes /
Created Feb 18, 2016
Object Pool example
package example;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
public static void main(String... args) throws Exception {
ObjectPool<ExpensiveObject> pool = new ObjectPool<ExpensiveObject>() {
View test.cpp
#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
struct Dist {
int node, d;
Dist(int node, int d) : node(node), d(d) { }


This is ok:

for(int i = 1; i <= floor(sqrt(n)); i++) {
You can’t perform that action at this time.