This file contains 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
# -*- coding: utf-8 -*- | |
import re | |
from math import log2 | |
from itertools import product | |
from collections import Counter | |
def powerK(loe, K): | |
if K < 0: | |
raise AssertionError("K must be positive") |
This file contains 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
# -*- coding: utf-8 -*- | |
if __name__ == '__main__': | |
T = "abracadabra$" | |
lT = len(T) | |
print("Input:", T) | |
sa = [T[i:] for i in range(lT)] | |
isa = list(zip(range(lT), sa)) | |
sorted_isa = sorted(isa, key=lambda x: x[1]) |
This file contains 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
# -*- coding: utf-8 -*- | |
def unary(x): | |
return "0" * (x - 1) + "1" | |
def binary(x): | |
return bin(x)[2:] | |
def gamma(x): | |
bx = binary(x) |
This file contains 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
/* | |
g++ -std=c++14 -o main main.cpp -I/home/cocomoff/sdsl-lite/build/include -L/home/cocomoff/sdsl-lite/build/lib -lsdsl -ldivsufsort -ldivsufsort64 | |
*/ | |
#include <bits/stdc++.h> | |
#include <sdsl/int_vector.hpp> | |
#include <sdsl/bit_vectors.hpp> | |
#include <sdsl/rank_support.hpp> | |
#include <sdsl/util.hpp> |
This file contains 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 <bits/stdc++.h> | |
#include <sdsl/wavelet_trees.hpp> | |
using namespace std; | |
using namespace sdsl; | |
int main() { | |
wt_int<rrr_vector<63>> wt; | |
// auto iv = int_vector<>({0, 7, 2, 1, 4, 3, 6, 7, 2, 5, 0, 4, 7, 2, 6, 3}); | |
auto iv = int_vector<>({0, 2, 1, 3, 2, 0, 2, 3}); |
This file contains 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 <random> | |
#include <vector> | |
#include "cuddObj.hh" | |
using namespace std; | |
int main() { | |
Cudd mgr; |
This file contains 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 <random> | |
#include <vector> | |
#include "cuddObj.hh" | |
using namespace std; | |
int main() { | |
Cudd mgr; |
This file contains 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
# -*- coding: utf-8 -*- | |
import networkx as nx | |
import networkx.algorithms as nxa | |
def longest_path_for_multidigraph(G, weight='weight', default_weight=1): | |
dist = {} | |
for v in nx.topological_sort(G): | |
us = [] | |
for u, data in G.pred[v].items(): |
This file contains 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 <fstream> | |
#include <iostream> | |
#include <tdzdd/DdSpec.hpp> | |
#include <tdzdd/DdStructure.hpp> | |
using namespace std; | |
class KnapsackZdd : public tdzdd::DdSpec<KnapsackZdd, int, 2> { | |
int const n; | |
int const *w; |
This file contains 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 <fstream> | |
#include <iostream> | |
#include <tdzdd/DdSpec.hpp> | |
#include <tdzdd/DdStructure.hpp> | |
using namespace std; | |
const bool DEBUG_ENUM = false; | |
class Combination : public tdzdd::DdSpec<Combination, int, 2> { |