Skip to content

Instantly share code, notes, and snippets.

<tile>
<visual version="2">
<binding template="TileSquare150x150Text04" fallback="TileSquareText04">
<text id="1">Hello world!</text>
</binding>
</visual>
</tile>
@tanitanin
tanitanin / link_cut_tree.h
Last active August 29, 2015 14:17
Link-Cut 木
@tanitanin
tanitanin / splay_tree.h
Last active August 29, 2015 14:17
スプレー木
#pragma once
#include <vector>
#include <list>
// スプレー木
template<class T=int> class splay_tree {
public:
struct node;
@tanitanin
tanitanin / bitree.h
Last active August 29, 2015 14:17
二分木
#pragma once
#include <vector>
#include <list>
// 2分木
// 再配置もきっと怖くない
template<class T=int> class bitree {
public:
@tanitanin
tanitanin / tree.h
Last active August 29, 2015 14:17
子がたくさんある木っぽい構造
#pragma once
#include <vector>
#include <list>
// 子の数がたくさんあっても大丈夫な木
// 再配置もきっと怖くない
template<class T=int> class tree {
public:
@tanitanin
tanitanin / graph.h
Last active August 29, 2015 14:17
グラフ構造っぽいやつ
#pragma once
#include <vector>
#include <list>
// vectorの再配置されたら死ぬ
template<class T=int, class W=int, class F=int>
class graph {
public:
struct node;
@tanitanin
tanitanin / optionBinder.scala
Last active July 27, 2018 18:58
QueryStringBindable and Formatter for Option[T] ( @ Play Framework 2.x )
import play.api.data._
import play.api.data.format._
import play.api.data.format.Formats._
/**
* Option[T]をクエリとして解決するためのバインダ(必須でないパラメータなどに利用することを想定)
* 通常のFormと同様にbindFromRequestして使う
* クエリに該当するキーが含まれていない場合にはFormの値がNoneになる
*
* こんなかんじ (もっときれいに書きたいけど):
@tanitanin
tanitanin / install.sh
Created February 14, 2015 17:03
Install script for scala version manager
#!/usr/bin/env bash
do_svm_install() {
svm_path=$HOME/.svm
if [[ ! -d "$svm_path" ]]; then
echo "Making directory $svm_path"
mkdir -p $svm_path
fi
if [[ ! -e "$svm_path/bin/.git" ]]; then
@tanitanin
tanitanin / starrysky.h
Created December 19, 2014 17:06
Segment Tree for range add and minimum query
#pragma once
#include <vector>
#include <algorithm>
#include <limits>
template<class T>
class starrysky {
public:
struct node { T add; T min; };
@tanitanin
tanitanin / segtree_add_sum.h
Created December 19, 2014 16:35
Segment Tree for range add and range sum
#pragma once
#include <vector>
#include <algorithm>
template<class T>
class segtree {
public:
struct node { T all; T part; };
explicit segtree(size_t N=1, T init=0)