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 <cstdio> | |
#include <cstring> | |
#include <algorithm> | |
using namespace std; | |
const int NN = 1024; | |
/* Suffix Array {{{ */ | |
char txt[NN*100]; | |
int len; |
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
[luiz@hydra ~]$ xlsfonts -fn "-xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-*" | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso10646-1 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-1 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-13 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-15 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-16 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-2 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-5 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-7 | |
-xos4-terminus-medium-r-normal--14-101-100-100-c-0-iso8859-9 |
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
/* Kosaraju SCC {{{ */ | |
int n; | |
vector<int> adj[NN], jda[NN]; /* G, G^T */ | |
int vis[NN], num[NN], scc[NN]; | |
int cnt, scccnt; | |
void dfs(int v) { | |
int i; | |
vis[v] = 1; | |
for(i = 0; i < (int)adj[v].size(); i++) |
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
/* | |
luizribeiro's topcoder library | |
dp.cpp | |
*/ | |
/* Longest Increasing Subsequence {{{ */ | |
vector<int> a; | |
bool liscmp(int i, int j) { return a[i] < a[j]; } | |
vector<int> lis() { | |
int n = a.size(); |
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 <cstdio> | |
#include <queue> | |
using namespace std; | |
#define NN 128 | |
#define DD 1024 | |
#define INF (1<<20) | |
int n, m, a, d; |
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 <cstdio> | |
#include <queue> | |
using namespace std; | |
#define NN 128 | |
#define DD 1024 | |
#define INF (1<<20) | |
int n, m, a, d; |
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 <cstdio> | |
#include <algorithm> | |
#include <cstring> | |
using namespace std; | |
const int NN = 17; | |
int n, m; | |
int w[NN][NN]; | |
int dp[1<<NN]; |
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 <cstdio> | |
#include <vector> | |
#include <queue> | |
#include <algorithm> | |
using namespace std; | |
/* Edmonds-Karp {{{ */ | |
int n, m; | |
vector<int> u, v, cap, flow, next; | |
vector<int> first, prev; |
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
#!/usr/bin/env python2 | |
import urllib | |
import urllib2 | |
import cookielib | |
import sys | |
import os | |
# Config {{{ | |
LA_LOGIN = "luizribeiro" | |
LA_PASSW = "minhasenha" |
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 <cstdio> | |
#include <queue> | |
using namespace std; | |
const int NN = 1024; | |
int d[NN][NN], t; | |
int n, w, h; | |
int xs, ys, xt, yt; | |
int x, y; |