Skip to content

Instantly share code, notes, and snippets.

@sekiye
sekiye / c.cc
Created April 30, 2019 07:20
Google Code Jam 2011 Round 1A Problem C. Fair Fight small
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
@sekiye
sekiye / b.cc
Created April 29, 2019 11:51
Google Code Jam 2019 Round 1B Problem B. Draupnir
#include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
@sekiye
sekiye / b.cc
Created May 28, 2016 22:57
Google Code Jam 2016 Round 2 Problem B. Red Tape Committee
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
@sekiye
sekiye / a.py
Created May 28, 2016 22:44
Google Code Jam 2016 Round 2 Problem A. Rather Perplexing Showdown
from multiprocessing import Pool
def make_ans(s, N):
if N == 0:
return s
if s == 'R':
s1 = 'R'
s2 = 'S'
if s == 'S':
s1 = 'P'
@sekiye
sekiye / b.py
Created May 1, 2016 00:33
Google Code Jam 2016 Round 1B Problem B. Close Match
def Shift(ch, i):
return str((int(ch) + i + 10) % 10)
def compare(a, b):
if a[0] < b[0]:
return True
if a[0] == b[0] and a[1] < b[1]:
return True
if a[0] == b[0] and a[1] == b[1] and a[2] < b[2]:
return True
@sekiye
sekiye / a.py
Created May 3, 2015 12:07
Google Code Jam 2015 Round 1B Problem A. Counter Culture
def solve():
N = int(raw_input())
count = 1
while N > 1:
while N % 10 != 1:
N -= 1
count += 1
if N == 1:
continue
if N == int(str(N)[::-1]):
@sekiye
sekiye / b.py
Created April 18, 2015 10:35
Google Code Jam 2015 Round 1A Problem B. Haircut
def solve():
B, N = map(int, raw_input().split())
M = map(int, raw_input().split())
def f(n):
sum = 0
for m in M:
sum += n / m + 1
return sum
l = 0
@sekiye
sekiye / d.py
Created May 31, 2014 16:41
Google Code Jam 2014 Round 2 Problem Problem D. Trie Sharding
import itertools
class Trie:
class Node:
def __init__(self, x, bros = None, child = None):
self.data = x
self.bros = bros
self.child = child
# 子を求める
@sekiye
sekiye / b.py
Last active August 29, 2015 14:01
Google Code Jam 2014 Round 1C Problem B. Reordering Train Cars
import itertools
import math
def compress(s):
s2 = []
i = 0
while i < len(s):
while i + 1 < len(s) and s[i] == s[i + 1]:
i += 1
s2.append(s[i])
@sekiye
sekiye / a.cc
Last active August 29, 2015 14:00
Google Code Jam 2014 Round 1A Problem A. Charging Chaos
#include <iostream>
#include <algorithm>
#include <array>
#include <climits>
#include <cmath>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>