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 <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
struct SuffixArray { | |
int N, k; | |
string S; | |
vector<int> sa, rank, tmp; |
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 | |
if sys.version[0] == '2': | |
range, input = xrange, raw_input | |
def linear_recursion_solver(a, x, k, e0, e1): | |
# https://github.com/spaghetti-source/algorithm | |
def rec(k): | |
c = [e0] * n | |
if k < n: |
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 copy import deepcopy | |
import sys | |
if sys.version[0] == '2': | |
range, input = xrange, raw_input | |
class Matrix: | |
ZERO = 0 | |
ONE = (1 << 32) - 1 |
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 <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
const int INF = 1e7; | |
template <typename T> | |
struct MinCostFlow { |
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 <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
struct SuffixArray { | |
int N, k; | |
string S; | |
vector<int> sa, rank, tmp; |
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 | |
import collections | |
if sys.version[0] == '2': | |
range, input = xrange, raw_input | |
class MaxFlow: | |
"""Dinic Algorithm: find max-flow | |
complexity: O(EV^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
#include <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define INF 1<<29 | |
template <typename T> | |
struct MaxFlow { |
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 collections | |
class MaxFlow: | |
"""Dinic Algorithm: find max-flow | |
complexity: O(EV^2) | |
used in GRL6A(AOJ) | |
""" | |
class Edge: | |
def __init__(self, to, cap, rev): |
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 <bits/stdc++.h> | |
using namespace std; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define INF 1<<29 | |
template <typename T> | |
struct MaxFlow { |
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 collections | |
import sys | |
if sys.version[0] == '2': | |
input, range = raw_input, xrange | |
class MyList(list): | |
def __init__(self, x=[]): | |
list.__init__(self, x) |