Skip to content

Instantly share code, notes, and snippets.

@howsiwei
howsiwei / terminfo-24bit.src
Created September 25, 2023 10:07
24-bit color terminal
xterm-24bit|xterm with 24-bit direct color mode,
use=xterm-256color,
setb24=\E[48\:2\:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%dm,
setf24=\E[38\:2\:\:%p1%{65536}%/%d\:%p1%{256}%/%{255}%&%d\:%p1%{255}%&%dm,
@howsiwei
howsiwei / xkjd-phonetics-rules.md
Created February 19, 2023 06:30
键道音码
声母 声母键位 可拼合韵母
ch/zh 仅J/Q键(外侧) anangenenguun
ch/zh 仅W/F键(内侧) aaiiongouuauaiuanuanguiuo
ch/zh 飞键 aoe
@howsiwei
howsiwei / shortestpath3.cpp
Last active May 16, 2020 19:06
shortestpath3
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
constexpr int oo = 1 << 24;
int n;
void solve() {

Keybase proof

I hereby claim:

  • I am howsiwei on github.
  • I am howsiwei (https://keybase.io/howsiwei) on keybase.
  • I have a public key ASCPNgtGHW5TnZxaf1uq0DL3XyzYURhhFsiKOnkTFCIk9Qo

To claim this, I am signing this object:

@howsiwei
howsiwei / AVLTree.java
Last active September 26, 2016 02:07
Immutable AVL Tree in Java
abstract class AVLTree<E extends Comparable<E>> {
protected final E element;
protected final AVLTree<E> left, right;
protected final int height;
public final int size;
protected AVLTree(E element, AVLTree<E> left, AVLTree<E> right, int height, int size) {
this.element = element;
this.left = left;
this.right = right;
#include <iostream>
#include <cstdio>
#include <vector>
#include <stack>
using namespace std;
vector<vector<int>> adjl;
vector<int> low;
stack<int> t;
vector<bool> popped;
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <numeric>
#include <stack>
#include <tuple>
using namespace std;
class SD {
@howsiwei
howsiwei / dinic.cpp
Last active December 15, 2018 00:37
dinic
// Solution to https://open.kattis.com/problems/maxflow
#include <iostream>
#include <vector>
#include <queue>
#include <limits>
using namespace std;
#define SZ(a) (int)(a).size()
template<typename F>
@howsiwei
howsiwei / SegmentTree.cpp
Last active January 20, 2016 01:23
Segment Tree
#include <vector>
using namespace std;
class SegmentTree {
int n;
vector<int> t;
public:
SegmentTree(const vector<int>& a) : n(a.size()), t(2*n) {
for (int i = 0; i < n; i++) {
t[n+i] = a[i];