必看
唐诗错误
https://github.com/niXman/mingw-builds-binaries/releases/download/16.2.0-rt_v14-rev1/x86_64-16.2.0-release-win32-seh-ucrt-rt_v14-rev1.7z
https://zhuanlan.zhihu.com/p/26143367916g++ grader.cpp mycode.cpp -o check -std=gnu++14 -O2链接
分治
2025.11.24通过1k
2026.9.17通过1.5k
2026.10.27推荐文章100
struct custom_hash {
static uint64_t splitmix64(uint64_t x){
x+=0x9e3779b97f4a7c15;
x=(x^(x>>30))*0xbf58476d1ce4e5b9;
x=(x^(x>>27))*0x94d049bb133111eb;
return x^(x>>31);
}
size_t operator()(uint64_t x)const{
static const uint64_t FIXED_RANDOM=chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x+FIXED_RANDOM);
}
};namespace fast_IO {
#define IOSIZE 100000
static unsigned int precision = 6, POW[10] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};
static char obuf[IOSIZE], *p3 = obuf;
#ifdef ONLINE_JUDGE
static char ibuf[IOSIZE], *p1 = ibuf, *p2 = ibuf;
#define getchar() ((p1==p2)and(p2=(p1=ibuf)+fread(ibuf,1,IOSIZE,stdin),p1==p2)?(EOF):(*p1++))
#endif
#define putchar(x) ((p3==obuf+IOSIZE)&&(fwrite(obuf,p3-obuf,1,stdout),p3=obuf),*p3++=x)
inline int64_t read() { int64_t s = 0; int w = 1; char ch; while (ch = getchar(), !(ch>47 and ch<58) and (ch != EOF)) if (ch == '-') w = -1; if (ch == EOF) return false; while ((ch>47 and ch<58)) s = s * 10 + ch - 48, ch = getchar(); return s * w; }
template<typename T> static inline bool read(T &s) { s = 0; int w = 1; char ch; while (ch = getchar(), !(ch>47 and ch<58) and (ch != EOF)) if (ch == '-') w = -1; if (ch == EOF) return false; while ((ch>47 and ch<58)) s = s * 10 + ch - 48, ch = getchar(); return s *= w, true; }
template<typename T> static inline void print(T x) { if (x < 0) putchar('-'), x = -x; if (x > 9) print(x / 10); putchar(x % 10 + 48); }
static inline bool read(char &s) { while (s = getchar(), isspace(s) and s != EOF); return s != EOF; }
static inline void print(char x) { putchar(x); }
static inline bool read(char *s) { char ch; while (ch = getchar(), (ch<33) && ch != EOF); if (ch == EOF) return false; while (!(ch<33) and (ch != EOF)) *s++ = ch, ch = getchar(); *s = '\0'; return true; }
static inline void print(char *x) { while (*x) putchar(*x++); }
static inline void print(const char *x) { for (int i = 0; x[i]; i++) putchar(x[i]); }
static inline bool read(std::string& s) { s = ""; char ch; while (ch = getchar(), (ch<33) and ch != EOF); if (ch == EOF) return false; while (!(ch<33)) s += ch, ch = getchar(); return true; }
static inline void print(std::string x) { for (int i = 0, n = x.size(); i < n; i++) putchar(x[i]); }
static inline bool read(bool &b) { char ch; while(ch=getchar(), (ch<33) and ch != EOF); return ch == EOF ?false :(b=ch^48, true); }
static inline void print(bool b) { putchar(b+48); }
static inline bool read(double &x) { char ch = getchar(); int f = 1; for(; (ch<48 or 57<ch) and (ch != EOF); ch=getchar()) if(ch == '-') f = -1; if(ch == EOF) return false; for(x=0; 47<ch and ch<58; ch=getchar()) x = x*10 + (ch^48); if(ch != '.') return x *= f, true; double y = 0.1; for(ch=getchar(); 47<ch and ch<58; ch=getchar()) x += y*(ch^48), y /= 10; return x *= f, true; }
static inline void print(double x) { if(x < 0) putchar('-'), x = -x; if(!precision) print((unsigned long long)(x-(unsigned long long)(x)>=0.5 ?x+1 :x)); else { unsigned long long xx = x; double y = ((x-xx)*POW[precision]); unsigned long long yy = (y-(unsigned long long)(y)>=0.5 ?y+1 :y); if(yy == POW[precision]) xx++, yy = 0; print(xx), putchar('.'); for(int j=precision-1; ~j; j--) putchar(48+yy/POW[j]%10); } }
template<typename T, typename... T1> static inline int read(T& a, T1&... other) { return read(a) + read(other...); }
template<typename T, typename... T1> static inline void print(T a, T1... other) { print(a), print(other...); }
static struct Fast_IO {
bool flag = 1;
inline ~Fast_IO() { fwrite(obuf, p3 - obuf, 1, stdout); }
inline void SetPrecision(int x) { if(x > 9) throw runtime_error("Precision too high!"); else if(x < 0) throw runtime_error("Precision too low!"); else precision = x; }
inline operator bool() { return flag; }
} io;
Fast_IO& operator >> (Fast_IO &io, char *b) { return io.flag &= read(b), io; }
template<typename T> static Fast_IO& operator >> (Fast_IO &io, T &b) { return io.flag &= read(b), io; }
template<typename T> static Fast_IO& operator << (Fast_IO &io, T b) { return print(b), io; }
#define cout io
#define cin io
#define endl '\n'
} using namespace fast_IO;{
"Competitive Programming Template": {
"prefix": "cpp",
"body": [
"#include<bits/stdc++.h>",
"using namespace std;",
"#define int long long",
"#define F(i,a,b) for(int i=(a);i<=(b);i++)",
"#define DF(i,a,b) for(int i=(a);i>=(b);i--)",
"",
"signed main(){",
"\tios::sync_with_stdio(0);cin.tie(0);cout.tie(0);",
"",
"",
"\treturn 0;",
"}"
],
"description": "C++ Competitive Programming Template"
}
}模版
practice1
practice2
namespace FastIO{
char buf[1<<21],*p1=buf,*p2=buf, pbuf[1<<21],*pp=pbuf;
inline char gc(){
if(p1==p2) p2=(p1=buf)+fread(buf,1,1<<21,stdin);
return p1==p2?EOF:*p1++;
}
inline void push(char c){
if(pp-pbuf==1<<21) fwrite(pbuf,1,1<<21,stdout),pp=pbuf;
*pp++=c;
}
template<typename T>
inline void read(T &x){
x=0; char s=gc(); bool sign=0;
while(s<'0'||s>'9'){
if(s=='-') sign=1;
s=gc();
}
while(s>='0'&&s<='9') x=x*10+(s^48),s=gc();
if(sign) x=-x;
}
inline void read(char *s){
char c=gc();
while(c==' '||c=='\n'||c=='\r') c=gc();
while(c!=' '&&c!='\n'&&c!='\r'&&c!=EOF) *s++=c,c=gc();
*s='\0';
}
template<typename T>
inline void write(T x){
if(x<0) push('-'),x=-x;
static char sta[40];
int top=0;
do sta[top++]=x%10+'0',x/=10; while(x);
while(top--) push(sta[top]);
}
inline void write(const char *s){ while(*s) push(*s++); }
inline void write(char c){ push(c); }
inline void flush(){ fwrite(pbuf,1,pp-pbuf,stdout); pp=pbuf; }
}
using namespace FastIO;namespace fast_IO{
#define S (1<<20)
char ib[S],ob[S],*p1=ib,*p2=ib,*p3=ob;
inline int gc(){if(p1==p2)p2=(p1=ib)+fread(ib,1,S,stdin);return p1==p2?EOF:*p1++;}
#define getchar gc
#define putchar(x) (p3==ob+S&&(fwrite(ob,p3-ob,1,stdout),p3=ob),*p3++=x)
inline int read(){int x=0,f=1;char c;while(c=getchar(),c!='-'&&(c<48||c>57));if(c=='-')f=-1,c=getchar();while(c>47&&c<58)x=x*10+c-48,c=getchar();return x*f;}
template<class T>inline bool read(T&x){
x=0;int f=1;char c;
while(c=getchar(),c!='-'&&(c<48||c>57));
if(c=='-')f=-1,c=getchar();
while(c>47&&c<58)x=x*10+c-48,c=getchar();
x*=f;return 1;
}
inline bool read(char&s){while((s=getchar())<=32);return 1;}
inline bool read(char*s){char c;while((c=getchar())<=32);while(c>32)*s++=c,c=getchar();*s=0;return 1;}
inline bool read(string&s){static char t[S];char c;int n=0;while((c=getchar())<=32);while(c>32)t[n++]=c,c=getchar();s.assign(t,n);return 1;}
template<class T>inline void print(T x){if(x<0)putchar('-'),x=-x;if(x>9)print(x/10);putchar(x%10+48);}
inline void print(char x){putchar(x);}
inline void print(char*x){while(*x)putchar(*x++);}
inline void print(const char*x){while(*x)putchar(*x++);}
inline void print(string x){for(char c:x)putchar(c);}
template<class T,class...T1>inline int read(T&a,T1&...b){return read(a)+read(b...);}
template<class T,class...T1>inline void print(T a,T1...b){print(a),print(b...);}
struct F{bool flag=1;~F(){fwrite(ob,p3-ob,1,stdout);}operator bool(){return flag;}}io;
template<class T>inline F&operator>>(F&io,T&x){return io.flag&=read(x),io;}
inline F&operator>>(F&io,char*x){return io.flag&=read(x),io;}
template<class T>inline F&operator<<(F&io,T x){print(x);return io;}
#define cin io
#define cout io
#define endl '\n'
}using namespace fast_IO;UASCO-foreverforever516 str:forever516_hack
struct mint {
int x;
mint() {
x=0;
}
mint(int _x) {
x=_x;
}
friend mint operator + (mint a,mint b) {
return a.x+b.x>=p? a.x+b.x-p:a.x+b.x;
}
friend mint operator - (mint a,mint b) {
return a.x<b.x? a.x-b.x+p:a.x-b.x;
}
friend mint operator * (mint a,mint b) {
return 1ll*a.x*b.x%p;
}
friend mint operator ^ (mint a,ll b) {
mint res=1,base=a;
while(b) {
if(b&1)
res*=base;
base*=base; b>>=1;
}
return res;
}
friend mint operator ~ (mint a) {
return a^(p-2);
}
friend mint operator / (mint a,mint b) {
return a*(~b);
}
friend mint & operator += (mint& a,mint b) {
return a=a+b;
}
friend mint & operator -= (mint& a,mint b) {
return a=a-b;
}
friend mint & operator *= (mint& a,mint b) {
return a=a*b;
}
friend mint & operator /= (mint& a,mint b) {
return a=a/b;
}
friend mint operator ++ (mint& a) {
return a+=1;
}
friend mint operator -- (mint& a) {
return a-=1;
}
};