2025 CSP-S SD 迷惑行为统计

· · 休闲·娱乐

由于个人保存不当,代码中中文注释全没了……。

可能等官方的程序包出来后再去修改(前提是那时我还在役)。

UPD on 11.7 感谢 @Lament_Rain 提供的代码包,现在有中文注释了。

并对原文进行整理。

默哀区

在代码中搜索 //freopen,共在 89 个文件中找到了 218 个结果。

其中大部分是诈骗,但有 23 个不是诈骗。大概率数错了。但我懒

默哀。

SD-S00170

#include<bits/stdc++.h>
#define push push_back
#define a first
#define b second
//rp++
using namespace std;
int n,m,k,x,y,z;
struct s{
    int x,y,z;
};
vector<s> v;
bool cmp(s a,s b){
    a.z<b.z;
}
int f[2000005];
int t[2000005];
bool p[2000005];
bool find(int x){
    if(f[x]==x)return x;
    else return f[x]=find(f[x]) ;
}
int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>m>>k;
    for(int i=1;i<=n+k;i++){
        f[i]=i;
    }
    for(int i=1;i<=m;i++){
        cin>>x>>y>>z;
        v.push({x,y,z});
    }
    for(int i=1;i<=k;i++){
        cin>>t[i+m];
        for(int j=1;j<=n;j++){
            cin>>z;
            v.push({i+m,j,z});
        }
    }
    sort(v.begin(),v.end(),cmp);
    int h=0;
    for(int i=0;i<m+n*k;i++){
        int tx=find(v[i].x),ty=find(v[i].y);
        cout<<v[i].x<<' '<<v[i].y<<' '<<v[i].z<<'\n';
        if(tx!=ty){
            f[tx]=ty;
            h+=v[i].z;
            if(p[tx]!=1){
                p[tx]=1;
                h+=t[tx];
            }
            if(p[ty]!=1){
                p[ty]=1;
                h+=t[ty];
            }
        }
    }
    cout<<h;
    return 0;
}
/*
4 4 2
1 4 6
2 3 7
4 2 5
4 3 4
1 1 8 2 4
100 1 3 2 4
*/

SD-S00223

#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
long long n,m,c[505],sum,ans=1;
string s;
int main(){
    freopen("employ3.in","r",stdin);
    //freopen("employ.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>m>>s;
    for(int i=1;i<=n;i++){
        cin>>c[i];
    }
    s=" "+s;
    for(int i=1;i<=n;i++){
        sum+=(s[i]=='1');
    }
    if(sum<m){
        cout<<"0";
        return 0;
    }
    if(sum==n){
        for(int i=1;i<=n;i++){
            ans=ans*i%mod;
        }
        cout<<ans;
        return 0;
    }
    return 0;
}

不再列举了。

但这种诈骗很有必要贴出来:

SD-S00453

#include<iostream>
using namespace std;
int main(){
    int n,m;
    freopen("replace.in","r",stdin);
    freopen("replace.out","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        cout<<0<<endl;
    }
    //freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen//freopen
    return 0;
}

63freopen 。神经。

搜索 <bits\stdc++.h> ,共有 5 个结果。

但有一个不是诈骗:

SD-S00433

