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 <memory> | |
#include "segment_attribute.hpp" | |
/**************************************** | |
* structure definitions of segments * | |
****************************************/ | |
enum SegmentType {Horizontal, Vertical, Italy}; | |
template <typename T, typename U, typename Attribute=BasicSegmentAttribute> |
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
class Data | |
{ | |
private: | |
int data; | |
public: | |
void setData(const int &data); | |
const int& getData() const; | |
}; |
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 <algorithm> | |
#include <cstring> | |
#include <ctime> | |
#define DIM 256 | |
#define LIMIT 1000000 | |
using namespace std; | |
class VectorWithRvalue |
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
// ==UserScript== | |
// @name railwayTicketFormAutoField | |
// @namespace http://railway.hinet.net/ctno1.htm | |
// @description Change some element on login page | |
// @include http://*railway.hinet.net/ctno1.htm | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js | |
// ==/UserScript== | |
var personalId = 'A123456789'; // 身份正字號 |
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
#ifndef BST_HPP | |
#define BST_HPP | |
#include <queue> | |
#include <algorithm> | |
#include <functional> | |
template <typename T> | |
struct BSTNode |
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
#ifndef DISJOINT_SET_HPP | |
#define DISJOINT_SET_HPP | |
#include <cstring> | |
#include <algorithm> | |
#define USE_RVALUE | |
/************** disjoint set **************** | |
* table: table[x] is root of x * | |
* rank: rank[x] is depth of x * |
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
#ifndef VALUE_TYPE_HPP | |
#define VALUE_TYPE_HPP | |
// value is true when T is a container with value_type defined in structure | |
// otherwise, T is a primitive type | |
template <class T> | |
struct has_value_type | |
{ | |
typedef char true_type; | |
typedef char false_type[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
#ifndef MST_HPP | |
#define MST_HPP | |
#include <algorithm> | |
#include "value_type.hpp" | |
#include "disjoint_set.hpp" | |
/************************** Minimum Spanning Tree (MST) ************************* | |
* find the cost of minimun spanning tree * | |
* using Kruskal to solve * |
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
#ifndef RSG_HPP | |
#define RSG_HPP | |
#include "mst.hpp" | |
#include "bst.hpp" | |
template <typename T> | |
class XLess | |
{ | |
private: |
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 <string.h> | |
#define MAX 400005 | |
/* Knuth-Morris-Pratt algorithm */ | |
// used for string matching, divide into 2 part: | |
// compute prefix/failure function and string matching | |
/******** KMP algorithm - 1st part: prefix function ********* | |
* compute the longest prefix that matches current suffix * | |
* i.e. abbab: the prefix function is 0 1 0 1 2 * |
OlderNewer