Skip to content

Instantly share code, notes, and snippets.

#include <algorithm>
using namespace std;
#define INF (1<<20)
#define MAX_N 500000
int n,dat[2*MAX_N];
void
#include <vector>
#include <iostream>
using namespace std;
#define MAX_V 50
#define INF (1<<20)
//to:行き先,cap:容量,rev:逆(G[e.to][e.rev]で逆辺の構造体にアクセスできる。)
struct edge {
@iseki-masaya
iseki-masaya / mod_mult.cpp
Last active December 23, 2015 04:19
MOD乗算のコード ・if文で分岐させることでモジュロ演算をしない(PGOが備わってれば分岐数の少ないif文は低コスト) ・bit毎に確認するので計算量はO(log(N))
const int MOD = 1000000007;
long long
mod_mult(long long a,long long b)
{
long long res = 0;
long long mir = a%MOD;
while (b) {
if (b&1) {
res += mir;
@iseki-masaya
iseki-masaya / mod_exp.cpp
Last active December 23, 2015 04:19
MOD指数演算
const int MOD = 1000000007;
long long
mod_mult(long long a,long long b)
{
long long res = 0;
long long mir = a%MOD;
while (b) {
if (b&1) {
res += mir;
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <sstream>
#include <list>
#include <algorithm>
#include <sstream>
#include <set>
#include <cmath>