Skip to content

Instantly share code, notes, and snippets.

@uerobert
uerobert / neerc-09-north-E.cpp
Created May 30, 2013 09:59
E. Enigmatic Device @ NEERC 2009 Northern Subregional.
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const int MOD = 2010;
const int MAX = 50011;
const int ITER = 12;
const int OFFSET = 2;
@uerobert
uerobert / CF-311D.cpp
Last active December 17, 2015 20:29
D. Interval Cubing @ Codeforces.
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
typedef long long ll;
const int MAX = 100011;
const int K = 48;
const int MOD = 95542721;
Resources for learning web design & front-end development:
================================================================================
**ONLINE**
Design
> http://52weeksofux.com
> http://thedesigncubicle.com
@uerobert
uerobert / UVA-12365-ST.cpp
Created May 6, 2013 23:45
12365. Jupiter Atacks! @ UVa Online Judge. (with Segment Tree)
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long LL;
#define MAX 100011
LL B, P, L, N, st[4 * MAX], M[MAX];
@uerobert
uerobert / COJ-1422.cpp
Last active December 17, 2015 01:19
1422. Range Multiplication @ Caribbean Online Judge.
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
using namespace std;
#define MOD 1000000009
#define MAX 1000011
@uerobert
uerobert / Timus-1028-BIT.cpp
Created May 6, 2013 16:53
1028. Stars @ Timus Online Judge. (with Fenwick Tree)
#include <iostream>
#include <vector>
using namespace std;
#define MAX 32111
int tree[MAX+1];
int read(int idx) {
int sum = 0;
@uerobert
uerobert / Timus-1028.cpp
Last active December 17, 2015 01:09
1028. Stars @ Timus Online Judge. (with Segment Tree)
#include <iostream>
#include <vector>
using namespace std;
#define MAX 32111
int st[4 * MAX], N;
int query(int v, int l, int r, int i, int j) {
if (i > r || j < l) return 0;
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
struct node{
int val;
void split(node& l, node& r){}
void merge(node& a, node& b)
{
val = min( a.val, b.val );
}
}tree[1<<(n+1)];
node range_query(int root, int left_most_leaf, int right_most_leaf, int u, int v)
{
@uerobert
uerobert / dinic-mincut.cpp
Last active December 10, 2015 02:48
Min-Cut (Dinic with edge list) with the least number of edges possible. (COJ - 2065)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
using namespace std;
#define MAX 5010
struct edge {
int from,to,cap,flow;