teamnote default
This commit is contained in:
29
source/Misc/FastI.cpp
Normal file
29
source/Misc/FastI.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#define getint(n) int n; read(n)
|
||||
#define getll(n) ll n; read(n)
|
||||
#define inta getint(a)
|
||||
#define intab getint(a); getint(b)
|
||||
char get() {
|
||||
static char buf[100000], *S=buf, *T=buf;
|
||||
if(S == T) {
|
||||
S = buf; T = buf + fread(buf, 1, 100000, stdin);
|
||||
if(S == T) return EOF;
|
||||
}
|
||||
return *S++;
|
||||
}
|
||||
void read(int& n) {
|
||||
n = 0; char c; bool neg = false;
|
||||
for(c = get(); c < '0'; c=get()) if(c=='-') neg = true;
|
||||
for(;c>='0';c=get()) n = n*10+c-'0';
|
||||
if(neg) n = -n;
|
||||
}
|
||||
void read(ll& n) {
|
||||
n = 0; char c; bool neg = false;
|
||||
for(c = get(); c < '0'; c=get()) if(c=='-') neg = true;
|
||||
for(;c>='0';c=get()) n = n*10+c-'0';
|
||||
if(neg) n = -n;
|
||||
}
|
||||
int read(char s[]) {
|
||||
char c; int p = 0; while((c = get()) <= ' ');
|
||||
s[p++] = c; while((c = get()) >= ' ') s[p++] = c;
|
||||
s[p] = '\0'; return p;
|
||||
}
|
||||
7
source/Misc/NegDiv.cpp
Normal file
7
source/Misc/NegDiv.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#define div _div
|
||||
ll div(ll A, ll B)
|
||||
{
|
||||
ll q = A/B;
|
||||
if(A<0) q-=(B>0)-(B<0);
|
||||
return q;
|
||||
}
|
||||
0
source/Misc/StressTest.sh
Normal file
0
source/Misc/StressTest.sh
Normal file
7
source/Misc/mt19937.cpp
Normal file
7
source/Misc/mt19937.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
const long long rand_L = 1;
|
||||
const long long rand_R = 10;
|
||||
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
|
||||
uniform_int_distribution<int> dist(rand_L, rand_R);
|
||||
auto gen = bind(dist, rng);
|
||||
|
||||
gen(); gen(); gen();
|
||||
Reference in New Issue
Block a user