Skip to content

Instantly share code, notes, and snippets.

View hamadu's full-sized avatar

hamadu hamadu

View GitHub Profile
@hamadu
hamadu / doc.md
Last active February 23, 2017 16:11
Learn Docker

1. prepare files

  • Dockerfile
FROM ruby:2.3.3

# install necessary packages
RUN apt-get update -qq && apt-get install -y build-essential nodejs npm sqlite3 --no-install-recommends
use std::io;
// fn tokenize(line: CharIndices) {
// }
//
// fn parse(line: &str, l: usize) {
// let n = line.len();
// let mut idx = l;
//
// let indices = line.char_indices();
use std::io;
use std::collections::HashMap;
#[derive(Debug)]
enum JSONToken {
OpenObject,
CloseObject,
OpenArray,
CloseArray,
Colon,
@hamadu
hamadu / sample.md
Created April 16, 2017 15:01
GCJ Qual A editorial

GCJ Qualification Round

  • やさしい: Oversized Pancake Flipper
  • やさしい: Tidy Numbers
  • ふつう: Bathroom Stalls
  • むずい: Fashion Show

18000/25000人が通過

  • 予選通過ボーダーは25点
package data_structure;
import utils.BitVector;
import java.util.*;
public class WaveletTree {
BitVector[] which;
public int z;
public int level;
@hamadu
hamadu / CountRangeCoveringRange.java
Created April 22, 2017 09:13
Range in range (solution 1)
import data_structure.fenwick.FenwickTree;
import java.util.Arrays;
public class CountRangeCoveringRange {
/**
* Counts how many ranges in [l,r).
* Answers multiple query.
*
* O((n+q)log(n+q) where q = query.length, n = ranges.length
import data_structure.persistent.PersistentSegmentTree;
import java.util.Arrays;
import java.util.HashMap;
import java.util.TreeMap;
public class CountRangeCoveringRangeOnlinePersistent {
TreeMap<Integer,Integer> endMap;
PersistentSegmentTree segmentTree;
@hamadu
hamadu / BitVector.java
Last active April 22, 2017 09:23
Range in range (solution 3)
import java.util.*;
public class BitVector {
public int n;
public int m;
public long[] bits;
public BitVector(int length) {
n = length;
bits = new long[(n+63)>>>6];
@hamadu
hamadu / F.java
Created May 1, 2017 12:17
Ants On a Circle
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class F {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);
@hamadu
hamadu / F.java
Created May 1, 2017 12:17
Ants On a Circle
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class F {
public static void main(String[] args) {
InputReader in = new InputReader(System.in);
PrintWriter out = new PrintWriter(System.out);