Skip to content

Instantly share code, notes, and snippets.

#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m,r,s,a[20][20];
int b[20][20], cst[20][20], dp[20][20];
int solve(int bit){
memset(b,0,sizeof(b));
#include <cstdio>
#include <vector>
using namespace std;
double dp[1<<16];
bool vis[1<<16];
double f(int bit){
if(bit == 0) return 0;
if(vis[bit]) return dp[bit];
#include <cstring>
#include <algorithm>
using namespace std;
int dp[305][305];
int dp2[305][305];
char str[305];
int f(int s, int e){
if(s > e) return 0;
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
typedef pair<lint,int> pi;
const int mod = 1e9 + 7;
int bino[1005][1005];
int n;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
@koosaga
koosaga / tri.cpp
Created October 7, 2015 16:03
ceoi 2009 triangle
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
int low[2505], dfn[2505], par[2505], piv;
int cpiv, vis[2505], pcc[2505];
vector<int> bcc[2505];
void dfs(int x, int p){
dfn[x] = low[x] = ++piv;
par[x] = p;
for(int i=0; i<graph[x].size(); i++){
int w = graph[x][i];
void dfs(int x, int p){
dfn[x] = low[x] = ++piv;
par[x] = p;
for(int i=0; i<graph[x].size(); i++){
int w = graph[x][i];
if(w == p) continue;
if(!dfn[w]){
dfs(w, x);
low[x] = min(low[x], low[w]);
}
void dfs(int x, int p){
dfn[x] = low[x] = ++piv;
par[x] = p;
for(int i=0; i<graph[x].size(); i++){
int w = graph[x][i];
if(w == p) continue;
if(!dfn[w]){
dfs(w, x);
low[x] = min(low[x], low[w]);
}