This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void init(string& P, vi& b) | |
{ | |
int i = 0, j = -1; b[0] = -1; | |
while (i < P.size()) | |
{ | |
while (j >= 0 && P[i] != P[j]) j = b[j]; | |
b[++i] = ++j; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits/stdc++.h> | |
#define _ << ' ' << | |
using namespace std; | |
using ll = long long; | |
const int mod = 1e9 + 9; | |
int add(int a, int b) { return (a += b) < mod? a : a - mod; } | |
int sub(int a, int b) { return (a -= b) >= 0? a : a + mod; } | |
int mul(int a, int b) { return 1LL * a * b % mod; } | |
int pwr(int a, int p) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; init.el --- my init | |
;;; Commentary: | |
;;; Code: | |
(require 'cc-mode) | |
(require 'time) | |
(setq user-full-name "Mislav Blažević" | |
user-mail-address "[email protected]" | |
c-default-style "bsd" | |
inhibit-splash-screen t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int bt(int pos, int cur, int used) | |
{ | |
if (pos == n) | |
return used == 7 ? 0 : 150000 * 5; | |
if (cur != -1 && D[pos][used][cur] != 0) | |
return D[pos][used][cur]; | |
int bs = 5 * 150000; | |
for (int i = 0; i < 3; ++i) | |
if (!(used & 1 << i) || i == cur) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <array> | |
using namespace std; | |
typedef vector<int> vi; | |
typedef vector<vi> vvi; | |
typedef vector<bool> vb; | |
typedef vector<array<array<int, 2>, 2> > vaa; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; uva.el --- interface to UVa online judge | |
;;; Commentary: | |
;;; Code: | |
(require 'json) | |
(require 'cc-mode) | |
(require 'cl) | |
(defconst uva-dir "~/Hacking/uva/") | |
(defconst uva-pdf-dir "~/Hacking/uva/pdf/") | |
(defconst uva-id "831136") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstring> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
int main() | |
{ | |
int dubina, sirina; | |
cin >> dubina >> sirina; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <list> | |
using namespace std; | |
typedef list<int>::iterator LI; | |
int find_derp(LI beg, int k, LI& out) | |
{ | |
int ctr = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <cmath> | |
#include <vector> | |
using namespace std; | |
vector<int> K[3]; | |
string s[3]; | |
int max_size; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int T, B, W; | |
int gcd(int a, int b) | |
{ | |
return ((b == 0) ? a : gcd(b, a % b)); | |
} |
NewerOlder