This file contains hidden or 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 <cstdio> | |
#include <cstring> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
#define MAXN 1000 + 1 | |
#define MAXE 2*(MAXN) |
This file contains hidden or 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
#define MAXST 100000 | |
#define LogMAXST 18 | |
inline int clz(int x){return __builtin_clz(x);} | |
inline int lg2(int x){return !x ? -1 : 31 - clz(x);} | |
struct SparseTable { | |
int N; | |
int F[LogMAXST][MAXST]; |
This file contains hidden or 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 <cstdlib> | |
#include <cstring> | |
#include <ctime> | |
const int N = 100000; | |
const int M = 5000; | |
const int MOD = 100000000; | |
int A[N]; |
This file contains hidden or 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
bool extendpath(int x) { | |
for (int i = 1; i <= m; ++ i) | |
if (edge[x][i] && flag[i]) { | |
flag[i] = false; | |
if (matching[i] == -1 || extendpath(matching[i])) { | |
matching[i] = x; | |
return true; | |
} | |
} | |
return false; |
This file contains hidden or 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
typedef int F; | |
#define MAXE 50000 | |
#define MAXV 20000 | |
#define F_INF 1000000 | |
struct MaxFlow { | |
int V, E; | |
int start[MAXV], next[MAXE], v[MAXE]; | |
int used[MAXV], level[MAXV]; | |
F cap[MAXE], flow[MAXE]; |
This file contains hidden or 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
const int dx[4] = {0, 0, 1, -1}; | |
const int dy[4] = {1, -1, 0, 0}; | |
class Solution { | |
public: | |
void solve(vector< vector<char> > &board); | |
}; | |
void Solution::solve(vector< vector<char> > &board) { | |
int n = board.size(); |
This file contains hidden or 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 <stdio.h> | |
#include <math.h> | |
#define clear 1;if(c>=11){c=0;sscanf(_,"%lf%c",&r,&c);while(*++_-c);}\ | |
else if(argc>=4&&!main(4-(*_++=='('),argv))_++;g:c+= | |
#define puts(d,e) return 0;}{double a;int b;char c=(argc<4?d)&15;\ | |
b=(*_%__LINE__+7)%9*(3*e>>c&1);c+= | |
#define I(d) (r);if(argc<4&&*#d==*_){a=r;r=usage?r*a:r+a;goto g;}c=c | |
#define return if(argc==2)printf("%f\n",r);return argc>=4+ | |
#define usage main(4-__LINE__/26,argv) | |
#define calculator *_*(int) |
This file contains hidden or 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 <stdlib.h> | |
#include <stdio.h> | |
/* Create a lambda function. Note: unlike lambdas in functional | |
languages, this lambda does not capture the containing | |
environment. Thus, if you access the enclosing environment, you | |
must ensure that the lifetime of this lambda is bound by the | |
lifetime of the enclosing environment (i.e., until the enclosing | |
function returns). This means that if you access local |
This file contains hidden or 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 <vector> | |
#include <list> | |
#include <map> | |
#include <set> | |
#include <deque> | |
#include <stack> | |
#include <bitset> | |
#include <algorithm> | |
#include <functional> | |
#include <numeric> |
This file contains hidden or 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 <vector> | |
#include <list> | |
#include <map> | |
#include <set> | |
#include <deque> | |
#include <stack> | |
#include <bitset> | |
#include <algorithm> | |
#include <functional> | |
#include <numeric> |