#include<bits\stdc++.h>
#define _for(i,a,b) for(int i=(a);i<=(b);i++)
#define _rof(i,a,b) for(int i=(a);i>=(b);i--)
#define int ll
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
inline int read(){
    int f=1,num=0;
    char c=getchar();
    while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0' && c<='9'){num=(num<<3)+(num<<1)+(c^48);c=getchar();}
    return f*num;
}
int n,m,k;
int res;
struct e{
    int x,y,v,tp;
    bool operator>(const e& w)const{
        return v>w.v;
    }
};
priority_queue<e,vector<e>,greater<e>> q;
//vector<pair<int,int>> edge[10005];
bool usd[10005];
int c[15],d[15];
int p[15][10005];
int fa[10005];
inline int find(int u){return u==fa[u]?u:fa[u]=find(fa[u]);}
inline void solve(){
    int cnt=n-1;
    _for(i,1,n) fa[i]=i;
    while(cnt--){
        e x;
        while(1){
            x=q.top(),q.pop();
            if(find(x.x)!=find(x.y) && !usd[x.tp]) break;
        }

        fa[find(x.x)]=find(x.y);
//      printf("%lld %lld %lld %lld\n",x.x,x.y,x.v,x.tp);
        res+=x.v;

        if(x.tp){
            usd[x.tp]=1;
            _for(i,1,n) if(i!=d[x.tp]){
                q.push({d[x.tp],i,p[x.tp][i],0});
            }
        }
    }
}
signed main(){
    freopen("road.in","r",stdin);
    freopen("road.out","w",stdout);
    n=read(),m=read(),k=read();
    _for(i,1,m){
        int x=read(),y=read(),v=read();
        q.push({x,y,v,0});
    }
    _for(i,1,k){
        c[i]=read();
        int mn=1e9+10,ind=1;
        _for(j,1,n){
            p[i][j]=read();
            if(p[i][j]<=mn)
                mn=p[i][j],ind=j;
        }
//      printf("%lld\n",ind);
        d[i]=ind;
        _for(j,1,n) if(j!=ind){
            q.push({ind,j,mn+c[i]+p[i][j],i});
        }
    }
    solve();
    printf("%lld\n",res);
    return 0;
}
//i love ccf
**祝好**。 --- 搜索 `#incldue<windows.h>`,共 $1$ 个结果。**且不是诈骗,并导致挂分。** #### SD-S00307 ```cpp #include<bits/stdc++.h> #include<windows.h> #define ll long long #define sdn cout #define pb push_back using namespace std; const int N = 1e4 + 100,M = 2e6 + 100,INF = 1e9 + 7; int a[12][N],idx,n,m,k,op[11]; ll sm,ans; struct edge{ int x,y,z; bool operator <(const edge &p)const{ return z < p.z; } }e[M],e1[M]; vector <int> lk[N]; struct sorasaki_hina{ int f[N],siz[N]; void init(){ for(int i = 1;i < N;i ++) f[i] = i,siz[i] = 1; } int find(int x){ if(f[x] != x) f[x] = find(f[x]); return f[x]; } void mg(int x,int y){ if(siz[x] > siz[y]) swap(x,y); f[x] = y,siz[y] += siz[x]; } }b; inline void check(){ sm = 0;b.init(); vector <int> lk[12]; int cnt = 1,x = 1,opt = n; for(int i = 1;i <= m;i ++){ e1[i] = e[i]; } int idx = m; for(int i = 1;i <= k;i ++){ if(op[i]){ sm += a[i][0];opt ++; for(int j = 1;j <= n;j ++){ e1[++idx] = (edge){i+n,j,a[i][j]}; } } } sort(e1+1,e1+idx+1); while(cnt < opt&&x<=idx){ int u = e1[x].x,v = e1[x].y; int uu = b.find(u),vv = b.find(v); if(uu == vv){ x ++;continue; } sm += e1[x].z;b.mg(uu,vv); if(u < v) swap(u,v); if(u > n) lk[u-n].pb(v); x ++;cnt ++; } for(int i = 1;i <= k;i ++){ if(lk[i].size()==1) sm -= (a[i][0]+a[i][lk[i][0]]); } ans = min(ans,sm); } inline void dfs(int x){ if(x > k){ check(); return ; } op[x] = 0;dfs(x+1); op[x] = 1;dfs(x+1); } inline int read(){ int x = 0; char c = getchar(); while(c < '0' || c > '9'){ c = getchar(); } while(c <= '9' && c >= '0'){ x = x*10+(c-'0'); c = getchar(); } return x; } int main(){ freopen("road.in","r",stdin); freopen("road.out","w",stdout); b.init();ans = 1e18; bool f = 1; n = read(),m = read(),k = read(); for(int i = 1;i <= m;i ++){ int u,v,w; u = read(),v = read(),w = read(); e[i] = (edge){u,v,w}; } for(int i = 1;i <= k;i ++){ for(int j = 0;j <= n;j ++){ a[i][j] = read(); } if(a[i][0] != 0) f = 0; bool ff = 0;for(int j = 1;j <= n;j ++){ if(a[i][j] == 0) ff = 1; } f = f&ff; } if(f){ for(int i = 1;i <= k;i ++){ op[i] = 1; } check(); sdn<<ans; return 0; } dfs(1); sdn<<ans<<endl; return 0; } ``` 搜索 `.ans"` ,有 $19$ 个结果。 去除对拍,还有 $8$ 个结果。 其中有 $6$ 个不是诈骗,并由 $2$ 个人贡献。 **默哀。** #### SD-S01103 这个人在 $4$ 个文件中贡献了 $4$ 次。 ```cpp #include<bits/stdc++.h> using namespace std; int n,q,L,lena,minn=99999999,maxn,ans; string s[200001][2],t1,t2;char a[10001]; int main() { freopen("replace.in","r",stdin); freopen("replace.ans","w",stdout); cin>>n>>q; for(int i=1;i<=n;i++){cin>>s[i][0]>>s[i][1];} for(int i=1;i<=q;i++) {cin>>t1>>t2; /* ans=0; L=t1.length(); for(int j=1;j<=L;j++) { if(t1[j]!=t2[j]) { maxn=max(j,maxn); minn=min(j,minn); } } lena=maxn-minn+1; for(int j=1;j<=n;j++) for(int g=1;g<=s[i][0].length();g++) { } */ cout<<0<<endl; } return 0; } ``` ```cpp #include<bits/stdc++.h> using namespace std; int main() { freopen("road.in","r",stdin); freopen("road.ans","w",stdout); int m,n,k,a,b,c; cin>>m>>n>>k; for(int i=1;i<=3*m+k*(n+1);i++) cin>>a; cout<<0; return 0; } ``` ```cpp #include<bits/stdc++.h> using namespace std; int a[100001][3],A,B,C,n,t,maxn,happy,b[20001],c[20001]; int club(int stu) { if (stu>=n+1) maxn=max(happy,maxn); else { if(A>0){A--; happy+=a[stu][0]; club(stu+1); A++; happy-=a[stu][0];} if(B>0){B--; happy+=a[stu][1]; club(stu+1); B++; happy-=a[stu][1];} if(C>0){C--; happy+=a[stu][2]; club(stu+1); C++; happy-=a[stu][2];} } } int main() { freopen("club.in","r",stdin); freopen("club.ans","w",stdout); cin>>t; for(int i=1;i<=t;i++) { maxn=0; cin>>n; for(int j=1;j<=n;j++) { cin>>a[j][0]>>a[j][1]>>a[j][2]; } if(n>3) {if(a[1][2]==a[2][2]&&a[3][2]==a[2][2]&&a[3][2]==0) {if(a[1][1]==a[2][1]&&a[3][1]==a[2][1]&&a[3][1]==0) {A=n/2; for(int j=1;j<=n;j++){b[a[j][0]]++;} for(int j=20000;A>0;j--) { while(b[j]>0&&A>0) { A--; maxn+=j; b[j]--; } } cout<<maxn<<endl; continue; } else { A=B=n/2; for(int j=1;j<=n;j++) { maxn+=max(a[j][0],a[j][1]); b[abs(a[j][0]-a[j][1])]++; if(a[j][0]>a[j][1]) {A--;c[abs(a[j][0]-a[j][1])]++;} else {B--;b[abs(a[j][0]-a[j][1])]++;} } if(A<0){ A=abs(A); for(int j=0;A>0;j++) { while(c[j]>0&&A>0) { A--; maxn-=j; c[j]--; } }} else { for(int j=0;A>0;j++) { while(b[j]>0&&A>0) { A--; maxn-=j; b[j]--; } } } cout<<maxn<<endl; continue; } } else if(n>9999) { for(int j=1;j<=n;j++) maxn+=max(a[j][0],max(a[j][1],a[j][2])); cout<<maxn<<endl; continue; } } A=B=C=n/2; club(1); cout<<maxn<<endl; } return 0; } ``` ```cpp #include<bits/stdc++.h> using namespace std; long long n,m,c[501],b[501],sum,ans;//c���� b��Ŀ bool p[501],lu[501],flag;//¼Ϊ1 string a; const int mo=998244353; //998244353 long long jc(int x) { int u=1; for(int i=x;i>=1;i--) u=(u*i)%mo; return u; } void pailie(int x,int y)//��ǰ���� ��¼ȡ { if(x>n) return; int temp,s; s=y; for(int i=1;i<=n;i++) { if(p[i]==0) {if(b[x]==1) {if(x>c[i]) { temp=0; for(int j=x-c[i];j<x;j++) temp+=lu[j]; if(temp!=0) {lu[x]=1; s=y-1;} } else {lu[x]=1; s=y-1; } } if(s==0) {ans=(ans+jc(n-x))%mo;} else {p[i]=1;pailie(x+1,s);p[i]=0;lu[x]=0;} } } } int main() { freopen("employ.in","r",stdin); freopen("employ.ans","w",stdout); cin>>n>>m>>a; for(int i=1;i<=n;i++) { cin>>c[i]; b[i]=a[i-1]-'0'; sum+=b[i]; if(c[i]==0) flag=1; } if(m==n){if(sum!=n||flag!=0) cout<<0; else cout<<jc(n); return 0;} if(m>sum){cout<<0; return 0;} pailie(1,m); cout<<ans; return 0; } ``` **祝好**。 另一个人是: SD-S00168。 --- 以下数字统计可能有误,欢迎修改。 `feropen` 出现了 $14$ 次,`int mian` 出现 $2$ 次。 好消息:全部是诈骗。 --- `road1.in/out/ans` 在 `freopen` 里出现了 $5$ 次,有 $0$ 个是诈骗。 `road2.in/out/ans` 在 `freopen` 里出现了 $2$ 次,有 $2$ 个是诈骗。 `road3.in/out/ans` 在 `freopen` 里出现了 $8$ 次,有 $5$ 个是诈骗。 `road4.in/out/ans` 在 `freopen` 里出现了 $10$ 次,有 $10$ 个是诈骗。 --- `replace1.in/out/ans `在 `freopen` 里出现了 $7$ 次,有 $5$ 次是诈骗。 `replace2.in/out/ans `在 `freopen` 里出现了 $2$ 次,有 $0$ 次是诈骗。 `replace3.in/out/ans `在 `freopen` 里出现了 $7$ 次,有 $6$ 次是诈骗。 `replace4.in/out/ans `在 `freopen` 里出现了 $11$ 次,有 $9$ 次是诈骗。 --- `club1.in/out/ans `在 `freopen` 里出现了 $11$ 次,有 $7$ 次是诈骗。 `club2.in/out/ans `在 `freopen` 里出现了 $2$ 次,有 $2$ 次是诈骗。 `club3.in/out/ans `在 `freopen` 里出现了 $5$ 次,有 $4$ 次是诈骗。 `club4.in/out/ans `在 `freopen` 里出现了 $8$ 次,有 $8$ 次是诈骗。 `club5.in/out/ans `在 `freopen` 里出现了 $13$ 次,有 $13$ 次是诈骗。 --- `employ1.in/out/ans `在 `freopen` 里出现了 $8$ 次,有 $7$ 次是诈骗。 `employ2.in/out/ans `在 `freopen` 里出现了 $4$ 次,有 $2$ 次是诈骗。 `employ3.in/out/ans `在 `freopen` 里出现了 $8$ 次,有 $6$ 次是诈骗。 `employ4.in/out/ans `在 `freopen` 里出现了 $3$ 次,有 $3$ 次是诈骗。 `employ5.in/out/ans `在 `freopen` 里出现了 $4$ 次,有 $4$ 次是诈骗。 --- `fuck` 出现了 $10$ 次,并且 `fuck ccf` 出现了 $6$ 次。禁赛三年警告。 PS. `CCF` 在所有代码中出现了 $304$ 次,分布在 $70$ 个文件中。 点名两个人: #### SD-S00527 以一己之力,贡献了 $185$ 个`CCF` 。 ```cpp #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; #define fi first #define se second #define pb push_back #define add(u,v,w) tu[(u)].pb({(v),(w)}) #define forr(x,y) for(int i=x;i<=y;i++) #define endl '\n' const int inf=0x3f3f3f3f; const ll infll=0x3f3f3f3f3f3f3f3f; int main(){ freopen("replace.in","r",stdin); freopen("replace.out","w",stdout); ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); while(1); return 0; } //CCF is good //CCF is good //CCF is good //CCF is good //CCF is good /* ---- 省略 180 个 CCF is good---- */ ``` #### SD-S01524 **请最大化后观看。** ```cpp /* CCF CCF CCF CCF CCF CCF CCF CCF CCF CCF CCF CCF is is is is is CCF CCF CCF is CCF CCF CCF CCF CCF CCF is is is is is CCF CCF CCF is is CCF CCF CCF CCF CCF CCF CCF CCF CCF is is is is is ................. */ ``` 不做评价。 ## 代码长度这一块 最长代码由两个 $85$ KB 的代码取得。 #### SD-S01036&00778 ```cpp #include<iostream> using namespace std; int main(){ freopen("replace.in","r",stdin); freopen("replace.out","w",stdout); int n,m; cin>>n>>m; if(n==4 and m==2){ cout<<0<<'\n'<<2; } if(n==3 and m==4){ printf("0\n0\n0\n0\n"); } if(n==37375 and m==27578){ printf(/*省略 82Kb 大样例内容*/); } if(n==2235 and m==1010){ printf(/*省略 3Kb 大样例内容*/); } else{ for(int i=0;i<m;i++){ cout<<0<<'\n'; } } return 0; fclose(stdin); fclose(stdout); } ``` 神人。 共有 $6$ 个代码超过 $10$ KB。 除去注释超过 $10$ KB 的和两份神人无意义代码,还剩两份有意义的。 有一个巨佬(SD-S01410) T2 写了写了 $13$ KB代码,并在本地成功过编,但交上去 CE 了…………。 **默哀。** 还有另一份 T4 代码,(作者 SD-S00031),写的像一个艺术品。 防止破坏观感,我放在[这里](https://www.luogu.me/paste/s4hwwpmp)。 这份代码取得了 $[0,8]$ 分的好成绩。 全场最短代码由多个人同时取得: ``` ``` (以上为代码全文)。 --- ## 一些小统计 `#define int long long` 出现了 $1100$ 余次。 `ios::sync_with_stdio` 出现了 $1750$ 次。你不能再说他们不能用了。 ## 字符画这一块 如果你想上去,你可以把你的准考证号发给作者。 #### SD-S01264 ``` CCCCCCCCC CCCCCCCCCC FFFFFFFFFFF C C F C C F C C F C C FFFFFFFFFFF C C F C C F CCCCCCCCC CCCCCCCCCC F ``` ~~**您在这种花呢?**~~ #### SD-S00333 ```cpp *** * * * ** * * ** * * duck * * * * *********** * *** * * * * * *** * ********************************* ******** ****** *********************** ** ** *** ********* ********************************* ``` #### SD-S00495 ``` /* -------- �� | | , ---- |--|--| | |---| / |--|--| | |---| /| |--|--| | |---| | | | .|. | | */ ``` 原神巨佬 %%% #### 同上 ``` ^^^^^^^^^^^^ ( �� �� ) | | ------| |-------() | | ---------- \ \ \ \ | | ``` 我在尝试看懂他在画什么。 #### SD-S00999 ``` ____ ____ ____ ____ / / / / / / / / / / / / / / / / / / / /____/ / /\ / /____ /____/ / / / / \ / / / / / / \ /____ ____/ / . ``` %%%%%%%%%%% #### SD-S????? ``` [||||] \__/ / \ / \ /______\ ``` ## 盒子这一块 ### 彩蛋 1 `SD-S01020` 出现在了两个不同人的代码里。 神秘。 ### 彩蛋2 SD-J00001 出现在了选手文件夹中? ### 开盒环节: 帮你们开了,不用谢。 **SD-S00161**:@[China_DeepSeek](luogu://user/1209548) **SD-S00433**:@[undefined_behavior](luogu://user/780262) **SD-S00436**:@[Meng_Xiangyu](luogu://user/1433474) **SD-S00446**:@[JuRuoOIer](luogu://user/476093) **SD-S00588**:@[Lain_yc](luogu://user/547760) **SD-S00655**:@[Aurora_AC](luogu://user/1938765) **SD-S00689**:@[Nahia](luogu://user/1199153) **SD-S00740**:@[Shiro_Zhu](luogu://user/622054) **SD-S00893**:@[Lament_Rain](luogu://user/1157620) **SD-S00999**:@[WangShizhe](luogu://user/1099109) **SD-S01017**:@[_awa_wangjiawen](luogu://user/305069) **SD-S01040**:@[COKENOTFOUND](luogu://user/790382) **SD-S01146**:@[hehejushi](luogu://user/941672) **SD-S01146**:@[AA12_G](luogu://user/787512) **SD-S01320**:@[Staque](luogu://user/592463) **SD-S01468**:@[Wolfiez](luogu://user/915383) **SD-S01469**:@[haozhengrui](luogu://user/748678) **SD-S01563**:@[W_SUN](luogu://user/341801) **SD-S01569**:@[strappple](luogu://user/529038) **SD-S01593**:@[ZhuHua14](luogu://user/826012) **SD-S01608**:@[Gyf117](luogu://user/947527) **SD-S01660**:@[AnotherDream](luogu://user/1208546) ## 英语这一块 依然有 $8$ 个人不会写 `solve` …… --- ## 其他 `AK ` 出现了 $20$ 次。 `afo` 出现了 $18$ 次。 `OI` 出现了 $4$ 次。 `kkk` 出现了 $111$ 次,全名则出现了 $2$ 次。 `chen_zhe` 出现了 $1$ 次,`chenzhe` 出现了 $4$ 次,但不是指的 cz,而 `cz` 出现了 $143$ 次。 `CSP` 出现了 $97$ 次。 `rp` 出现了 $246$ 次。 # 正文 疑似前摇过长。 手动翻了 $6100$ 份代码,如有遗漏,请提醒我一下。 ### 前 摇 过 长 ```cpp #include <bits/stdc++.h> //#include <bits/stdc++.h> //#define int long long //using namespace std; //int n,q,l[200001],b[5000001]; //string s[200001],t[200001]; //signed main(){ //// freopen(".in","r",stdin); //// freopen(".out","w",stdout); // cin >> n >> q; // while(q--){ // cout << "0\n"; // } // return 0; //} //#include <bits/stdc++.h> //#define int long long //using namespace std; //int n,q,l[200001],b[5000001]; //string s[200001],t[200001]; //signed main(){ //// freopen(".in","r",stdin); //// freopen(".out","w",stdout); // cin >> n >> q; // while(q--){ // cout << "0\n"; // } // return 0; //} /*省略 200 行同样的注释*/ #define int long long //bala 正文 ``` ### 祝好 ``` //love you //OI //bye~ bye ``` ### 大佬爆切 T2 ``` //14:48 begin //14:57 realize what I need to do //15:1? find out Union-Find Set is wrong //15:18 pass examples //generate bigger(m = 1e6),if C is too hard //O(2^k k^2 n)?but too hard to get the limit,0.5s in ex3 and 0.3s in ex4 ``` ### 我赌出题人会向数据里放样例! ```cpp #include<bits/stdc++.h> using namespace std; int a[1005]; bool cmp(int a,int b){ return a>b; } int main(){ freopen("road.in","r",stdin); freopen("road.out","w",stdout); cout<<14; return 0; } ``` $0pts$ 。 还有高手: ``` #include<bits/stdc++.h> using namespace std; #define int long long #define fst ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); const int N=1e6+10,M=2e6+10; const int INF=0x3f3f3f3f3f3f3f3f; const int P=998244353; int n,m,ans=1; int a[N]; signed main() { freopen("employ.in","r",stdin); freopen("employ.out","w",stdout); fst cin>>n>>m; if(n==3) { cout<<2; } else if(n==10) { cout<<2204128; } else if(n==100) { cout<<161088479; } else if(n==500) { if(m==1) { cout<<515058943; } else if(m==12) { cout<<225301405; } } return 0; } ``` ### ? ``` // if(n==4){ // b[1]=a[1][1]+a[2][2]+a[3][3]+a[4][3]; // b[2]=a[1][1]+a[3][2]+a[2][3]+a[4][3]; // b[3]=a[1][1]+a[4][2]+a[3][3]+a[2][3]; // b[4]=a[2][1]+a[1][2]+a[3][3]+a[4][3]; // b[5]=a[2][1]+a[3][2]+a[1][3]+a[4][3]; // b[6]=a[2][1]+a[4][2]+a[1][3]+a[3][3]; // b[7]=a[3][1]+a[1][2]+a[2][3]+a[4][3]; // b[8]=a[3][1]+a[2][2]+a[4][3]+a[1][3]; // b[9]=a[3][1]+a[4][2]+a[1][3]+a[2][3]; // b[10]=a[4][1]+a[1][2]+a[2][3]+a[3][3]; // b[11]=a[4][1]+a[2][2]+a[1][3]+a[3][3]; // b[12]=a[4][1]+a[3][2]+a[1][3]+a[2][3]; // b[13]=a[1][1]+a[2][2]+a[3][2]+a[4][1]; // b[14]=a[1][1]+a[2][2]+a[4][2]+a[3][3]; // b[15]=a[1][1]+a[3][2]+a[4][2]+a[2][4]; // b[16]=a[2][1]+a[1][2]+a[3][2]+a[4][3]; // b[17]=a[2][1]+a[3][2]+a[4][2]+a[1][3]; // b[18]=a[2][1]+a[4][2]+a[1][2]+a[3][3]; // b[19]=a[3][1]+a[2][2]+a[1][2]+a[4][3]; // b[20]=a[3][1]+a[1][2]+a[4][2]+a[2][3]; // b[21]=a[3][1]+a[4][2]+a[2][2]+a[1][3]; // b[22]=a[4][1]+a[1][2]+a[2][2]+a[3][3]; // b[23]=a[4][1]+a[2][2]+a[3][2]+a[1][3]; // b[24]=a[4][1]+a[3][2]+a[1][2]+a[2][3]; // b[25]=a[1][1]+a[2][1]+a[3][2]+a[4][3]; // b[26]=a[1][1]+a[3][1]+a[2][2]+a[4][3]; // b[27]=a[1][1]+a[4][1]+a[2][2]+a[3][3]; // b[28]=a[1][1]+a[][]+a[][]+a[][]; // b[29]=a[1][1]+a[][]+a[][]+a[][]; // b[30]=a[1][1]+a[][]+a[][]+a[][]; // b[31]=a[][]+a[][]+a[][]+a[][]; // b[32]=a[][]+a[][]+a[][]+a[][]; // b[33]=a[][]+a[][]+a[][]+a[][]; // b[34]=a[][]+a[][]+a[][]+a[][]; // b[35]=a[][]+a[][]+a[][]+a[][]; // b[36]=a[][]+a[][]+a[][]+a[][]; // b[37]=a[][]+a[][]+a[][]+a[][]; // b[38]=a[][]+a[][]+a[][]+a[][]; // b[39]=a[][]+a[][]+a[][]+a[][]; // b[40]=a[][]+a[][]+a[][]+a[][]; // b[41]=a[][]+a[][]+a[][]+a[][]; // b[42]=a[][]+a[][]+a[][]+a[][]; // b[43]=a[][]+a[][]+a[][]+a[][]; // b[44]=a[][]+a[][]+a[][]+a[][]; // b[45]=a[][]+a[][]+a[][]+a[][]; // // } ``` ### 不可以,总司令 ```cpp for(int i=1;i<=q;++i){ cout<<0<<endl; } ``` ### 又是字符画 ``` ------------------------------------------------------------------------- | | _ | / ~ | / ~ | / / `\ | ~ /`\ )\ | ~- `\ / | | _ ---`\ / | |_| ---- `\ | `\ | | | | | | | | | ------------------------------------------------------------------------- ``` ### 祝好 ``` I love CCF I can't solve this problem 17:59 I can't solve this problem I'll AFO Goodbye ``` 还有 ```cpp // wo zhen de bu xiang tui yi ``` ### Don't learn me ```cpp //wrong answer,don't learn me. //time limit exceed,don't learn me. ``` ### P ```cpp //2025.11.1 17:41 100+72+30+24=226 //Is it enough?? I am too vegetable. //I think SD-S01020 is going to AK. ``` 关键问题是,你写别人考号干啥? ### ALL FOR MYSELF, NOT ANYONE ELSE ```cpp //ALL FOR MYSELF, NOT ANYONE ELSE #include<bits/stdc++.h> //#define TERRY_MC #define endl '\n' #define int ll using namespace std; typedef long long ll; const int N=505,MOD=998244353; /*以下略*/ ``` ### ccf dont ban me ```cpp /*编者注:部分内容已经使用 * 替代 */ //f**k your poopoo, i like d***s //ccf dont ban me pls i sorry ``` ### 来 生 再 见 ```cpp //i love yukina roxy anon yuki aimi aiba and all of bangdreams characters and cvs //CCF SEE U NEXT LIVE //RP++ ``` ### I AKed CSPJ this morning ```cpp //*Some strong music rings... /* Today is 20251101. The code is by XYM!!! */ //We are strange to love. //You know the rules and so do I~ // //Never gonna give you up. //Never gonna let you down. //Never gonna run around and hurt you. //Never gonna make you cry. //Never gonna say goodbye. //Never gonna run around and hurt you. // //luogu UID 1433474,luogu name Meng_Xiangyu //I AKed CSP-J this morning. ``` ### love CCF ``` //rp++ //love CCF ``` ### LinYin 是谁啊? ```cpp //Don't forget our relativeship, Lin Yin... ... li666 answer666=0; heap7772666=heap7771666; / for(int i666=1; i666<=n666; i666++) fa666[i666]=i666; int cnts666=0; while(heap7772666.size()&&cnts666<n666) { lsqxx666 bs666=heap7772666.top(); heap7772666.pop(); int lss666=bs666.s7771666; //Lin Sen Sen int lxx666=bs666.t7771666; //Lin Xiao Xi li666 dis666=bs666.wd666; if(fam666(lss666, lxx666)) continue; heap666.push(bs666); answer666+=dis666; mer666(lss666, lxx666); cnts666++; } li666 ans666=answer666; li666 ly666=n666+k666; //Lin Yin, you have been rebirthed!!! //I will save you, Lin Yin... ... //Brother... My elder brother... ... //Now, let's say "Goodbye". //Goodbye, my brother... ... //Goodbye, my inside girl-- Little Yin... ... for(int i666=0; i666<lm666; i666++) { //I have so much power!!! I am powerful!!! -- Lin Yin ``` ### 求翻译 ```cpp //yu shi zhen hao ke !!! ``` ### 别样的祈福 ```cpp // Can you give me more points,CCF? ``` 甚至还有效仿者: ```cpp //CCF I love you, please gives me some scores. ``` 还有直抒胸臆: ``` //I love CCF ``` ### 暴戾语言 ```cpp //FUCK Magus CYB //FUCK zzldd DJM //HAPPY ``` ### 我知道你喜欢玩原神了 ```cpp // I want to play Genshin and Star Rail! /*省略数十行相似内容*/ // I love Furina! /*省略 10 行相同内容*/ ``` ### 今年太难了 ```cpp //TOO HARD!!! //25pts //jin nian tai nan le //xiakule //ovo -> owo -> ono -> awa -> pwp -> qwq ``` ### Wake up ``` Wake up! What should I do now? Could I see the blossom? But now I may find you. Why T1 so hard!!!!!!!! 45min. ``` ### HELLO ```cpp Hello. I am a minecraft player. My minecraft ID is:SonomaSKY_xyz. I like playing minecraft. And I enjoy it. Elytra is my favorite item. I am looking forward to playing minecraft 1.21.11. I am an OIer,too. My luogu UID is:1209548. 2025/11/1 I went to RiZhao,ShanDong. I have an exam. It is nemed CSP-S,by CCF. It is important. RP += INF. ^__^ ``` ### I AK IOI ``` @__CrossBow_EXE__SD-J00628. //freopen //feropen IAKIOI ``` ### 阿森纳球迷 ``` North London Forever Whatever the weather These streets are our own And my heart will leave you never My blood will forever Run through the stone~ COYG! ``` ### Never gonna give you up ``` We're not strangers to love You know the rules and so do I A full commitment what I'm thinking of You wouldn't get this from any other guy I just wanna tell you how I'm feeling Gotta make you understand Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you We've known each other for so long Your heart's been aching but you're too shy to say it Inside we both know what's been going on We know the game and we're gonna play it And if you ask me how I'm feeling Don't tell me you're to blind to see Never gonna give you up Never gonna let you down Never gonna run around and desert you Never gonna make you cry Never gonna say goodbye Never gonna tell a lie and hurt you ``` ### 唯一活下来的中文注释,真是个奇迹 ```cpp /* 试一试: 看看我如何状态转移 总满意度我看看,每进入一个新人,算一下他将就好还是已有的某个人将就好 好像得排序,具体怎么排不知道 看一下前8组是否能过,n<=30 先dfs看看,O(3^n),2.058911e+014,显然TLE了 200 1e7 可以O(n^3) 第12可以水过去 想想前8或前11如何得分 显然,需要决定谁去A,谁去B,谁去C。求总和。但是不能简单取最大值 想一个快于等于O(n^3)的 先想c=0,即一半去A一半去B 如果这样,需统计B比A大的和A比B大的 哪一种少优先选择,其次从多的那一种只能选一部分去另一个了。此时让差小的去另一个更优。 时间复杂度O(nlogn),即使用了priority_queue也没法进一步优化最坏情况 此时8组到手。 看看此时有去C的了,…… 分为3类:A最大的,B最大的,C最大的。因为交换无影响 设最多的为a,第二为b,最少为c 显然,不可能a和b同时大于n/2 所以只有a里的人能将就,去b和去c如何定? 若a多出来的人都去b完全可以,因为a+b<n 所以将A根据差排序决定去B还是去C。 因为无需关心a,b,c具体是啥,算出差即可。 无需关心?好像需要关心a,b,c中a的值,b和c不用关心 100分到手。 好像不对。我需要记录最大值从哪里取的,只从从a取的里面减即可 所以应该可以: ================================================================ 第二题,大图论 我想想…… 只有两种途径让它变成连通图 1.修复已有边 2.使用新增点,并加入新增点和已有点的连边 怎么修复可以跑一遍kruskal(或Prim)。但是不然,现在有新增点了。 新增点与每个点都能有连边,所以,有个笨办法,根据新增点状况进行dfs 这样O(mlogm*2^k)(kruskal) O(n^2*2^k) (prim) 想想怎么基于其中一个改 cc 直接跑一遍prim能过4个 O(n^2*2^k)能过8个 O(mlogm*2^k)能过4个 prim基于已访问过点,kruskal基于边,想一下基于prim的吧 基于prim,可以不加任何点求出最小生成树。再想想如何在prim过程中加点使得加过点之后更小 加点只需要付加过点的权值。即已有这个点,边是能考虑的。 那么怎么加点呢?Kruskal还是Prim? 啊?特殊性质A? 如果有特殊性质A,即直接把这些点加进去即可,可以不连通这些点? 不连通这些点?K还是P? 只要不连通这些即可,prim是把已联通的连通块连接边加入新点,kruskal是选所有边不构成环的最小边。 我想想…… 如果存在两个点使得经其中一个新点路更短,则路最短的新点一定在答案中。然后 跑一个dijkstra只能获得从一个点的最短路,可能这步"优化"更慢了 先想想特殊A吧 有了特殊A,即求最小生成树,其中几个节点可以是非树节点。 好像既然特殊A有后半句,找一下最大的i,之后前i个点都免费了。此时只剩下所有点跑个最小生成树,同时删去 预期4个 ================================== 先做第三个吧。 第三个,我需要先算出字符串的区别。即掐头去尾 这样之后,有一个子串关系: a<=b<=c a是掐头去尾后的 b是s_{i,1} c是原串 只要对于每个有此子串关系的s_{i,1}判断替换之后的会怎样就行. 接下来就是如何快速判断是否有这个关系。 判断可以用KMP做到O(s),s是字符串长度。我看看这种做法能得多少分 5e6? 接下来,既然总长是5e6,且为多测,O(L1+n*L2) 根据上面的思路,我需要先把每个小串的next表算出来,这一步O(L1) 然后对于每个q,求出它掐头去尾的next表,然后比较每个串是否符合这个子串关系 设这个q大串长度为s O(s*n) 即O(n*L2) q=1对此做法无影响 若有B,掐头去尾肯定是baaa...a或aaaa...b 根据b位置左边的a个数和右边的a个数就行。 比较子串关系变成O(1) 此时总复杂度是O(n*q) 看看能不能让它带log 好了,预期6组 试试哈希? 哈希之后,如何判断是否有子串关系?有点难 =================================== 看第四题吧。 第四题我看一下是否会做 第四题我可以写个dfs骗骗分 看看折半搜索? n!好像没法折半,有没有剪枝 如果没面试的所有人耐心都低于了没通过的,则break掉 想想其他的。 想不到。就这样写吧 第四题有个特殊性质A,有A的直接阶乘取模。 m=n时全1则阶乘取模,有0则0 m=1? 这个我想想…… m=1时只录取一个人即可。则可以所有情况减都不录取的情况 都不录取看看能不能求 都不录取? 第一天是1时一定能有人录取 如果第一天是0,不知道了。 此时预期7个 好了 第二题预期4组 第三题6组 第四题7组 那么先做第四题 */ ``` ### 原神玩家+1 ``` luogu@Nahia uid:1199153 Genshin Impact uid:289015817 I love Nahida forever!*/ ``` ### 许愿&感谢 ```cpp /* gu fen: 100+56+[25,100]+20=[201,276] maybe 0? thank you Furina thank you Cyrene thank you Elysia thank you HL1 thank you Rabbit group thank you Hikari thank you Tairitsu thank you Geopelia thank you Gino please let me 200+ please let me 1= please let me level 7 t1 trivial greedy? da yang li pass t2 mst can do 16pts and pass sample 2??? mst + constraint A + O(2^k mlogm)=56? t3 trie pao de fei kuai?? passed da yang li 25?50?100?? t4 zhuang ya dp 20? I thought an O(n^2) solution but it's impossible to dp //freopen //freopen #include<bits\stdc++.h> int y1; freopen("club.ans","w",stdout); freopen("employee.in","r",stdin); We're no strange to love you know the rules and so do I Darkest nignt I'll confront you here... rain sky red blue touch collapse baby's sleep song please let me 1= please let me 1= please let me 1= please let me not 0pts please let me 200+ please let me level 7 */ ``` ### 求翻译 ```cpp /* xian zai hai mei kai kao,wo jiu yi jing po bu ji dai de xie xia le zhe duan zhushi xian zai yi jing shi 18:04 le wo de xin qing shi fen gou shi dao bu shi shuo wo zuo le yi dui gou shi (shi ji shang wo jiu shi zuo le yi tuo gou shi , dan wo de yi si shi wo bu shi yin wei wo zuo le yi tan gou shi xin qing bian gou shi de) er shi yin wei wo fa zi fei fu xie le yida duan hua wang bao cun le qi si wo le wo xian zai yao nai zhe xing zi hui xiang yi xia,zai xei xia lai: wo mei nai xin xiang le fan zheng da gai jiu shi gan xie le yi dui ren ran hou jue de zhe ci kao ~120 ru guo wo you xing(xing yun de xing)qie you qing(qing xv de qing) wo hui zai NOIP hao hao zai xie yi bian xi wang neng hun ge 3= gan xie na ge zheng li mi huo xing wei da shang de ren ma fang ni ba zhe yi da duan wen zi xie cheng han zi From luogu @Shiro_Zhu BCMS ZhuXi ling : bi wo cai de bi wo qiang de gen wo shui ping cha bu duo de dou AK CSP hai you ,wo bu xiang ding ge lv gou tui yi lai ge blue blue blue blue blue blue blue blue blue dui le ,wo hai yao tu cao yi xia,wo de da zhou mei le . hai you,zhe shi wo di yi ci da CSP-S */ ``` ### hope ``` I'm luogu uid748678. Maybe it's my last year in CSP/NOIP. Hope everything goes best. ``` ### %%% ``` /* at 16:04 finally aked with all the best wishes at 17:20 4 duipais were built try to write an overall selfeval but failed */ ``` ### 游记爷 ``` /* Ren5Jie4Di4Ling5% 16:25 wtf so easy?just hash is ok or i am a (b h)? 16:30 i understand the problem in a wrong way OvO. 16:40 i can only solve 25pts,D first. 17:00 back to think C 17:20 i think i should start to write codes for C and D,only 249pts,sad 17:35 finisg 25pts,why wrong? 17:40 pass 25pts 18:15 i can solve 30pts now 18:25 finish 30pts */ ``` ### 我猜 1 ```cpp #include<bits/stdc++.h> #define pii pair<long long,long long> #define ll long long using namespace std; const int N = 1e5 + 9; int n,m,k,w[N]; vector<pii> v[N]; priority_queue<pii,vector<pii>,greater<pii> > p; int main(){ freopen("employ.in","r",stdin); freopen("employ.out","w",stdout); cout << 1; fclose(stdin); fclose(stdout); return 0; } ``` ### 我摆了 ``` ``` 以上为代码全文。 ### 万 · 能 · 头 ```cpp #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<ctime> #include<cstring> #include<string> #include<algorithm> #include<bitset> #include<vector> #include<queue> #include<deque> #include<stack> #include<map> #include<set> /* 省略若干 */ using namespace std; int main(){ freopen(".in","r",stdin); freopen(".out","w",stdout); return 0; } ``` ### T1 肝佬 ```cpp #include<bits/stdc++.h> using namespace std; const int N=1e5+101; long long t; long long n; struct node { int fir; int sec; int thi; int vis; int c12; int c23; int c13; }sta[N]; struct node1 { int fir; int sec; int thi; int vis; int c12; int c23; int c13; }sta1[N]; struct node2 { int fir; int sec; int thi; int vis; int c12; int c23; int c13; }sta2[N]; struct node3 { int fir; int sec; int thi; int vis; int c12; int c23; int c13; }sta3[N]; int cmp1(node a,node b) { return a.fir>=b.fir; } int cmp2(node a,node b) { return a.sec>=b.sec; } int cmp3(node a,node b) { return a.thi>=b.thi; } signed main() { freopen("club.in","r",stdin); freopen("club.out","w",stdout); cin>>t; while (t--) { cin>>n; long long ans=0; int nu[5]; nu[1]=n/2; nu[2]=n/2; nu[3]=n/2; int num[N]={}; for (int i=1;i<=n;i++) { cin>>sta[i].fir>>sta[i].sec>>sta[i].thi; sta[i].c12=sta[i].fir-sta[i].sec; sta[i].c13=sta[i].fir-sta[i].thi; sta[i].c23=sta[i].sec-sta[i].thi; } sort(sta+1,sta+n+1,cmp1); for (int i=1;i<=n;i++) { sta1[i].fir=sta[i].fir; sta1[i].sec=sta[i].sec; sta1[i].thi=sta[i].thi; sta1[i].c12=sta[i].c12; sta1[i].c23=sta[i].c23; sta1[i].c13=sta[i].c13; } for (int i=1;i<=n/2;i++) { ans+=sta[i].fir; sta[i].vis=1; num[i]=1; } //cout<<ans<<endl; sort(sta+1,sta+n+1,cmp2); for (int i=1;i<=n;i++) { sta2[i].fir=sta[i].fir; sta2[i].sec=sta[i].sec; sta2[i].thi=sta[i].thi; sta2[i].c12=sta[i].c12; sta2[i].c23=sta[i].c23; sta2[i].c13=sta[i].c13; } for (int i=1;i<=n/2;i++) { if (sta[i].vis) { if (sta[i].sec>sta[i].fir) { nu[1]--; ans+=(sta[i].sec-sta[i].fir); num[i]=2; } else nu[2]--; } else { sta[i].vis=1; ans+=sta[i].sec; num[i]=2; } } //cout<<ans<<endl; sort(sta+1,sta+n+1,cmp3); for (int i=1;i<=n;i++) { sta3[i].fir=sta[i].fir; sta3[i].sec=sta[i].sec; sta3[i].thi=sta[i].thi; sta3[i].c12=sta[i].c12; sta3[i].c23=sta[i].c23; sta3[i].c13=sta[i].c13; } for (int i=1;i<=n/2;i++) { if (sta[i].vis) { if (sta[i].thi>sta[i].fir&&sta[i].thi>sta[i].sec) { if (num[i]==2) { nu[2]--; ans+=(sta[i].thi-sta[i].sec); } else { nu[1]--; ans+=(sta[i].thi-sta[i].fir); } } else nu[3]--; } else { sta[i].vis=1; ans+=sta[i].thi; num[i]=3; } } //cout<<ans<<endl; for (int i=1;i<=n;i++) { if (!sta[i].vis) { int yi=0,er=0,san=0; int y=0,e=0,s=0; if (sta[i].fir>=sta[i].sec&&sta[i].fir>=sta[i].thi) { yi=sta[i].fir; y=1; } else if (sta[i].sec>=sta[i].fir&&sta[i].sec>=sta[i].thi) { yi=sta[i].sec; y=2; } else if (sta[i].thi>=sta[i].sec&&sta[i].thi>=sta[i].fir) { yi=sta[i].thi; y=3; } if (sta[i].fir>=sta[i].sec&&sta[i].fir<=sta[i].thi||sta[i].fir>=sta[i].thi&&sta[i].fir<=sta[i].sec) { er=sta[i].fir; e=1; } else if (sta[i].sec>=sta[i].fir&&sta[i].sec<=sta[i].thi||sta[i].sec>=sta[i].thi&&sta[i].sec<=sta[i].fir) { er=sta[i].sec; e=2; } else if (sta[i].thi<=sta[i].fir&&sta[i].thi<=sta[i].sec||sta[i].thi>=sta[i].sec&&sta[i].thi<=sta[i].fir) { er=sta[i].thi; e=3; } if (sta[i].fir<=sta[i].sec&&sta[i].fir<=sta[i].thi) { san=sta[i].fir; s=1; } else if (sta[i].sec<=sta[i].fir&&sta[i].sec<=sta[i].thi) { san=sta[i].sec; s=2; } else if (sta[i].thi<=sta[i].fir&&sta[i].thi<=sta[i].sec) { san=sta[i].thi; s=3; } if (nu[y]<n/2) ans+=yi; else { if (er) ans+=er; else { if (y==1) { for (int j=n/2;j>=1;j--) { if (!sta1[j].vis) { if (sta1[j].c23>=0&&sta1[j].sec!=0&&sta1[j].c12>=0) { ans-=sta1[j].fir; ans+=sta1[j].sec; ans+=yi; sta1[j].vis=1; break; } else if (sta1[j].c23<=0&&sta1[j].thi!=0&&sta1[j].c13>=0) { ans-=sta1[j].fir; ans+=sta1[j].thi; ans+=yi; sta1[j].vis=1; break; } } } } else if (y==2) { for (int j=n/2;j>=1;j--) { if (!sta2[j].vis) { if (sta2[j].c12>=0&&sta2[j].fir!=0&&sta2[j].c12<=0) { ans+=sta1[j].sec; ans+=sta1[j].fir; ans+=yi; sta2[j].vis=1; break; } else if (sta1[j].c13<=0&&sta1[j].thi!=0&&sta2[j].c23>=0) { ans-=sta1[j].sec; ans+=sta1[j].thi; ans+=yi; sta2[j].vis=1; break; } } } } else if (y==3) { for (int j=n/2;j>=1;j--) { if (!sta3[j].vis) { if (sta3[j].c12<=0&&sta1[j].sec!=0&&sta3[j].c23<=0) { ans+=sta3[j].thi; ans+=sta3[j].sec; ans+=yi; sta3[j].vis=1; break; } else if (sta3[j].c12>=0&&sta3[j].fir!=0&&sta3[j].c13<=0) { ans+=sta3[j].thi; ans+=sta3[j].fir; ans+=yi; sta3[j].vis=1; break; } } } } } } } } cout<<ans<<"\n"; } return 0; } ``` --- 终于整理完了。 整理不易,不喜轻喷,谢谢。 后续会更的。