This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <map> | |
using namespace std; | |
struct Node { | |
map<char, int> next; // nodeの両端にcharをつけたときにいくnodeのindex | |
int len = 0; // 回文の長さ | |
int sufflink = 0; // nodeのsuffix palindromeであるnodeのindex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <algorithm> | |
#include <assert.h> | |
using namespace std; | |
// pivotを選ぶ. | |
char find_pivot_char(vector<string> &data, int left, int right, int depth) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
greed { | |
codeRoot = "../topcoder" | |
logging { | |
logLevel = OFF | |
logToStderr = true | |
logFolder = Logs | |
} | |
backup { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import groupby | |
def encoding_rle(s): | |
return "".join((k + str(len(list(g)))) for k, g in groupby(s)) | |
def decoding_rle(s): | |
return "".join(s[i] * int(s[i + 1]) for i in range(0, len(s), 2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
from struct import * | |
from binascii import * | |
class PC_OP_RS1: | |
def __init__(self, port): | |
self._ser = serial.Serial(port, 115200, timeout=1) | |
self._LED = pack('B', 0x69) # LED点灯 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; FTDIPORT.INF | |
; | |
; Copyright ゥ 2000-2015 Future Technology Devices International Limited | |
; | |
; USB serial port driver installation file for Windows 2000, XP, Server 2003, Vista, Server 2008, | |
; Windows 7, Server 2008 R2, Windows 8, Windows 8.1 and Server 2012 R2. | |
; | |
; | |
; IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE INSTALLING THE RELEVANT | |
; SOFTWARE: This licence agreement (Licence) is a legal agreement between you (Licensee or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; FTDIBUS.INF | |
; | |
; Copyright ゥ 2000-2015 Future Technology Devices International Limited | |
; | |
; USB serial converter driver installation file for Windows 2000, XP, Server 2003, Vista, Server 2008, | |
; Windows 7, Server 2008 R2, Windows 8, Windows 8.1 and Server 2012 R2. | |
; | |
; | |
; IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE INSTALLING THE RELEVANT | |
; SOFTWARE: This licence agreement (Licence) is a legal agreement between you (Licensee or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.cluster import KMeans | |
class Cluster: | |
def __init__(self, ids: [str], features: [[float]], centroid: []): | |
self.ids = np.array(ids) | |
self.features = np.array(features) | |
self.centroid = centroid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from collections import defaultdict | |
import queue | |
class Node: | |
def __init__(self, id_, name, weight): | |
self.id = id_ | |
self.name = name | |
self.weight = weight |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# 各ノードのコスト | |
nodes = {"BOS": 0, "EOS": 0, | |
"さ": 100, "さか": 200, "さかな": 100, "かな": 200, "なだ": 200, "だ": 10, "よ": 10} | |
# ノードのつながりのコスト | |
edges = {("BOS", "さ"): 30, | |
("BOS", "さか"): 30, | |
("BOS", "さかな"): 30, |