Skip to content

Instantly share code, notes, and snippets.

View hamadu's full-sized avatar

hamadu hamadu

View GitHub Profile
@hamadu
hamadu / IntHashMap.java
Created June 27, 2017 12:36
IntHashMap
import java.util.Arrays;
import java.util.Random;
public class IntHashMap {
int defaultValue;
int M;
int[] next;
int[] entryKey;
int[] entryValue;
int nextIndex;
```
│ const suffixStrings = buildSuffixStringTable(query, suffixOrder)
│ const suffixStringTable = world.table(160, 180, size, size, suffixStrings)
│+
│+ let color = 0
│ for (var i = 0 ; i < nl ; i++) {
│+
│+ if (i >= 1) {
│+ const sub1 = query.substr(suffixOrder[i])
│+ const sub2 = query.substr(suffixOrder[i-1])
#![allow(unused)]
use std::io;
use std::collections::*;
use std::str::FromStr;
fn main() {
let a: Vec<i32> = read_tokens();
let b: Vec<String> = read_tokens();
println!("Hello, wo123rld! : {} / {}", a[0] + a[1] + a[2], b[1]);
@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);
@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];
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 / 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
package data_structure;
import utils.BitVector;
import java.util.*;
public class WaveletTree {
BitVector[] which;
public int z;
public int level;
@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点