Skip to content

Instantly share code, notes, and snippets.

View chaoxu's full-sized avatar
😀

Chao Xu chaoxu

😀
  • University of Electronic Science and Technology of China
  • Chengdu, Sichuan, China
View GitHub Profile
import networkx as nx
import random
# Note NetworkX, flow must have positive capacity
# Hence we must build edges in both directions
# This is undesirable but we can't do much about it
# We assume in the graph, if (a,b) is an edge, then (b,a) is also an edge
# We also assume the default orientation is (a,b) where a<b
---
title: "Dial-a-Ride in Small Graphs"
author: "Yike Chen, **Chao Xu**, Jianbo Wang"
format:
revealjs:
incremental: false
css: custom.css
callout-icon: false
---
from gurobipy import *
from itertools import *
from functools import partial, reduce
import random
import sys
import math
from operator import mul
### Set and partition operations
@chaoxu
chaoxu / description.md
Last active March 18, 2021 18:09
Subset sum

This is demo code for the journal version of the faster subset sum paper.

Konstantinos Koiliaris and Chao Xu. 2019. Faster Pseudopolynomial Time Algorithms for Subset Sum. ACM Trans. Algorithms 15, 3, Article 40 (July 2019), 20 pages. DOI:https://doi.org/10.1145/3329863

@chaoxu
chaoxu / yotta.py
Last active July 21, 2020 02:21
Yotta quantiles
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import math
N = 400 # number of tickets
i = 100000 # number of trials
k = 52 # number of weeks
rate = 0.002 # standard apr
@chaoxu
chaoxu / VCG.md
Last active April 8, 2020 15:48
关于Visa GC

这么多GC里面最强力的GC应该是Visa GC了(同理还有Mastercard和amex的, 但是比较少见, 用起来差不多). Visa GC (VGC)会有不同的银行发行.

让p%为你的最强任意地方返现卡. 相信大多人这张卡是下面3个

  • 各种类似的2%返现卡.
  • Chase freedom unlimited, 1.5 UR, 价值2.25%.
  • Citi double cash, 可以转换成 2 TYP, 价值2.5%.
  • Amex blue business plus 2 MR 价值2.5% (上限是一年50k spend, 普通人应该用不完).
  • BoA premium + platinum honors 是2.625%.
@chaoxu
chaoxu / leetcode.md
Last active November 8, 2024 03:20
Interesting leetcode problems

This is an index of leetcode problems that I find interesting.

You can see many theoretical solutions by hqztrue here.

TCS Problems

Likely only people who work in the area knows the current best solution. The best solution is either in some paper, or requires advanced tricks.

  • 001 2SUM
  • 004 Median of Two Sorted Arrays
@chaoxu
chaoxu / mathconf.js
Last active May 2, 2021 06:36
Typora mathjax config. Need to change the file in `/Applications/Typora.app/Contents/Resources/TypeMark/index.html`
MathJax.Hub.Config({
skipStartupTypeset: true,
jax: ["input/TeX", "output/SVG"],
extensions: ["tex2jax.js", "toMathML.js"],
TeX: {
extensions: ["noUndefined.js", "autoload-all.js", "AMSmath.js", "AMSsymbols.js", "mediawiki-texvc.js"],
mhchem: { legacy: false },
Macros: {
R: '{\\mathbb{R}}',
import java.util.*;
class PLC{
public TreeMap<Integer, Integer> segmentlist = new TreeMap<Integer, Integer>();
public int upperBound = 0;
public int lastSlope = 0;
public int startValue = 0;
public int shift = 0;
private static int INF = 100000000;
private int lb() {