Skip to content

Instantly share code, notes, and snippets.

Ubuntu 14.04 and CMS v 1.2

Download at

wget "https://github.com/cms-dev/cms/releases/download/v1.2.0/v1.2.0.tar.gz"

Pre requirements

Beginner: Linked List, Stack, Queue, Binary Search Tree.
Intermediate: Heap, Priority Queue, Huffman Tree, Union Find, Tries, Hash Table, Tree Map.
Proficient: Segment Tree, Binary Indexed Tree, Suffix Array, Sparse Table, Lowest Common Ancestor, Range Tree.
Expert: Suffix Automaton, Suffix Tree, Heavy-Light Decomposition, Treap, Aho-Corasick, K-d tree, Link-Cut Tree, Splay Tree, Palindromic Tree, Rope, Dancing Links, Radix Tree, Dynamic Suffix Array.
#include <bits/stdc++.h>
#define _for(i,a,b) for (int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
template<typename T> vector<T> &operator += (vector<T> &v, T x) {v.push_back(x);return v;}
#include <bits/stdc++.h>
#define _for(i,a,b) for (int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
template<typename T> vector<T> &operator += (vector<T> &v, T x) {v.push_back(x);return v;}
#include <bits/stdc++.h>
#define _for(i,a,b) for (int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
#define _it(i,v) for (typeof((v).begin()) i = (v).begin(); i != (v).end(); ++i)
#define _all(v) v.begin(), v.end()
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
template<typename T> vector<T> &operator += (vector<T> &v, T x) {v.push_back(x);return v;}
@ngobach
ngobach / P161PROC.CPP
Created September 18, 2016 17:17
P161PROC.CPP
#include <iostream>
using namespace std;
int main(){
// freopen("input.txt","r",stdin);
int n,k;
cin>>n>>k;
int a[n+5] = {0},t = 1, b[n+5] = {0};
cin>>a[0];
while(n-1 > 0){
@ngobach
ngobach / 00_basic2_en.md
Last active September 10, 2016 10:30
00_basic2_en.md

basic2_en

Các solution cho contest basic2_en

@ngobach
ngobach / P161PROA.CPP
Last active September 6, 2016 19:22
P161PROA - ROUND 1A - Số gần nguyên tố
#include <bits/stdc++.h>
#define BachNX
#define _for(i,a,b) for (int i=(a),_b_=(b),_d_=(a<b?1:-1);i!=_b_;i+=_d_)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
bool prime(int x) {
int j = sqrt(x);
@ngobach
ngobach / BCMARA.MD
Last active September 6, 2016 10:43
BCMARA - Chạy đua marathon

BCMARA - Chạy đua marathon

Link đề bài: BCMARA.
Vì bài này rất cơ bản nhưng nhiều bạn chưa làm được, nên mình làm bài hướng dẫn này.

Hướng dẫn

Bài này các bạn đọc dữ liệu vào và lưu vào mảng với đơn vị là giây, tức là đọc vào cả giờ phút giây sau đó đổi về giây để tiện lưu trữ và so sánh.
Sau đó sắp xếp tăng dần và in ra, có thể các bạn tự viết hàm sort hoặc sử dụng hàm sort (quick sort, nhanh hơn selection sort mà chúng ta hay dùng rất nhiều).