Skip to content

Instantly share code, notes, and snippets.

View limabeans's full-sized avatar

Angel Lim limabeans

View GitHub Profile
@limabeans
limabeans / 796.cpp
Created August 31, 2019 17:36
uva 796, sol to find bridges in graph problem
// https://onlinejudge.org/external/7/796.pdf
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl
@limabeans
limabeans / srm741div2med.cpp
Created December 13, 2018 19:35
srm741div2med
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=(int)4e5+5;
@limabeans
limabeans / srm743d1easy.cpp
Created December 9, 2018 19:52
SRM 743 div1 easy
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=(int)4e5+5;
@limabeans
limabeans / uva481.cpp
Created December 3, 2018 04:49
uva481 - lis in nlogk time
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=(int)4e5+5;
@limabeans
limabeans / uva10496.cpp
Created December 2, 2018 05:36
uva10496 - TSP
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=(int)4e5+5;
@limabeans
limabeans / uva108.cpp
Created November 29, 2018 06:43
uva108 - max sum 2d
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=105;
@limabeans
limabeans / uva10684.cpp
Created November 29, 2018 06:20
uva10684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int maxn=(int)4e5+5;
@limabeans
limabeans / uva787.py
Last active November 29, 2018 06:08
uva787
import sys
readints=lambda:map(int, input().strip('\n').split())
# use python due to biginteger issues
def maxprod(arr):
maxarr=arr[0]
minarr=arr[0]
haszero = arr[0]==0
@limabeans
limabeans / uva507.cpp
Last active November 29, 2018 06:08
uva507
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<typename T>
void out(T x) { cout << x << endl; exit(0); }
const int inf = 1e9;
const int maxn=(int)4e5+5;
@limabeans
limabeans / pq.cpp
Created November 5, 2018 05:02
generic priority queue with functor comparator template argument
#include <bits/stdc++.h>
using namespace std;
namespace my {
template<class T, class F = less<T>>
struct priority_queue {
vector<T> v = {0};
T i=0; // index if last elem
F cmp = F();
priority_queue() {}