Skip to content

Instantly share code, notes, and snippets.

View ftiasch's full-sized avatar

Xiaoxu Guo ftiasch

View GitHub Profile
from fractions import gcd
def read():
return map(int, raw_input().split())
if __name__ == "__main__":
while True:
try:
a, b = read()
except EOFError:
#include <cstdio>
#include <cstring>
#include <climits>
#include <vector>
#include <queue>
#include <algorithm>
const int M = 200;
int a[M], b[M], c[M];
#include <cassert>
#include <cstdio>
#include <cstring>
#include <climits>
#include <vector>
#include <functional>
#include <algorithm>
const int N = 50000;
@ftiasch
ftiasch / brute.cpp
Created October 8, 2013 16:39
greedy hungarian algorithm
#include <cstdio>
#include <cstring>
#include <algorithm>
const int N = 1000;
int n, graph[N][N], match[N];
bool visit[N];
bool find(int u) {
@ftiasch
ftiasch / G.cpp
Created October 20, 2013 11:56
Chengdu 2013 Problem G GRE Word Revenge
#include <cassert>
#include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <queue>
#include <utility>
#include <algorithm>
const int MAX_NODE = 123456;
~/Dropbox/homeworks/combinatorics-cs477/09 brew --config
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/mxcl/homebrew
HEAD: aee75f1898c0628523e41fdd665abadc647209d7
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.9-x86_64
Xcode: 5.0.2
CLT: 5.0.1.0.1.1382131676
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
const int N = 100000;
int n, m, w[N], a[N], b[N], order[N];
@ftiasch
ftiasch / Rakefile
Last active August 29, 2015 13:56
A auto-updated scripts for topcoder arena
require 'rexml/document'
require 'open-uri'
task :default => :run
task :run do
sh '(java -classpath "lib/*" com.topcoder.client.contestApplet.runner.generic www.topcoder.com 5001 >/dev/null 2>&1 &)'
end
task :update do
@ftiasch
ftiasch / Brute.java
Last active August 29, 2015 13:58
GD vs ZJ Problem E
import java.io.*;
import java.math.*;
import java.util.*;
public class Brute {
public void run() {
try {
int testCount = reader.nextInt();
for (int t = 1; t <= testCount; ++ t) {
int n = reader.nextInt();
@ftiasch
ftiasch / Makefile
Created May 15, 2014 02:07
Reliable Transport Protocol
CCFLAGS=-w
main: main.c
${CC} ${CCFLAGS} main.c -o main