Skip to content

Instantly share code, notes, and snippets.

View hamadu's full-sized avatar

hamadu hamadu

View GitHub Profile
57 34 26
5 47 66
35 27 1
31 27 48
26 25 24
29 24 100
28 29 41
55 1 3
32 16 25
34 20 20
6 5 3
1 2 10
2 3 91
3 1 12
4 5 18
5 6 57
@hamadu
hamadu / InputCheckerA.java
Created December 10, 2012 07:04
InputChecker of problemA in WUPC2nd.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
public class InputCheckerA {
public static void main(String[] args) throws Exception {
File inputDir = new File("/path/to/the/input/files/directory");
for (File file : inputDir.listFiles()) {
BufferedReader reader = new BufferedReader(new FileReader(file));
@hamadu
hamadu / InputCheckerI.java
Created December 10, 2012 07:17
InputChecker of problemI in WUPC2nd.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
public class InputCheckerI {
public static void main(String[] args) throws Exception {
String[] substasks = new String[]{"small", "large1", "large3"};
for (String substask : substasks) {
File inputDir = new File("/path/to/the/input/directory/" + substask);
@hamadu
hamadu / InputCheckerE.java
Created December 10, 2012 11:40
InputChecker of problemE in WUPC2nd.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
public class InputCheckerE {
public static void main(String[] args) throws Exception {
String[] substasks = new String[]{"nonloop", "loop"};
for (String substask : substasks) {
File inputDir = new File("/path/to/the/input/data/" + substask);
@hamadu
hamadu / FixTheFence.java
Created March 13, 2013 17:07
Marathon Match 78
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class FixTheFence {
boolean _debug = false;
long _xtime = 10000;
long _start_time = -1;
@hamadu
hamadu / Main.java
Created April 11, 2014 06:08
Benchmark
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
static final long MOD = 1000000007;
@hamadu
hamadu / SquareRemover.cpp
Created April 24, 2014 02:57
TCO14 Marathon Round1
bool DEBUG = false;
double TLE = 30.0;
long _xtime = 30000;
int _maxTurn = 10000;
bool _debug = false;
#include <vector>
#include <list>
#include <map>
@hamadu
hamadu / combination.hs
Last active August 29, 2015 14:06
Haskellにおけるメモ化再帰の実装
import qualified Data.Map as Map
type Memo = Map.Map (Int,Int) Int
combination :: Memo -> Int -> Int -> (Int, Memo)
combination memo n r
| r == 0 = (1, memo)
| n == r = (1, memo)
| otherwise =
case Map.lookup (n,r) memo of
# Tree+Heap=Treap
class Treap
attr_accessor :value, :left, :right, :priority
# 空の頂点
def self.empty()
obj = self.new
obj.value = -1
obj.priority = rand(0.0...1.0)
obj