• 个人简介

    ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓

    8.134.37.132(oiclass)

    %%%%%板
    差分约束
    #include <iostream>
    #include <cstring>
    #include <vector>
    #include <queue>
    using namespace std;
    struct node
    {
    	int y,w;
    };
    queue<int> q;
    vector<node> g[5005];
    bool in[5005];
    int n,m,d[5005],c[5005];
    bool spfa(int s)
    {
    	memset(d,-0x3f3f3f3f,sizeof(d));
    	q.push(0);
    	d[s] = 0;in[s] = 0;
    	c[s]++;
    	while(!q.empty())
    	{
    		int x = q.front();
    		q.pop();
    		in[x] = 0;
    		for(int i = 0;i < g[x].size();i++)
    		{
    			int y = g[x][i].y;
    			if(d[y] < d[x] + g[x][i].w)
    			{
    				d[y] = d[x] + g[x][i].w;
    				if(!in[y])
    				{
    					q.push(y);
    					in[y] = 1;
    					c[y]++;
    					if(c[y] > n + 1) return 0;
    				}
    			}
    		}
    	}
    	return 1;
    }
    int main()
    {
    	cin >> n >> m;
    	for(int i = 1;i <= n;i++) g[0].push_back({i,0});
    	for(int i = 1;i <= m;i++)
    	{
    		int x,y,w;
    		cin >> x >> y >> w;
    		g[x].push_back({y,-w});
    	}
    	if(spfa(0))
    		for(int i = 1;i <= n;i++) cout << d[i] << " ";
    	else cout << "NO" << endl;
    	return 0;
    }
    
    笛卡尔树
      #include <iostream>
    using namespace std;
    long long ans,ans1,k,tp,st[10000005],l[10000005],r[10000005];
    int n,a[10000005];
    void build(int n)
    {
    	for(int i = 1;i <= n;i++)
    	{
    		while(k && a[st[k]] >= a[i]) k--;
    		if(k) r[st[k]] = i;
    		if(tp > k) l[i] = st[k + 1];
    		st[++k] = i;
    		tp = k;
    	}
    }
    int main()
    {
        cin >> n;
        for(int i = 1;i <= n;i++) scanf("%lld",&a[i]);
    	build(n);
    	for(int i = 1;i <= n;i++)
    	{
    		ans ^= i * (l[i] + 1);
    		ans1 ^= i * (r[i] + 1);
    	}
    	cout << ans << " " << ans1 << endl;
        return 0;
    }
    
    trie
    #include <iostream>
    #include <cstring>
    using namespace std;
    int tr[3000005][70],cnt[3000005],idx,f[3000005];
    string s;
    int get(char c)
    {
    	if(c >= 'a' && c <= 'z') return c - 'a';
    	else if(c >= 'A' && c <= 'Z') return c - 'A' + 26;
    	else return c - '0' + 52;
    }
    void insert(string s)
    {
    	int x = 0;
    	for(int i = 0;i < s.size();i++)
    	{
    		int k = get(s[i]);
    		if(!tr[x][k]) tr[x][k] = ++idx;
    		x = tr[x][k];
    		cnt[x]++;
    	}
    }
    int find(string s)
    {
    	int x = 0;
    	for(int i = 0;i < s.size();i++)
    	{
    		int k = get(s[i]);
    		if(!tr[x][k]) return 0;
    		x = tr[x][k];
    	}
    	return cnt[x];
    }
    int main()
    {
    	int t;
    	cin >> t;
    	while(t--)
    	{
    		for(int i = 0;i <= idx;i++)
                for(int j = 0;j <= 65;j++)
                    tr[i][j] = 0;
            for(int i = 0;i <= idx;i++) cnt[i] = 0;
    		idx = 0;
    		int n,m;
    		cin >> n >> m;
    		for(int i = 1;i <= n;i++)
    		{
    			cin >> s;
    			insert(s);
    		}
    		for(int i = 1;i <= m;i++)
    		{
    			cin >> s;
    			cout << find(s) << endl;
    		}
    	}
    	return 0;
    }
    
    逆元快速版+快读快写 (快速幂:ksm(a,p - 2))
    #include <iostream>
    #define int long long
    using namespace std;
    template<typename T>
    void read(T &x)
    {
        x = 0;
        char ch = getchar();
        int f = 1;
        while(!isdigit(ch))
    	{
            if(ch == '-') f = -1;
            ch = getchar();
        }
        while(isdigit(ch))
    	{
            x = x * 10 + (ch - '0'); 
            ch = getchar();
        }
        x *= f;
    }
    template<typename T>
    void write(T x)
    {
        if(x < 0)
    	{
            putchar('-');
            x = -x;
        }
        if(x > 9) write(x / 10);
        putchar(x % 10 + '0');
    }
    int n,p,k,x,sum,kk = 1;
    int a[5000005],s[5000005],ns[5000005];
    int ksm(int a,int b)
    {
    	int ans = 1;
    	while(b)
    	{
    		if(b & 1) ans = (ans * a) % p;
    		a = (a * a) % p;
    		b >>= 1;
    	}
    	return ans;
    }
    signed main()
    {
    	read(n);read(p);read(k);
        s[0] = 1;
        for(int i = 1;i <= n;i++) read(a[i]),s[i] = (s[i - 1] * a[i]) % p;
        ns[n] = ksm(s[n],p - 2);
        for(int i = n;i >= 1;i--)
        {
        	ns[i - 1] = (ns[i] * a[i]) % p;
        	a[i] = (ns[i] * s[i - 1]) % p;
    	}
    	for(int i = 1;i <= n;i++)
    	{
        	kk = (kk * k) % p;
        	sum = (sum + (kk * a[i]) % p) % p;
    	}
    	write(sum);putchar('\n');
        return 0;
    }
    
    树状数组
    #include <iostream>
    #include <algorithm>
    using namespace std;
    int n,m,a[500005],s[500005];
    int lb(int x)
    {
    	return x & (-x);
    }
    void add(int x,int d)
    {
    	while(x <= n)
    	{
    		s[x] += d;
    		x += lb(x);
    	}
    }
    int sum(int x)
    {
    	int ans = 0;
    	while(x > 0)
    	{
    		ans += s[x];
    		x -= lb(x);
    	}
    	return ans;
    }
    int main()
    {
    	cin >> n >> m;
    	for(int i = 1;i <= n;i++)
    	{
    		cin >> a[i];
    		add(i,a[i] - a[i - 1]);
    	}
    	for(int i = 1;i <= m;i++)
    	{
    		int p;
    		cin >> p;
    		if(p == 1)
    		{
    			int x,y,k;
    			cin >> x >> y >> k;
    			add(x,k);
    			add(y + 1,-k);
    		}
    		else
    		{
    			int x;
    			cin >> x;
    			cout << sum(x) << endl;
    		}
    	}
        return 0;
    }
    
    KMP
    #include <iostream>
    using namespace std;
    int f[2000005];
    int main()
    {
    	string s1,s2;
    	cin >> s1 >> s2;
    	int n = s1.size(),m = s2.size();
    	string t = ' ' + s2 + '#' + s1;
    	for(int i = 2;i <= n + m + 1;i++)
    	{
    		int j = f[i - 1];
    		while(j && t[i] != t[j + 1]) j = f[j];
    		if(t[i] == t[j + 1]) j++;
    		f[i] = j;//前缀函数
    		if(i > m && f[i] == m) cout << i - 2 * m << endl;//求字串位置
    	}
    	for(int i = 1;i <= m;i++) cout << f[i] << " ";
    	return 0;
    }
    
    虚树
    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <cstring>
    #define int long long
    using namespace std;
    const int N = 250005;
    struct node
    {
    	int y,w;
    };
    vector<node> g[N];vector<int> gg[N];
    int n,m,k,cnt,id[N],fa[N],ds[N],tp[N],sz[N],son[N];
    int a[N],top,st[N],minn[N];
    bool kp[N];
    void dfs1(int x,int f)
    {
    	fa[x] = f;ds[x] = ds[f] + 1;sz[x] = 1;
    	for(int i = 0;i < g[x].size();i++)
    	{
    		int y = g[x][i].y,w = g[x][i].w;
    		if(y == f) continue;
        //
    		dfs1(y,x);
    		sz[x] += sz[y];
    		if(sz[y] > sz[son[x]]) son[x] = y;
    	}
    }
    void dfs2(int x,int t)
    {
    	tp[x] = t;id[x] = ++cnt;
    	if(son[x]) dfs2(son[x],t);
    	for(int i = 0;i < g[x].size();i++)
    	{
    		int y = g[x][i].y;
    		if(y != fa[x] && y != son[x]) dfs2(y,y);
    	}
    }
    int lca(int x,int y)
    {
    	while(tp[x] != tp[y])
    	{
    		if(ds[tp[x]] < ds[tp[y]]) swap(x,y);
    		x = fa[tp[x]];
    	}
    	if(ds[x] > ds[y]) swap(x,y);
    	return x;
    }
    bool cmp(int x,int y){return id[x] < id[y];}
    void build()
    {
    	top = 1;st[top] = 1;
    	int l = lca(st[top],a[i]);
    	if(l == st[top])
    	{
    		if(a[i] != st[top]) st[++top] = a[i];break;
    	}
    	if(ds[l] > ds[st[top - 1]]) gg[l].push_back(st[top]),st[top] = l;
    	else gg[st[top - 1]].push_back(st[top]),top--;
    	for(int i = 1;i < top;i++) gg[st[i]].push_back(st[i + 1]);
    }
    int dfss(int x)
    {
    	int ans = 0;
    	for(int i = 0;i < gg[x].size();i++)
    	{
    		int y = gg[x][i];
    		ans += dfss(y);
    	}
    	gg[x].clear();
    	if(kp[x])
    	{
    		kp[x] = 0;return minn[x];
    	}
    	return min(minn[x],ans);
    }
    signed main()
    {
    	cin >> n;
    	for(int i = 1;i < n;i++)
    	{
    		int x,y,w;
    		cin >> x >> y >> w;
    		g[x].push_back({y,w});
    		g[y].push_back({x,w});
    	}
    	dfs1(1,0);
    	dfs2(1,1);
    	//
    	return 0;
    }
    
    线段树模板
    void pushup(int x)
    {
    	ans[x] = ans[x * 2] + ans[x * 2 + 1];
    }
    void build(int l,int r,int x)
    {
    	if(l == r)
    	{
    		ans[x] = a[l];
    		return;
    	}
    	int mid = (l + r) / 2;
    	build(l,mid,x * 2);
    	build(mid + 1,r,x * 2 + 1);
    	pushup(x);
    }
    void update(int l,int r,int x,int p,int d)
    {
    	if(l == r)
    	{
    		ans[x] = d;
    		return;
    	}
    	int mid = (l + r) / 2;
    	if(p <= mid) update(l,mid,x * 2,p,d);
    	else update(mid + 1,r,x * 2 + 1,p,d);
    	pushup(x);
    }
    long long query(int s,int t,int l,int r,int x)
    {
    	if(s <= l && t >= r) return ans[x];
    	long long mid = (l + r) / 2,ans = 0;
    	if(s <= mid) ans += query(s,t,l,mid,x * 2);
    	if(t > mid) ans += query(s,t,mid + 1,r,x * 2 + 1);
    	return ans;
    }
    
    树的重心
    void dfs(int x,int f)
    {
    	s[x] = 1;
    	t[x] = 0;
    	for(int i = 0;i < g[x].size();i++)
    	{
    		int y = g[x][i];
    		if(y == f) continue;
    		dfs(y,x);
    		s[x] += s[y];
    		t[x] = max(t[x],s[y]);
    	}
    	if(max(t[x],n - s[x]) <= n / 2) ans.push_back(x);
    }
    
    树链剖分
    #include <iostream>
    #include <vector>
    using namespace std;
    vector<int> g[100005];
    int fa[100005],d[100005],tp[100005],son[100005],sum[100005];
    void dfs1(int x,int f)
    {
    	fa[x] = f;
    	d[x] = d[f] + 1;
    	sum[x] = 1;
    	for(int i = 0;i < g[x].size();i++)
    	{
    		int y = g[x][i];
    		if(y == f) continue;
    		dfs1(y,x);
    		sum[x] += sum[y];
    		if(sum[son[x]] < sum[y]) son[x] = y;
    	}
    }
    void dfs2(int x,int t)
    {
    	tp[x] = t;
    	if(son[x] == 0) return;
    	dfs2(son[x],t);
    	for(int i = 0;i < g[x].size();i++)
    	{
    		int y = g[x][i];
    		if(y == fa[x] || y == son[x]) continue;
    		dfs2(y,y);
    	}
    }
    int lca(int x,int y)
    {
    	while(tp[x] != tp[y])
    	{
    		if(d[tp[x]] < d[tp[y]]) swap(x,y);
    		x = fa[tp[x]];
    	}
    	if(d[x] < d[y]) return x;
    	return y;
    }
    int main()
    {
    	int n,q;
    	cin >> n;
    	for(int i = 1;i < n;i++)
    	{
    		int x,y;
    		cin >> x >> y;
    		g[x].push_back(y);
    		g[y].push_back(x);
    	}
    	dfs1(1,0);
    	dfs2(1,1);
    	cin >> q;
    	for(int i = 1;i <= q;i++)
    	{
    		int x,y;
    		cin >> x >> y;
    		int l = lca(x,y);
    		cout << d[x] + d[y] - 2 * d[l] << endl;
    	}
    	return 0;
    }
    
    扫描线
    #include <iostream>
    #include <algorithm>
    #define int long long
    using namespace std;
    int n,len,p[200005];
    struct node 
    {
    	int x1,x2,y,io;
    }line[2000005];
    bool cmp(node a,node b)
    {
    	return a.y < b.y;
    }
    int ans,t[800005],sum[800005];
    void tag(int x,int l,int r)
    {
    	if(t[x]) sum[x] = p[r + 1] - p[l];
    	else sum[x] = sum[x * 2] + sum[x * 2 + 1];
    }
    void upd(int x,int l,int r,int x1,int x2,int io)
    {
    	if(x1 >= r + 1 || x2 <= l) return;
    	if(x1 <= l && r + 1 <= x2)
    	{
    		t[x] += io;
    		tag(x,l,r);
    		return;
    	}
    	int mid = (l + r) / 2;
    	upd(x * 2,l,mid,x1,x2,io);
    	upd(x * 2 + 1,mid + 1,r,x1,x2,io);
    	tag(x,l,r);
    }
    signed main()
    {
    	cin >> n;
    	for(int i = 1;i <= n;i++)
    	{
    		int x1,y1,x2,y2;
    		cin >> x1 >> y1 >> x2 >> y2;
    		line[i] = {x1,x2,y1,1};
    		line[n + i] = {x1,x2,y2,-1};
    		p[i] = x1;
    		p[n + i] = x2;
    	}
    	n = n * 2;
    	sort(line + 1,line + n + 1,cmp);
    	sort(p + 1,p + n + 1);
    	len = unique(p + 1,p + n + 1) - (p + 1);
    	for(int i = 1;i < n;i++)
    	{
    		int l = lower_bound(p + 1,p + len + 1,line[i].x1) - p;
    		int r = lower_bound(p + 1,p + len + 1,line[i].x2) - p;
    		upd(1,1,len - 1,l,r,line[i].io);
    		ans += sum[1] * (line[i + 1].y - line[i].y);
    	}
    	cout << ans << endl;
    	return 0;
    }
    
    tcs
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
      <title>贪吃蛇 | 经典街机风格</title>
      <style>
          * {
              user-select: none;
              -webkit-tap-highlight-color: transparent;
          }
    
          body {
              background: linear-gradient(145deg, #1a472a 0%, #0e2a1a 100%);
              min-height: 100vh;
              display: flex;
              justify-content: center;
              align-items: center;
              font-family: 'Segoe UI', 'Press Start 2P', 'Courier New', monospace;
              margin: 0;
              padding: 20px;
          }
    
          /* 游戏主面板 */
          .game-container {
              background: #1e2a1e;
              border-radius: 48px;
              padding: 20px 24px 28px;
              box-shadow: 0 20px 35px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.1);
              border: 1px solid #5b8c5a;
          }
    
          /* 头部信息区 */
          .game-header {
              display: flex;
              justify-content: space-between;
              align-items: baseline;
              flex-wrap: wrap;
              gap: 15px;
              margin-bottom: 22px;
              background: #0f1f0f;
              padding: 12px 20px;
              border-radius: 60px;
              box-shadow: inset 0 2px 3px rgba(0,0,0,0.4), 0 3px 0 #3a633a;
          }
    
          .title h1 {
              margin: 0;
              font-size: 1.8rem;
              letter-spacing: 2px;
              background: linear-gradient(135deg, #c0ffb0, #6fda6f);
              background-clip: text;
              -webkit-background-clip: text;
              color: transparent;
              text-shadow: 0 2px 3px rgba(0,0,0,0.2);
              font-weight: 800;
          }
    
          .title p {
              margin: 4px 0 0;
              font-size: 0.7rem;
              color: #b8e4a0;
              font-family: monospace;
          }
    
          .scores {
              display: flex;
              gap: 28px;
              background: #00000066;
              backdrop-filter: blur(4px);
              padding: 6px 20px;
              border-radius: 40px;
          }
    
          .score-box {
              text-align: center;
          }
    
          .score-value {
              font-size: 1.9rem;
              font-weight: bold;
              line-height: 1;
              color: #f9e45b;
              font-family: monospace;
              text-shadow: 0 0 4px #ffa500;
          }
    
          .score-label {
              font-size: 0.7rem;
              letter-spacing: 1px;
              color: #cdf5c3;
          }
    
          /* 画布区域 */
          .canvas-wrapper {
              display: flex;
              justify-content: center;
              margin: 15px 0 15px;
              background: #0c1a0c;
              border-radius: 28px;
              padding: 12px;
              box-shadow: inset 0 0 0 2px #3b6e3b, 0 12px 20px rgba(0,0,0,0.3);
          }
    
          canvas {
              background-color: #1f3a1f;
              border-radius: 20px;
              display: block;
              margin: 0 auto;
              box-shadow: 0 0 0 3px #6ca56c;
              cursor: pointer;
          }
    
          /* 控制区 */
          .controls {
              display: flex;
              justify-content: center;
              gap: 18px;
              margin-top: 20px;
              flex-wrap: wrap;
          }
    
          button {
              background: #3f7343;
              border: none;
              font-family: 'Segoe UI', monospace;
              font-weight: bold;
              font-size: 1.1rem;
              padding: 10px 28px;
              border-radius: 60px;
              color: #f9f2cf;
              cursor: pointer;
              transition: 0.07s linear;
              box-shadow: 0 6px 0 #1f4722;
              letter-spacing: 1px;
              display: inline-flex;
              align-items: center;
              gap: 8px;
          }
    
          button:active {
              transform: translateY(3px);
              box-shadow: 0 3px 0 #1f4722;
          }
    
          .status-area {
              margin-top: 18px;
              text-align: center;
              background: #0f1a0a;
              border-radius: 40px;
              padding: 8px 18px;
              width: fit-content;
              margin-left: auto;
              margin-right: auto;
          }
    
          .status-text {
              font-family: monospace;
              font-weight: bold;
              font-size: 1rem;
              color: #d4f7c2;
              background: #2a432a;
              padding: 6px 20px;
              border-radius: 32px;
              display: inline-block;
              letter-spacing: 1px;
          }
    
          .mobile-buttons {
              display: none;
              justify-content: center;
              gap: 12px;
              margin-top: 20px;
              flex-wrap: wrap;
          }
    
          .dir-btn {
              background: #2c582c;
              font-size: 1.5rem;
              padding: 8px 22px;
              box-shadow: 0 5px 0 #1b3a1b;
              font-weight: bold;
          }
    
          @media (max-width: 700px) {
              .game-container {
                  padding: 14px 18px 22px;
              }
              .score-value {
                  font-size: 1.4rem;
              }
              .title h1 {
                  font-size: 1.4rem;
              }
              button {
                  padding: 7px 20px;
                  font-size: 0.9rem;
              }
              .mobile-buttons {
                  display: flex;
              }
              .dir-btn {
                  padding: 6px 18px;
                  font-size: 1.2rem;
              }
              canvas {
                  width: 100%;
                  height: auto;
              }
          }
    
          @media (max-width: 480px) {
              .scores {
                  gap: 16px;
              }
              .dir-btn {
                  min-width: 70px;
              }
          }
    
          footer {
              text-align: center;
              font-size: 0.65rem;
              margin-top: 16px;
              color: #7fa06f;
          }
      </style>
    </head>
    <body>
    <div class="game-container">
      <div class="game-header">
          <div class="title">
              <h1>🐍 贪吃蛇</h1>
              <p>← ↑ ↓ →  经典美味</p>
          </div>
          <div class="scores">
              <div class="score-box">
                  <div class="score-value" id="scoreDisplay">0</div>
                  <div class="score-label">分数</div>
              </div>
              <div class="score-box">
                  <div class="score-value" id="bestDisplay">0</div>
                  <div class="score-label">最高分</div>
              </div>
          </div>
      </div>
    
      <div class="canvas-wrapper">
          <canvas id="snakeCanvas" width="500" height="500" style="width:100%; height:auto; max-width:500px; max-height:500px"></canvas>
      </div>
    
      <div class="controls">
          <button id="restartBtn">🔄 新的一局</button>
          <button id="pauseBtn">⏸️ 暂停</button>
      </div>
      
      <div class="mobile-buttons">
          <button class="dir-btn" data-dir="UP">▲ 上</button>
          <button class="dir-btn" data-dir="LEFT">◀ 左</button>
          <button class="dir-btn" data-dir="DOWN">▼ 下</button>
          <button class="dir-btn" data-dir="RIGHT">▶ 右</button>
      </div>
    
      <div class="status-area">
          <div class="status-text" id="gameStatusText">▶ 游戏中 | 按方向键</div>
      </div>
      <footer>💡 提示:不能反向移动,撞墙或撞自身游戏结束。空格或点击暂停/开始</footer>
    </div>
    
    <script>
      (function(){
          // ---------- 游戏配置 ----------
          const BOARD_SIZE = 20;       // 20x20 网格
          const CELL_SIZE = 25;        // 500/20=25px
          let canvas = document.getElementById('snakeCanvas');
          let ctx = canvas.getContext('2d');
          
          // 游戏状态变量
          let snake = [];          // 坐标数组 {x, y}
          let food = { x: 12, y: 12 };
          let direction = 'RIGHT';    // 当前移动方向
          let nextDirection = 'RIGHT';
          let score = 0;
          let bestScore = 0;
          let gameLoop = null;
          let isGameRunning = false;   // true 表示游戏进行中(未结束未暂停)
          let isPaused = false;
          let gameOverFlag = false;
          
          // 速度 (毫秒)
          const BASE_SPEED = 150;
          let currentSpeed = BASE_SPEED;
          
          // DOM 元素
          const scoreDisplay = document.getElementById('scoreDisplay');
          const bestDisplay = document.getElementById('bestDisplay');
          const gameStatusText = document.getElementById('gameStatusText');
          const restartBtn = document.getElementById('restartBtn');
          const pauseBtn = document.getElementById('pauseBtn');
          
          // ---------- 初始化最高分 (LocalStorage) ----------
          function loadBestScore() {
              const saved = localStorage.getItem('snakeBestScore');
              if(saved !== null && !isNaN(parseInt(saved))) {
                  bestScore = parseInt(saved);
              } else {
                  bestScore = 0;
              }
              bestDisplay.innerText = bestScore;
          }
          
          function updateBestScoreUI() {
              if(score > bestScore) {
                  bestScore = score;
                  bestDisplay.innerText = bestScore;
                  localStorage.setItem('snakeBestScore', bestScore);
              }
          }
          
          // ---------- 辅助函数 ----------
          function randomInt(min, max) {
              return Math.floor(Math.random() * (max - min + 1)) + min;
          }
          
          // 生成新食物 (避开蛇身)
          function generateRandomFood() {
              const totalCells = BOARD_SIZE * BOARD_SIZE;
              if(snake.length >= totalCells) {
                  // 胜利情况,游戏胜利会在移动检测处理
                  return null;
              }
              // 收集空闲格子
              const snakeSet = new Set(snake.map(seg => `${seg.x},${seg.y}`));
              if(snakeSet.size === totalCells) return null;
              let freeCells = [];
              for(let i = 0; i < BOARD_SIZE; i++) {
                  for(let j = 0; j < BOARD_SIZE; j++) {
                      if(!snakeSet.has(`${i},${j}`)) {
                          freeCells.push({x: i, y: j});
                      }
                  }
              }
              if(freeCells.length === 0) return null;
              const rand = Math.floor(Math.random() * freeCells.length);
              return freeCells[rand];
          }
          
          // 重置游戏数据 (保留最高分)
          function resetGameData() {
              // 初始蛇: 三个格子位于中部
              const startX = Math.floor(BOARD_SIZE/2);
              const startY = Math.floor(BOARD_SIZE/2);
              snake = [
                  {x: startX, y: startY},
                  {x: startX-1, y: startY},
                  {x: startX-2, y: startY}
              ];
              direction = 'RIGHT';
              nextDirection = 'RIGHT';
              score = 0;
              scoreDisplay.innerText = score;
              isGameRunning = true;
              isPaused = false;
              gameOverFlag = false;
              currentSpeed = BASE_SPEED;
              // 生成有效食物 (确保不在蛇身上)
              let newFood = generateRandomFood();
              if(newFood) food = newFood;
              else food = {x: 5, y: 5}; // fallback
              // 再次确保食物有效
              const snakePosSet = new Set(snake.map(s => `${s.x},${s.y}`));
              while(snakePosSet.has(`${food.x},${food.y}`)) {
                  food = { x: randomInt(0, BOARD_SIZE-1), y: randomInt(0, BOARD_SIZE-1) };
              }
              updateStatusText();
              drawGame();
          }
          
          // 更新状态栏文字
          function updateStatusText() {
              if(gameOverFlag) {
                  gameStatusText.innerHTML = '💀 游戏结束 | 点击 [新的一局] 💀';
                  gameStatusText.style.background = '#5e2a2a';
                  return;
              }
              if(isPaused) {
                  gameStatusText.innerHTML = '⏸ 暂停中 | 按 [暂停] 或 空格继续';
                  gameStatusText.style.background = '#4f6240';
              } else {
                  gameStatusText.innerHTML = '🐍 游戏中 | 方向键控制';
                  gameStatusText.style.background = '#2a432a';
              }
          }
          
          // 核心移动逻辑 (返回是否移动有效/是否吃到食物)
          function moveSnake() {
              if(!isGameRunning || isPaused || gameOverFlag) return false;
              
              // 正式采用下一个合法方向
              direction = nextDirection;
              
              // 计算新头坐标
              let newHead = { ...snake[0] };
              switch(direction) {
                  case 'RIGHT': newHead.y += 1; break;
                  case 'LEFT':  newHead.y -= 1; break;
                  case 'UP':    newHead.x -= 1; break;
                  case 'DOWN':  newHead.x += 1; break;
                  default: break;
              }
              
              // 检查是否吃到食物
              const willEat = (newHead.x === food.x && newHead.y === food.y);
              
              // 执行移动 (先插入新头,根据是否吃食物决定是否删尾)
              snake.unshift(newHead);
              if(!willEat) {
                  snake.pop();
              } else {
                  // 吃到了: 分数增加,生成新食物
                  score++;
                  scoreDisplay.innerText = score;
                  updateBestScoreUI();
                  // 新食物
                  const newFood = generateRandomFood();
                  if(newFood) {
                      food = newFood;
                  } else {
                      // 可能胜利(蛇满)
                      if(snake.length === BOARD_SIZE * BOARD_SIZE) {
                          // 胜利通关
                          gameWin();
                          return false;
                      } else {
                          // 理论上还有空间,强力查找
                          let found = false;
                          for(let i=0;i<BOARD_SIZE && !found;i++){
                              for(let j=0;j<BOARD_SIZE;j++){
                                  if(!snake.some(seg => seg.x===i && seg.y===j)){
                                      food = {x:i, y:j};
                                      found=true;
                                      break;
                                  }
                              }
                          }
                          if(!found){
                              gameWin();
                              return false;
                          }
                      }
                  }
                  // 加快速度:可选(分数每增加5,速度略增但不超过最快75ms)
                  let newSpeed = BASE_SPEED - Math.floor(score / 8) * 5;
                  if(newSpeed < 70) newSpeed = 70;
                  if(currentSpeed !== newSpeed) {
                      currentSpeed = newSpeed;
                      resetGameInterval();
                  }
              }
              
              // 碰撞检测 (墙壁 或 自碰)
              // 墙壁碰撞
              if(newHead.x < 0 || newHead.x >= BOARD_SIZE || newHead.y < 0 || newHead.y >= BOARD_SIZE) {
                  gameOver();
                  return false;
              }
              // 自碰检测: 如果新头的位置与蛇身原有位置重叠 (且尾巴没被吃掉时要注意因为我们已先插入再判断,需要排除蛇头自身?)
              // 注意 snake[0] 是新头,检测 snake 从索引1开始是否重复
              for(let i = 1; i < snake.length; i++) {
                  if(snake[i].x === snake[0].x && snake[i].y === snake[0].y) {
                      gameOver();
                      return false;
                  }
              }
              
              return true;
          }
          
          // 胜利处理 (棋盘占满)
          function gameWin() {
              if(gameOverFlag) return;
              gameOverFlag = true;
              isGameRunning = false;
              if(gameLoop) {
                  clearInterval(gameLoop);
                  gameLoop = null;
              }
              updateBestScoreUI();
              gameStatusText.innerHTML = '🏆 奇迹!你赢了!满级贪吃蛇 🏆';
              gameStatusText.style.background = '#c9a53b';
              drawGame(); // 重绘显示胜利画面
          }
          
          function gameOver() {
              if(gameOverFlag) return;
              gameOverFlag = true;
              isGameRunning = false;
              if(gameLoop) {
                  clearInterval(gameLoop);
                  gameLoop = null;
              }
              updateBestScoreUI();
              gameStatusText.innerHTML = '💥 游戏结束!点击 [新的一局] 💥';
              gameStatusText.style.background = '#5e2a2a';
              drawGame(); // 画出结束效果
          }
          
          // 重置游戏间隔 (速度改变时)
          function resetGameInterval() {
              if(gameLoop) {
                  clearInterval(gameLoop);
                  gameLoop = null;
              }
              if(isGameRunning && !isPaused && !gameOverFlag) {
                  gameLoop = setInterval(() => {
                      moveSnake();
                      drawGame();
                      // 额外检查结束后是否需要停止更新
                      if(gameOverFlag || !isGameRunning) {
                          if(gameLoop) {
                              clearInterval(gameLoop);
                              gameLoop = null;
                          }
                      }
                  }, currentSpeed);
              }
          }
          
          // 开始 / 恢复 游戏
          function startOrResumeGame() {
              if(gameOverFlag) {
                  // 游戏结束必须手动重置
                  return;
              }
              if(!isGameRunning && !gameOverFlag) {
                  // 从未开始的情况基本不存在,但重置后running=true
                  isGameRunning = true;
                  isPaused = false;
                  resetGameInterval();
                  updateStatusText();
                  drawGame();
                  return;
              }
              if(isPaused) {
                  isPaused = false;
                  isGameRunning = true;
                  resetGameInterval();
                  updateStatusText();
                  drawGame();
              }
          }
          
          function pauseGame() {
              if(gameOverFlag) return;
              if(isGameRunning && !isPaused) {
                  isPaused = true;
                  isGameRunning = false;  // 移动逻辑禁止
                  if(gameLoop) {
                      clearInterval(gameLoop);
                      gameLoop = null;
                  }
                  updateStatusText();
                  drawGame();  // 显示暂停文字层
              } else if(isPaused) {
                  // 如果已经暂停,则恢复
                  startOrResumeGame();
              }
          }
          
          // 完全重置游戏 (新游戏)
          function restartGame() {
              // 清除旧计时
              if(gameLoop) {
                  clearInterval(gameLoop);
                  gameLoop = null;
              }
              resetGameData();
              // 重置标志位, 确保运行
              isGameRunning = true;
              isPaused = false;
              gameOverFlag = false;
              direction = 'RIGHT';
              nextDirection = 'RIGHT';
              // 重置速度
              currentSpeed = BASE_SPEED;
              // 重置分数显示 (resetGameData已刷新分数)
              // 重新生成有效食物(确保)
              let validFood = false;
              for(let i=0;i<100;i++){
                  const testFood = { x: randomInt(0,BOARD_SIZE-1), y:randomInt(0,BOARD_SIZE-1) };
                  if(!snake.some(seg => seg.x===testFood.x && seg.y===testFood.y)){
                      food = testFood;
                      validFood = true;
                      break;
                  }
              }
              if(!validFood){
                  for(let i=0;i<BOARD_SIZE;i++){
                      let found=false;
                      for(let j=0;j<BOARD_SIZE;j++){
                          if(!snake.some(s=>s.x===i && s.y===j)){
                              food={x:i,y:j}; found=true; break;
                          }
                      } if(found) break;
                  }
              }
              updateBestScoreUI();
              drawGame();
              startOrResumeGame();
              updateStatusText();
          }
          
          // ---------- 绘图模块 (华丽风格) ----------
          function drawGame() {
              if(!ctx) return;
              // 背景网格绘制
              ctx.clearRect(0, 0, canvas.width, canvas.height);
              // 绘制网格线
              ctx.strokeStyle = '#3b6e3b';
              ctx.lineWidth = 0.8;
              for(let i = 0; i <= BOARD_SIZE; i++) {
                  ctx.beginPath();
                  ctx.moveTo(i * CELL_SIZE, 0);
                  ctx.lineTo(i * CELL_SIZE, canvas.height);
                  ctx.stroke();
                  ctx.moveTo(0, i * CELL_SIZE);
                  ctx.lineTo(canvas.width, i * CELL_SIZE);
                  ctx.stroke();
              }
              
              // 绘制食物 (红苹果风格)
              ctx.shadowBlur = 0;
              ctx.fillStyle = '#ff5e5e';
              ctx.beginPath();
              const fx = food.y * CELL_SIZE, fy = food.x * CELL_SIZE;
              ctx.arc(fx + CELL_SIZE/2, fy + CELL_SIZE/2, CELL_SIZE/2 - 2, 0, Math.PI*2);
              ctx.fill();
              ctx.fillStyle = '#b33e3e';
              ctx.beginPath();
              ctx.arc(fx + CELL_SIZE/2-2, fy + CELL_SIZE/2-2, 2, 0, Math.PI*2);
              ctx.fill();
              ctx.fillStyle = '#fff3c9';
              ctx.beginPath();
              ctx.arc(fx + CELL_SIZE/2 + 1, fy + CELL_SIZE/2 - 1, 1.5, 0, Math.PI*2);
              ctx.fill();
              // 高光
              ctx.fillStyle = '#ffc2a1';
              
              // 绘制蛇身
              for(let i=0; i<snake.length; i++) {
                  const seg = snake[i];
                  const x = seg.y * CELL_SIZE;
                  const y = seg.x * CELL_SIZE;
                  const gradient = ctx.createLinearGradient(x, y, x+CELL_SIZE, y+CELL_SIZE);
                  if(i === 0) {
                      gradient.addColorStop(0, '#6fbf4c');
                      gradient.addColorStop(1, '#47972e');
                  } else {
                      gradient.addColorStop(0, '#5ba83d');
                      gradient.addColorStop(1, '#3a8020');
                  }
                  ctx.fillStyle = gradient;
                  ctx.fillRect(x+1, y+1, CELL_SIZE-2, CELL_SIZE-2);
                  ctx.fillStyle = '#ccff99';
                  ctx.fillRect(x+3, y+3, CELL_SIZE-6, CELL_SIZE-6);
                  // 眼睛
                  if(i === 0) {
                      ctx.fillStyle = '#ffffff';
                      let eyeXOff = direction === 'RIGHT' ? CELL_SIZE-8 : (direction==='LEFT'? 6: CELL_SIZE/2-2);
                      let eyeYOff = 7;
                      if(direction === 'UP'){ eyeXOff = CELL_SIZE/2-2; eyeYOff = 6; }
                      if(direction === 'DOWN'){ eyeXOff = CELL_SIZE/2-2; eyeYOff = CELL_SIZE-8; }
                      // 动态简单眼睛
                      ctx.beginPath();
                      ctx.arc(x+CELL_SIZE-7, y+7, 3, 0, Math.PI*2);
                      ctx.arc(x+7, y+7, 3, 0, Math.PI*2);
                      ctx.fill();
                      ctx.fillStyle = '#000';
                      ctx.beginPath();
                      ctx.arc(x+CELL_SIZE-8, y+6, 1.5, 0, Math.PI*2);
                      ctx.arc(x+6, y+6, 1.5, 0, Math.PI*2);
                      ctx.fill();
                  }
              }
              
              // 如果游戏结束: 显示半透明遮罩及文字
              if(gameOverFlag) {
                  ctx.fillStyle = 'rgba(0,0,0,0.65)';
                  ctx.fillRect(0, 0, canvas.width, canvas.height);
                  ctx.font = 'bold 24px "Segoe UI", monospace';
                  ctx.fillStyle = '#ffcf9a';
                  ctx.shadowBlur = 0;
                  ctx.fillText('GAME OVER', canvas.width/2-85, canvas.height/2-20);
                  ctx.font = '16px monospace';
                  ctx.fillStyle = '#ddf7c0';
                  ctx.fillText('点击「新的一局」', canvas.width/2-100, canvas.height/2+30);
              } else if(isPaused && !gameOverFlag) {
                  ctx.fillStyle = 'rgba(30,40,20,0.7)';
                  ctx.fillRect(0, 0, canvas.width, canvas.height);
                  ctx.font = 'bold 28px monospace';
                  ctx.fillStyle = '#f9e45b';
                  ctx.fillText('⏸ 暂停', canvas.width/2-58, canvas.height/2);
                  ctx.font = '14px monospace';
                  ctx.fillStyle = '#c3e6a5';
                  ctx.fillText('按 [暂停] 或 空格恢复', canvas.width/2-100, canvas.height/2+40);
              }
          }
          
          // ---------- 方向控制 (防反向) ----------
          function changeDirection(newDir) {
              if(!isGameRunning || isPaused || gameOverFlag) return;
              const opposite = {
                  'UP': 'DOWN', 'DOWN': 'UP', 'LEFT': 'RIGHT', 'RIGHT': 'LEFT'
              };
              if(opposite[newDir] !== direction) {
                  nextDirection = newDir;
              }
          }
          
          // ---------- 键盘控制 ----------
          function handleKeydown(e) {
              const key = e.key;
              e.preventDefault();
              if(key === ' ' || key === 'Space') {
                  if(gameOverFlag) restartGame();
                  else {
                      if(isPaused) startOrResumeGame();
                      else pauseGame();
                  }
                  return;
              }
              if(key === 'ArrowUp') changeDirection('UP');
              else if(key === 'ArrowDown') changeDirection('DOWN');
              else if(key === 'ArrowLeft') changeDirection('LEFT');
              else if(key === 'ArrowRight') changeDirection('RIGHT');
              else if(key === 'r' || key === 'R') restartGame();
          }
          
          // 触摸屏按钮绑定
          function bindMobileControls() {
              const btns = document.querySelectorAll('.dir-btn');
              btns.forEach(btn => {
                  btn.addEventListener('click', (e) => {
                      e.preventDefault();
                      const dir = btn.getAttribute('data-dir');
                      if(dir === 'UP') changeDirection('UP');
                      else if(dir === 'LEFT') changeDirection('LEFT');
                      else if(dir === 'DOWN') changeDirection('DOWN');
                      else if(dir === 'RIGHT') changeDirection('RIGHT');
                  });
              });
          }
          
          // ---------- 初始化事件 & 开始游戏 ----------
          window.addEventListener('load', () => {
              loadBestScore();
              resetGameData();
              bindMobileControls();
              restartBtn.addEventListener('click', () => {
                  restartGame();
              });
              pauseBtn.addEventListener('click', () => {
                  if(gameOverFlag) restartGame();
                  else pauseGame();
              });
              document.addEventListener('keydown', handleKeydown);
              // 启动游戏循环
              startOrResumeGame();
              drawGame();
          });
          
          // 清理定时器页面关闭(可选)
          window.addEventListener('beforeunload', ()=>{
              if(gameLoop) clearInterval(gameLoop);
          });
      })();
    </script>
    </body>
    </html>
    

    几何

    图论编辑器

    尺规画图

    florr.io
    六六大顺の首U

    (细节等级)\tiny (细节等级)

    </p>
    second & third U: 幸运草 玻璃

    机械触角5=1???!!!

    $$AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK^{AK}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}$$

    image

    https://t.alcy.cc/ycy

               ____                             ____                   _____                            _____                  ____ __                  _____           
             /\    \                          /\    \                 /\    \                          /\    \                /::\    \                /\    \         
            /::\    \                        /::\    \               /::\____\                        /::\    \              /::::\    \              /::\    \        
            \:::\    \                      /::::\    \             /:::/    /                        \:::\    \            /::::::\    \             \:::\    \       
             \:::\    \                    /::::::\    \           /:::/    /                          \:::\    \          /::::::::\    \             \:::\    \      
              \:::\    \                  /:::/\:::\    \         /:::/    /                            \:::\    \        /:::/--\:::\    \             \:::\    \     
               \:::\    \                /:::/__\:::\    \       /:::/____/                              \:::\    \      /:::/    \:::\    \             \:::\    \    
               /::::\    \              /::::\   \:::\    \     /::::\    \                              /::::\    \    /:::/    / \:::\    \            /::::\    \   
      ____    /::::::\    \            /::::::\   \:::\    \   /::::::\____\________            ____    /::::::\    \  /:::/____/   \:::\____\  ____    /::::::\    \  
     /\   \  /:::/\:::\    \          /:::/\:::\   \:::\    \ /:::/\:::::::::::\    \          /\   \  /:::/\:::\    \|:::|    |     |:::|    |/\   \  /:::/\:::\    \ 
    /::\   \/:::/  \:::\____\        /:::/  \:::\   \:::\___/:::/   |:::::::::::\____\        /::\   \/:::/  \:::\____|:::|____|     |:::|    /::\   \/:::/  \:::\____\
    \:::\  /:::/    \::/    /        \::/    \:::\  /:::/    \::/   |::|   |                  \:::\  /:::/    \::/    /\:::\    \   /:::/    /\:::\  /:::/    \::/    /
     \:::\/:::/    / \/____/          \/____/ \:::\/:::/    / \/____|::|   |                   \:::\/:::/    / \/____/  \:::\    \ /:::/    /  \:::\/:::/    / \/____/ 
      \::::::/    /                            \::::::/    /        |::|   |                    \::::::/    /            \:::\    /:::/    /    \::::::/    /          
       \::::/____/                              \::::/    /         |::|   |                     \::::/____/              \:::\__/:::/    /      \::::/____/           
        \:::\    \                              /:::/    /          |::|   |                      \:::\    \               \::::::::/    /        \:::\    \           
         \:::\    \                            /:::/    /           |::|   |                       \:::\    \               \::::::/    /          \:::\    \          
          \:::\    \                          /:::/    /            |::|   |                        \:::\    \               \::::/    /            \:::\    \         
           \:::\____\                        /:::/    /             \::|   |                         \:::\____\               \::/____/              \:::\____\        
            \::/    /                        \::/    /               \:|   |                          \::/    /                                       \::/    /        
             \/____/                          \/____/                 \|___|                            \/___/                                         \/____/     
    
    $${10_{9_{8_{7_{6_{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      ________
    /\   ___  \      /\__   __\    /\   ____\    /\  \       /\   ___  \     /\   ____\    /\   ____\
    \ \  \_/\  \     \/_/\  \_/    \ \  \___/    \ \  \      \ \  \__\  \    \ \  \___/    \ \  \___/
     \ \  \ \\  \       \ \  \      \ \  \        \ \  \      \ \   ___  \    \ \____  \    \ \____  \
      \ \  \_\\  \      _\_\  \__    \ \  \_____   \ \  \_____ \ \  \_/\  \    \ ____\  \    \ ____\  \
       \ \________\    /\________\    \ \_______\   \ \_______\ \ \__\\ \__\    /\_______\    /\_______\
        \/________/    \/________/     \/_______/    \/_______/  \/__/ \/__/    \/_______/    \/_______/
    
    
    #include <iostream>
    using namespace std;
    struct node
    {
    	int p = 0,b = -1;
    }a[1005];
    bool v[1005];
    void dfs()
    {
    	
    }
    int main()
    {
    	int n,x;
    	cin >> n >> x;
    	for(int i = 1;i <= n;i++)
    	{
    		int k;
    		cin >> k;
    		if(k == 0) continue;
    		a[i].p = k;
    		a[k].b = i;
    	}
    	for(int i = 1;i <= n;i++)
    	{
    		if(!v[i])
    		{
    			
    		}
    	}
    	dfs();
    	return 0;
    }
    

    image

    image

    image

    ? 《重生之我的现任上司让我的前任上司当我的下任上司》
  • 最近活动

  • Stat

  • 能力评级