Skip to content

Instantly share code, notes, and snippets.

@dudelson
dudelson / uva_10954.cpp
Created January 7, 2017 01:51
My solution for UVA 10954
#include <iostream>
#include <queue>
using namespace std;
int n, x;
long long sum;
int main() {
while(cin >> n, n) {
sum = 0;
priority_queue<long long> q;
@dudelson
dudelson / uva_11136.cpp
Created January 7, 2017 01:52
My solution for UVA 11136
#include <iostream>
#include <set>
using namespace std;
int n, x, k;
long long sum;
multiset<int> bills;
int main() {
while(cin >> n, n) {
sum = 0;
@dudelson
dudelson / 11235.cpp
Created January 7, 2017 01:52
My solution for UVA 11235
#include <iostream>
#include <vector>
using namespace std;
#define n_unique 200005
class SegmentTree {
private:
int n;
// A is the input array, st is the segment tree
vector<int> A, st;
@dudelson
dudelson / uva_11286.cpp
Created January 7, 2017 01:53
My solution for UVA 11286
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
#define maxn (int)(1e5)+1
int n;
map<vector<int>, int> m;
int main() {
@dudelson
dudelson / uva_11503.cpp
Created January 7, 2017 01:53
My solution for UVA 11503
#include <iostream>
#include <map>
#include <string>
using namespace std;
map<string, string> p;
map<string, int> r, sizes;
inline string getSet(const string &s) {
if(p.find(s) == p.end()) {
p[s] = s;
@dudelson
dudelson / uva_11572.cpp
Created January 7, 2017 01:55
My solution for UVA 11572
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
#define maxn (int)(1e9)+1
int t, n, x, ans, cnt, block;
map<int, int> lastseen;
int main() {
@dudelson
dudelson / uva_11581.cpp
Created January 7, 2017 01:55
My solution for UVA 11581
#include <cstdio>
#include <vector>
using namespace std;
typedef pair<int, int> pii;
int n, g[3][3], gg[3][3];
int main() {
//ios_base::sync_with_stdio(false);
@dudelson
dudelson / uva_11849.cpp
Created January 7, 2017 01:56
My solution for UVA 11849
#include <iostream>
#include <set>
using namespace std;
#define ll long long
ll n, m, x, ans;
set<ll> cds;
int main() {
while(cin >> n >> m, n||m) {
@dudelson
dudelson / uva_11926.cpp
Created January 7, 2017 01:56
My solution for UVA 11926
#include <iostream>
#include <bitset>
using namespace std;
#define maxn 1000001
int n, m, s, t, r;
bitset<maxn> sch;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
@dudelson
dudelson / uva_11933.cpp
Created January 7, 2017 01:57
My solution for UVA 11933
#include <cstdio>
using namespace std;
typedef long long ll;
ll a, b, n, i;
bool e;
int main() {
while(scanf("%lld", &n), n) {