编辑器:小熊猫C++ or VSCode
cpp.json:
{
"贾宁不在,直接启动": {
"prefix": "doubles", // 使用模板的快捷键
"body": [ // 模板的内容都定义在body中
"#include <bits/stdc++.h>",
"using namespace std;",
"",
"signed main() {",
"\tios::sync_with_stdio(0);",
"\tcin.tie(0); cout.tie(0);",
"\t$0",
"\treturn 0;",
"}"
],
"description": "贾宁不在,直接启动" // 模板的描述
}
}缺省源:
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
return 0;
}编译选项:
-std=c++14 -O2 -Wall -Wextra -Wl,--stack=1024000自定义代码补全:
前缀:
read代码:
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;
}前缀:
edge代码:
struct edge{
int u, v, w, nxt;
};
edge ed[400100];
int edcnt, head[200100];
void addedge(int u, int v, int w) {
edcnt++;
ed[edcnt].u = u;
ed[edcnt].v = v;
ed[edcnt].w = w;
ed[edcnt].nxt = head[u];
head[u] = edcnt;
}前缀:
graph代码:
struct edge{
int u, v, w, nxt;
};
class graph{
private:
static const int N = 10, M = 200;
public:
edge ed[M * 2];
int edcnt, head[N];
void addedge(int u, int v, int w) {
edcnt++;
ed[edcnt].u = u;
ed[edcnt].v = v;
ed[edcnt].w = w;
ed[edcnt].nxt = head[u];
head[u] = edcnt;
}
};附上优化快读:
#ifdef ONLINE_JUDGE
char *p1, *p2, buf[100000];
#define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
#endif
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;
}