tyh0929的学术区

O(nn)能过n≤8
O(n!)能过n≤11
O(2n)能过n≤26
O(n3)能过n≤464
O(n2)能过n≤104
O(nlog2n)能过n≤4.5∗106
O(n)能过n≤108
O(log2n)能过n≤1036


链接合集
国内编程网站
编程工具
c++源代码(基础款)
C++#include<bits/stdc++.h>
using namespace std;
int main(){
return 0;
}
c++源代码(考试款)
C++#include<bits/stdc++.h>
using namespace std;
int main(){
freopen(".in","r",stdin);
freopen(".out","w",stdout);
return 0;
}
c++源代码(快读多种类+快写多种类+加速+方便+freopen)(仅限于允许使用GCC的地方)(用于比赛会被禁赛三年)
C++#pragma GCC target("avx")
#pragma GCC optimize(2,3,"Ofast","inline","-ffast-math")
#pragma GCC target("sse2,sse3,sse4,mmx")
#pragma omp parallel for
#pragma omp parallel num_threads(thread_count)
#pragma omp critical
#pragma omp parallel for reduction(+:sum)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define itn int
#define fro for
#define scnaf scanf
#define snacf scanf
#define prinf printf
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
inline string readS(){
string s;
char ch=getchar();
while(ch==' '||ch=='\n'){
ch=getchar();
}
while(ch!=' '&&ch!='\n'){
s+=ch;
ch=getchar();
}
return s;
}
inline string readSL(){
string s;
s.clear();
char ch=getchar();
while(ch=='\n'){
ch=getchar();
}
while(ch!='\n'){
s+=ch;
ch=getchar();
}
return s;
}
inline void readC(char s[]){
int tot=0;
char ch=getchar();
while(ch==' '||ch=='\n'){
ch=getchar();
}
while(ch!=' '&&ch!='\n'){
s[tot++]=ch;
ch=getchar();
}
}
inline char readc(){
char c=getchar();
while(c==' '||c=='\n'){
c=getchar();
}
return c;
}
inline void write(int x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9){
write(x/10);
}
putchar(x%10+'0');
return;
}
inline void writeS(string x){
int len=x.length();
for(int i=0;i<len;++i){
putchar(char(x[i]));
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen(".in","r",stdin);
// feropen(".out","w",stdout);
return 0;
}
/*
*/
c++源代码(快读多种类+快写多种类+加速+方便)(通用)
C++#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define itn int
#define fro for
#define scnaf scanf
#define snacf scanf
#define prinf printf
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=x*10+ch-'0';
ch=getchar();
}
return x*f;
}
inline string readS(){
string s;
char ch=getchar();
while(ch==' '||ch=='\n'){
ch=getchar();
}
while(ch!=' '&&ch!='\n'){
s+=ch;
ch=getchar();
}
return s;
}
inline string readSL(){
string s;
s.clear();
char ch=getchar();
while(ch=='\n'){
ch=getchar();
}
while(ch!='\n'){
s+=ch;
ch=getchar();
}
return s;
}
inline void readC(char s[]){
int tot=0;
char ch=getchar();
while(ch==' '||ch=='\n'){
ch=getchar();
}
while(ch!=' '&&ch!='\n'){
s[tot++]=ch;
ch=getchar();
}
}
inline char readc(){
char c=getchar();
while(c==' '||c=='\n'){
c=getchar();
}
return c;
}
inline void write(int x){
if(x<0){
putchar('-');
x=-x;
}
if(x>9){
write(x/10);
}
putchar(x%10+'0');
return;
}
inline void writeS(string x){
int len=x.length();
for(int i=0;i<len;++i){
putchar(char(x[i]));
}
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
return 0;
}
/*
*/
大神版(完整带调试版)
关闭调试开关时使用 fread(),fwrite(),退出时自动析构执行 fwrite()。
开启调试开关时使用 getchar(),putchar(),便于调试。
若要开启文件读写时,请在所有读写之前加入 freopen()。
C++// #define DEBUG 1 // 调试开关
struct IO {
#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
char buf[MAXSIZE], *p1, *p2;
char pbuf[MAXSIZE], *pp;
#if DEBUG
#else
IO() : p1(buf), p2(buf), pp(pbuf) {}
~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }
#endif
char gc() {
#if DEBUG // 调试,可显示字符
return getchar();
#endif
if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
return p1 == p2 ? ' ' : *p1++;
}
bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template <class T>
void read(T &x) {
double tmp = 1;
bool sign = 0;
x = 0;
char ch = gc();
for (; !isdigit(ch); ch = gc())
if (ch == '-') sign = 1;
for (; isdigit(ch); ch = gc()) x = x * 10 + (ch - '0');
if (ch == '.')
for (ch = gc(); isdigit(ch); ch = gc())
tmp /= 10.0, x += tmp * (ch - '0');
if (sign) x = -x;
}
void read(char *s) {
char ch = gc();
for (; blank(ch); ch = gc());
for (; !blank(ch); ch = gc()) *s++ = ch;
*s = 0;
}
void read(char &c) { for (c = gc(); blank(c); c = gc()); }
void push(const char &c) {
#if DEBUG // 调试,可显示字符
putchar(c);
#else
if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
*pp++ = c;
#endif
}
template <class T>
void write(T x) {
if (x < 0) x = -x, push('-'); // 负数输出
static T sta[35];
T top = 0;
do {
sta[top++] = x % 10, x /= 10;
} while (x);
while (top) push(sta[--top] + '0');
}
template <class T>
void write(T x, char lastChar) {
write(x), push(lastChar);
}
} io;
toptpothy