Skip to content

Instantly share code, notes, and snippets.

@dudelson
dudelson / uva_10920_passing.cpp
Created January 8, 2017 18:51
My (passing) solution to UVA 10920
#include <iostream>
using namespace std;
typedef long long ll;
ll size, p, x, y;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
@dudelson
dudelson / uva_10920_failed.cpp
Created January 8, 2017 18:49
My incorrect solution for UVA 10920
#include <iostream>
typedef long long ll;
using namespace std;
ll size, p, x, y;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
@dudelson
dudelson / uva_978.cpp
Created January 7, 2017 02:02
My solution for UVA 978
#include <iostream>
#include <vector>
#include <set>
using namespace std;
int t, b, ng, nb;
multiset<int> green, blue;
int main() {
cin >> t;
for(int tt=0; tt<t; tt++) {
@dudelson
dudelson / uva_793.cpp
Created January 7, 2017 02:01
My solution for UVA 793
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
using namespace std;
vector<int> p, r;
inline void init(int n) {
p.resize(n);
r.resize(n);
@dudelson
dudelson / uva_599.cpp
Created January 7, 2017 02:01
My solution for UVA 599
#include <iostream>
#include <vector>
#include <map>
#include <utility>
using namespace std;
/* begin UFDS implementation */
int nSets;
map<char, char> p;
map<char, int> r, sizes;
@dudelson
dudelson / uva_12532.cpp
Created January 7, 2017 02:00
My solution for UVA 12532
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class SegmentTree {
private:
int n;
vector<char> st;
@dudelson
dudelson / uva_12086.cpp
Created January 7, 2017 02:00
My solution for UVA 12086
#include <iostream>
#include <string>
#include <vector>
using namespace std;
class FenwickTree {
private:
vector<int> ft;
int LSO(int b) { return (b&(-b)); }
public:
@dudelson
dudelson / uva_1203.cpp
Created January 7, 2017 01:59
My solution for UVA 1203
#include <iostream>
#include <queue>
#include <string>
#include <utility>
using namespace std;
#define mp make_pair
int qn, p, k;
string s;
@dudelson
dudelson / uva_11995.cpp
Created January 7, 2017 01:58
My solution for UVA 11995
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
int main() {
int n, c, x;
while(cin >> n) {
bool bq = true, bs = true, bpq = true;
queue<int> q;
@dudelson
dudelson / uva_11991.cpp
Created January 7, 2017 01:58
My solution for UVA 11991
#include <iostream>
#include <vector>
using namespace std;
#define maxn (int)(1e6)+1
vector< vector<int> > a(maxn);
int n, m, k, v;
int main() {
while(cin >> n >> m) {