bzoj3221.cc

#include #include #include using namespace std; typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) struct edge { int t; edge *next; }; struct seg { dint a, b, s; int t; seg *ls, *rs; }; #define sgt_root 1,n+1 #define midp ((pl+pr)»1) #define pls pl,midp #define prs midp,pr const int maxn = 100009; int n, m, p; int d[maxn], sz[maxn], fa[maxn], tc, fc[maxn], ch[maxn], fs[maxn]; int dfb[maxn], dfe[maxn], dfo[maxn], ci, ti; edge elst[maxn « 1], *ep(elst), *head[maxn]; seg *rt[0];...

March 23, 2015 · 5 min · laekov

bzoj3328.cc

#include #include #include using namespace std; typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) #define mInc(a,b) { a += b; if (a >= mod) a -= mod; } const int maxn = 40009; dint n; int k, mod; struct matrix { static const int n = 2; int a[n][n]; matrix() {} void init() { memset(a, 0, sizeof(a)); } void setOne() { memset(a, 0, sizeof(a)); for (int i = 0; i < n; ++ i) a[i][i] = 1; } void operator =(const matrix& b) { memcpy(a, b....

March 22, 2015 · 3 min · laekov

bzoj2700.cc

#include #include #include using namespace std; typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) const int maxn = 1009; const dint inf = 0x3f3f3f3f3f3f3f3fll; int n, m, ca[maxn], cb[maxn], ta, tb; dint f[maxn][maxn][5]; #define upMin(a,b) { if (a > b) a = b; } dint dp() { memset(f, 0x3f, sizeof(f)); if (ta) f[1][0][0] = ca[0] * n; if (tb) f[0][1][2] = cb[0] * n; for (int i = 0; i <= ta; ++ i) for (int j = 0; j <= tb; ++ j) if (n - i - j > 0) { int cc(n - i - j); if (f[i][j][0] < inf) { if (i < ta) upMin(f[i + 1][j][1], f[i][j][0] + ca[i] * cc); if (j < tb) upMin(f[i][j + 1][2], f[i][j][0] + cb[j] * cc); } if (f[i][j][1] < inf) { if (j < tb) upMin(f[i][j + 1][2], f[i][j][1] + cb[j] * cc); } if (f[i][j][2] < inf) { if (i < ta) upMin(f[i + 1][j][0], f[i][j][2] + ca[i] * cc); if (j < tb) upMin(f[i][j + 1][3], f[i][j][2] + cb[j] * cc); } if (f[i][j][3] < inf) { if (i < ta) upMin(f[i + 1][j][0], f[i][j][3] + ca[i] * cc); } } dint ans(inf); for (int i = 0; i <= n; ++ i) for (int j = 0; j < 4; ++ j) upMin(ans, f[i][n - i][j]); return ans; }...

March 20, 2015 · 2 min · laekov

bzoj2683.cc

#include #include #include #include using namespace std; const int max_buf = 4567; char buf[max_buf], *bufb(buf), *bufe(buf + 1); #define readBuf() { if (++ bufb == bufe) bufe = (bufb = buf) + fread(buf, 1, sizeof(buf), stdin); } #define readInt(x) { register int s(0); do { readBuf(); } while (!isdigit(*bufb)); do { s = s * 10 + *bufb - 48; readBuf(); } while (isdigit(*bufb)); x = s; } struct query { int t, x, y, v; };...

March 20, 2015 · 3 min · laekov

bzoj2482.cc

#include #include #include #include using namespace std; const int max_buf = 4567; char buf[max_buf], *bufb(buf), *bufe(bufb + 1); #define readBuf() { if (++ bufb == bufe) bufe = (bufb = buf) + fread(buf, 1, sizeof(buf), stdin); } #define readInt(x) { register int s(0); register bool nag(0); do { readBuf(); } while (!isdigit(*bufb) && *bufb != ‘-’); if (*bufb == ‘-’) { nag = 1; readBuf(); } do { s = s * 10 + *bufb - 48; readBuf(); } while (isdigit(*bufb)); if (nag) x = -s; else x = s; }...

March 18, 2015 · 3 min · laekov

bzoj2400.cc

#include #include #include using namespace std; struct edge { int t, c, v; edge *next, *rv; }; typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) const int maxn = 509; const int maxm = 2009; const int maxe = 10009; const int inf = 0x3f3f3f3f; dint ansc, ansv; int n, m, ea[maxm], eb[maxm], v[maxn], st, te; int d[maxm], fp[maxn]; edge *ep, *head[maxn], elst[maxe], *fe[maxn];...

March 17, 2015 · 3 min · laekov

bzoj2986.cc

#include #include #include using namespace std; typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int) const int maxp = 300009; const dint maxv = 1e11; int pn[maxp], tp; bool pr[maxp]; dint qv, x, cnt; void pre() { memset(pr, 0, sizeof(pr)); tp = 0; for (int i = 2; i < maxp; ++ i) { if (!pr[i]) pn[tp ++] = i; for (int j = 0; j < tp && i * pn[j] < maxp; ++ j) { pr[i * pn[j]] = 1; if (i % pn[j] == 0) break; } } }...

March 17, 2015 · 1 min · laekov

pineapple.vim

" local syntax file - set colors on a per-machine basis: " vim: tw=0 ts=4 sw=4 " Vim color file " Maintainer: laekov laekov@163.com " Last Change: 2015 Feb " hi clear set background=dark syntax reset let g:colors_name=‘pineapple’ if has(‘gui’) hi Normal guibg=#000000 guifg=white hi SpecialKey term=bold ctermfg=4 guifg=Blue hi Directory term=bold ctermfg=4 guifg=Blue hi ErrorMsg term=standout cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red hi IncSearch term=reverse cterm=reverse gui=reverse hi Search term=reverse guibg=Blue guifg=White hi MoreMsg term=bold ctermfg=2 gui=bold guifg=White hi ModeMsg term=bold cterm=bold gui=bold hi LineNr term=underline ctermfg=3 guifg=Pink hi Question term=standout ctermfg=2 gui=bold guifg=White hi StatusLine term=bold,reverse cterm=bold,reverse gui=bold guifg=White guibg=Grey35 hi StatusLineNC term=reverse cterm=reverse gui=bold guifg=Grey10 guibg=Gray85 hi VertSplit guibg=Pink guifg=Black hi Title term=bold ctermfg=5 gui=bold guifg=DeepPink3 hi Visual term=reverse cterm=reverse gui=reverse guifg=Grey80 guibg=fg hi VisualNOS term=bold,underline cterm=bold,underline gui=bold,underline hi WarningMsg term=standout ctermfg=1 gui=bold guifg=Red hi WildMenu term=standout ctermfg=0 ctermbg=3 guifg=Black guibg=Yellow hi Folded term=standout ctermfg=4 ctermbg=7 guifg=Black guibg=#e3c1a5 hi FoldColumn term=standout ctermfg=4 ctermbg=7 guifg=DarkBlue guibg=Gray80 hi DiffAdd term=bold ctermbg=4 guibg=White hi DiffChange term=bold ctermbg=5 guibg=#edb5cd hi DiffDelete term=bold cterm=bold ctermfg=4 ctermbg=6 gui=bold guifg=LightBlue guibg=#f6e8d0 hi DiffText term=reverse cterm=bold ctermbg=1 gui=bold guibg=#ff8060 hi Cursor guifg=black guibg=white hi lCursor guifg=bg guibg=fg hi NonText guifg=green guibg=#1a1a1a " Colors for syntax highlighting hi Comment term=bold ctermfg=4 guifg=Cyan hi Constant term=underline ctermfg=1 guifg=Yellow hi Special term=bold ctermfg=5 guifg=#ff9c3a hi Identifier term=underline ctermfg=6 guifg=#9999ff hi Statement term=bold ctermfg=3 gui=bold guifg=#09f93f hi PreProc term=underline ctermfg=5 guifg=#888888 hi Type term=underline ctermfg=2 gui=bold guifg=#598ff9 hi Ignore cterm=bold ctermfg=7 guifg=bg hi Error term=reverse cterm=bold ctermfg=7 ctermbg=1 gui=bold guifg=White guibg=Red hi Todo term=standout ctermfg=0 ctermbg=3 guifg=Blue guibg=Yellow else hi Normal ctermfg=white ctermbg=0 hi ErrorMsg cterm=standout cterm=bold ctermfg=7 ctermbg=1 hi IncSearch cterm=reverse ctermbg=1 ctermfg=7 hi Search cterm=reverse ctermbg=7 ctermfg=blue hi Visual cterm=reverse if $TERM == ‘xterm-256color’ " hi NonText cterm=bold ctermbg=232 ctermfg=2 " hi Type cterm=bold ctermfg=4 " hi Special cterm=bold ctermfg=172 hi NonText cterm=bold ctermbg=234 ctermfg=2 hi Type cterm=bold ctermfg=4 hi Special cterm=bold ctermfg=1 else hi NonText cterm=bold ctermbg=8 ctermfg=2 hi Type cterm=bold ctermfg=32 hi Special cterm=bold ctermfg=1 endif hi LineNr cterm=bold ctermfg=5 hi ModeMsg cterm=bold hi StatusLine cterm=bold ctermfg=7 ctermbg=8 hi StatusLineNC ctermfg=7 ctermbg=8 hi VertSplit ctermfg=0 ctermbg=5 hi Folded cterm=standout ctermfg=3 ctermbg=4 hi FoldedColumn cterm=standout ctermfg=3 ctermbg=4 “For syntax hilighter hi Comment cterm=bold ctermfg=6 hi Constant ctermfg=yellow hi Indentifier cterm=bold ctermfg=2 hi Statement cterm=bold ctermfg=2 hi PreProc cterm=bold ctermfg=darkgrey hi Ignore ctermfg=7 hi Error term=reverse cterm=bold ctermfg=7 ctermbg=1 hi Todo term=standout ctermbg=6 ctermfg=0 endif

March 17, 2015 · 2 min · laekov

vimrc

set guioptions-=m set guioptions-=T source $VIMRUNTIME/mswin.vim behave mswin set nu set softtabstop=4 set tabstop=4 set shiftwidth=4 set nobackup set mouse=a set fdm=marker set guifont=Source\ Code\ Pro\ Semibold:h16 set hlsearch set ruler if has(‘gui’) set columns=1000 set lines=1000 set cursorline endif map : call Save() map : !mvim -ro % map : !gdb –quiet %< map : call Compile() map : !bash check.sh map : !./%< <.in map : call Run() map : !...

March 17, 2015 · 2 min · laekov

hdu5189.cc

#include #include #include #include using namespace std; typedef pair <double, int> dpr; const int maxn = 30009; const int maxl = 15; const int max_buf = maxn * maxl * 2; const double eps = 1e-7; const double finf = 1e20; int ibuf_arr[max_buf], *ibuf; double fbuf_arr[max_buf], *fbuf; struct edge { int t; edge *next; }; struct line { double k, b; inline double xCross(const line& a) { return (a. b - b) / (k - a....

March 16, 2015 · 5 min · laekov