CSPS2022 HN 迷惑代码

· · 个人记录

小编 VSCode 主题:Minimal Dark,字体:JetBrains Mono。

就图一乐,如果有不想上镜的人被扣上镜了可以私信 _Arahc_ 一下 qwq。

在 S 组代码中一共找到 3558 个 #include,其中包含 2388 个 #include<bits/stdc++.h>。共找到了 375 个 #define int long long。共找到 103 个 //freopen,其中有一部分是虚晃一枪人(见后文)。

部分词汇搜索结果数:

在统计 //freopen 时,我们发现了这样的代码:

//freopen
//NEVER GONNA GIVE YOU UP!
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
int q;
signed main()
{
    freopen("galaxy.in","r",stdin);
    freopen("galaxy.out","w",stdout);
    srand(time(NULL));
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++) cin>>n>>n;
    cin>>q;
    while(q--) cout<<(rand()%2?"YES":"NO")<<endl;
    return 0;
}

srds,小编还是决定把这个代码记入 //freopen 的统计数量。不过很可惜这位同学并没有骗到小编。此外,感谢你贡献了唯四的 rick roll 出现次数。

此外我们还发现了一些全部被注释掉的代码。嗯。

神秘文件夹名人

收到了一个未建此目录人,一个 H N 人,一个下划线人,和若干准考证号少打一了 S 人:

表白人

整活+希望没人看见人:

剩下的全是表白 CCF 人,其中大部分都是在代码注释中出现了 love CCF,当然还有直接输出人:

当然还有:

/*
CCF 我爱你!!!
I love you!!! CCF!!!
可爱的 CCF。 
CCF 太可爱了。 

update:题做不出来 ToT。
没爱了。 
*/

禁一人

#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("transmit.in","r",stdin);
    freopen("transmit.out","w",stdout);
    cout<<"我操你妈妈,傻逼CCF"<<endl;
    return 0;
}

不知道干啥人

这是一位神秘同学的 T1 holiday 代码:

#include<bits/stdc++.h>
using namespace std;
int n,m,a[305];
int main(){
    //freopen("holiday.in","w",stdin);
    //freopen("holiday.out","r",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&a[i]);
    (rand()%2)?cout<<"Yes":cout<<"No";

} 

我们至今无法找到其 T1 到底写的是哪个题。而且其居然同时杂揉了小写 Yes/No,"w",stdin 和 "r",stdout,以及注释文件三大神秘的东方力量,可谓集上成之大作。

另外一提,"r",stdout 人还有很多,此处只以这一个作为例子。

当然还有很多句式杂揉人和 r,w 写反人:

 #include<bits/stdc++.h>
using namespace std;
int n,m,a[50005],b[50005],c[50005],k;
int main(){
    freopen("galaxy.in","w",stdin);
    freopen("galaxy.out","r",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    scanf("%d",&a[i]);
    cin>>m;
    for(int i=1;i<=m;i++)
    cin>>a[i]>>b[i]>>c[i];
    for(int i=1;i<=m;i++)
    (rand()%2)?cout<<"Yes\n":cout<<"No\n";
}

某位同学在 galaxy 的文件夹里同时提交了 galaxy.cpp 和 holiday.cpp,然而其 galaxy.cpp 长这样:

#include<bits/stdc++.h>
using namespace std;
typedef lng long long;
const int maxn=2500+7;
const int maxm=2*1e4+7;
struct edge{int v,nx;}e[maxm];
int n,m,p,eh[maxn],ec;
lng scr[maxn];
void addedge(int u,int v){
    e[++ec].v=v;
    e[ec].nx=aeh[u];
    eh[u]=ec;
}
int main(){
    freopen("holiday.in","r",stdin);
    freopen("holiday.out","w",stdout);
    scanf("%d%d%d",&n,&m,&p);
    for(int i=2;i<=n;++i)
        scanf("%lld",&scr[i]);
    for(int i=1,x,y;i<=m;++i)
        scanf("%d%d",&x,&y),addedge(x,y),addedge(y,x);

    return 0;
} 

还有一位同学的 holiday.cpp 开了这样的文件:

    freopen("t.in","r",stdin);
    //freopen("","w",stdout);

一位同学的文件是这样开的:

    freopen("galaxy","r",stdin);
    freopen("galaxy","w",stdout);

另外 TA 的四个题目的文件都是这样开的,遗憾爆零。为 TA 默哀。

还有这样的惨案:

{ freopen("galaxy.in","r","exp.in")
  freopen("galaxy.out","w","galaxy.out")
{ freopen("transmit.in","r","std.in");
  freopen("transmit.out","w","std.ans");

以上代码出自同一个人,不过请问你的 exp.in 是什么?

论新人 OIer 在 CSP 考前确认如何开文件的重要性.jpg。

还有一位 freopen 开文件用绝对路径人+代码没写完人:

#include<iostream>
using namespace std;
int zhil(int a,int b){
    int s;
    if(a=1){

    }
}
int main(){
    int n,m,u,v,q;          //n个据点,m个虫洞链接, 
    freopen{"file://D://HN-S00666//galaxy//game.in",std.in;}
    freopen{"file://D://HN-S00666//galaxy//game.in",std.in;}
    cin>>n>>m;
    int ju[n];
    int cd[m][2];
    for(int i=0;i<m;i++){
        for(int o=0;o<2;o++){
            cin>>cd[i][o];
        }
    } 
    cin>>q;
    int t[q];
    int qi,zhon;
    for(int i=0;i<q;i++){
        cin>>t[i];
        if(t[i]=1){
            cin>>qi>>zhon;
            for(int i=0;i<m;i++){
                if(((cd[i][1]=qi) and (cd[i][0]=zhon)) or ((cd[i][0]=qi) and (cd[i][1]=zhon))){

                }
            }
        }
    }
}

正解,但不完全是正解

发现了一位同学写了 T2 正解(线段树维护)。

……但是为啥你的 max_n 这么小啊(

#include <algorithm>
#include <cstdio>

const int maxn = 1e3 + 5;

template< class T >
inline T abs( T x )
{
    if( x < 0 )
    {
        return -x;
    }
    return x;
}

int n, m, q;
int a[ 2 ][ maxn ];

struct node
{
    int max, min, bclose, mclose;
};

namespace Tree
{
#define ls rt << 1
#define rs rt << 1 | 1

    int max[ 2 ][ maxn << 2 ], min[ 2 ][ maxn << 2 ],
        bclose[ 2 ][ maxn << 2 ], mclose[ 2 ][ maxn << 2 ];

    void Push_up( int rt, int k )
    {
        max[ k ][ rt ] = std::max( max[ k ][ ls ], max[ k ][ rs ] );
        min[ k ][ rt ] = std::min( min[ k ][ ls ], min[ k ][ rs ] );
        bclose[ k ][ rt ] = std::min( bclose[ k ][ ls ], bclose[ k ][ rs ] );
        mclose[ k ][ rt ] = std::max( mclose[ k ][ ls ], mclose[ k ][ rs ] );
    }

    void Build( int l, int r, int rt, int k )
    {
        if( l == r )
        {
            max[ k ][ rt ] = min[ k ][ rt ] = a[ k ][ l ];
            if( a[ k ][ l ] >= 0 )
            {
                bclose[ k ][ rt ] = a[ k ][ l ];
            }
            if( a[ k ][ l ] <= 0 )
            {
                mclose[ k ][ rt ] = a[ k ][ l ];
            }

            return ;
        }

        int mid = ( l + r ) >> 1;

        Build( l, mid, ls, k );
        Build( mid + 1, r, rs, k );

        Push_up( rt, k );
    }

    node Query( int l, int r, int rt, int L, int R, int k )
    {
        if( L <= l && r <= R )
        {
            return { max[ k ][ rt ], min[ k ][ rt ], bclose[ k ][ rt ], mclose[ k ][ rt ] };
        }

        int mid = ( l + r ) >> 1, tmp = 0;
        node res, res1, res2;

        if( L <= mid )
        {
            res1 = Query( l, mid, ls, L, R, k );
            tmp += 1;
        }
        if( R > mid )
        {
            res2 = Query( mid + 1, r, rs, L, R, k );
            tmp += 2;
        }

        if( tmp == 1 )
        {
            return res1;
        }
        if( tmp == 2 )
        {
            return res2;
        }

        res.max = std::max( res1.max, res2.max );
        res.min = std::min( res1.min, res2.min );
        res.bclose = std::min( res1.bclose, res2.bclose );
        res.mclose = std::max( res1.mclose, res2.mclose );

        return res;
    }

#undef ls
#undef rs
}

// ...... 代码太长了,省略主函数罢 qwq

Unicode:你礼貌吗

其实是未定义人:

此外,诶,你的 flag 未定义啊喂!

解密后代码如下:

保佑人

/*
IOIAKer YB(OccDreamer) bless me!
IOIAKer YZJ(_YangZJ_) bless me!
IOIAKer DYZ(0ccDreamer) bless me!
IOIAKer WFY(wfycsw) bless me!
IOIAKer TY(tytyty) bless me!
IOIAKer HSA(huangsian) bless me!
IOIAKer HWZ(Mr_Avalon) bless me!
IOIAKer HHY(xyxyxyxyxyxy) bless me!
IOIAKer RY(________a____) bless me!
*/

被爆洛谷用户名的同学:你礼貌吗。

// plz do not boom
// hai hao pai le/ch
// The Dragon King bless me!!1

你的这份代码在洛谷冥间数据上的确通过了,恭喜 awa。

//God Bless Ryuichi Sakamoto...

UID:158878。God Bless Ryuichi Sakamoto。

当然这位同学还贴心的在他的 T2 代码里详细地写上了题解。

歌词人

//Oh baby , tell me
//every things alright
//I gone nobody
//waste this time
//tonight
//Make you feel so good
//I'll never let you go
//If you give me
//I won't forgive you 

——《Be Crazy For Me》

//No matter where you go
//How do you see me
//from your point of view?

还是《Be Crazy For Me》

//rp++
//Be crazy for me
//Make me shine on you
//You gotta see me when you hear my music
//I be there for you 

还是……

//And the word turns upside down.
//Who lives,who dies,who tells us stories.

额,百度搜到的是《Hamilton》,其实小编也不知道是什么。

而且,你的 world 打成了 word 嗯。

CY 人

//CY give me 15 pts.
//CY give me 70 pts.
//CY give me CSP S 1=
//CY give me 70 pts.

抒情人

int main(){
    //**** I coded 7kb,but it died !!! I'm very sad...
    //            But I can't AFO!!!!!
    //                                  by---lrq090403

注:他的 T2 代码为 7.12KiB。

祝大家成功地在 OI 的道路上追逐到自己的梦想。

当然还有直接表达了对 CCF 的赞美与感谢的人:

#include<bits/stdc++.h>
using namespace std;

int main(){
    freopen("galaxy.in","r",stdin);
    freopen("galaxy.out","w",stdout);
    while(1){
        cout<<"Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<endl;
    } 
    return 0;
}

一位选手在其代码最后提到:

虽然这次可能会爆0 , 但你只要坚持你的梦想 , 总会成功的 !2023 NOIP 见 ! ---- 2022.10.29 18:09 CSP-S

在这句话前面有 941 个空格,然而并没有注释,所以很可惜,至少你这个题要爆 0 了。(功德 -1)。

打表人/样例人/Yes,No 人

抓到一位 T3T4 均打表的同学。

此外这位同学在他所有题目代码的下面都写上了 AKIOI!。

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int ZN=1e9,FN=-1e9;
int main(){
    freopen("galaxy.in","r",stdin);
    freopen("galaxy.out","w",stdout);
    cout<<"No"<<'\n';
    cout<<"No"<<'\n';
    cout<<"YES"<<'\n';
    cout<<"No"<<'\n';
    cout<<"YES"<<'\n';
    cout<<"No"<<'\n';
    cout<<"No"<<'\n';
    cout<<"No"<<'\n';
    cout<<"YES"<<'\n';
    cout<<"No"<<'\n';
    cout<<"No"<<'\n';
}

这位同学,我知道你要输出样例了,但是为什么你的 NO 是小写 o?

int main()
{
    freopen("galaxy.in","r",stdin);
    freopen("galaxy.out","w",stdout);
    int n,m,x,y;
    cin>>n>>m;
    for(int i=1;i<=n;i++) cin>>x>>y;
    for(int i=1;i<=m;i++) cout<<"No"<<endl;
    return 0;
}

输出 m 个 NO,但是不管数据里有没有输出 m 个 NO 你可能都过不了一个点了,节哀。

        if(!f1) puts("Yes");
        else puts("No");

诸如此类大小写搞反的人还有一些。我们为他们默哀。

AK 人

    if (op == 1) {
      ......// 省略很长的代码
    } else if (op == 2) {
        ......// 省略很长的代码
    } else if (op == 3) {
        ......// 省略很长的代码
    } else if (op == 4) {
        ......// 省略很长的代码
    } else {
      cout << "OH! IAKIOI!!!\n";
      return 0;
    }

然而这次您确实 OH 不起来了(指 op 不可能为其它数)。

此外,此人的注释打一个字加一个标点:

// 不满足“只. 有. 一. 个. 从. 该. 据. 点. 出. 发. 的. 虫. 洞. 可. 用”。 

不禁让我想起某扑棱蛾子一个字一个感叹号的梦语。

    #ifndef IAKCSP
    freopen("galaxy.in","r",stdin);
    freopen("galaxy.out","w",stdout);
    #endif

好奇这位同学测小样例打算手输的时候,编译选项里开了个 -DIAKCSP 的感受。

/*
我是YZYL_LiWenX!

我宣布个事:IAKIOI!!!
*/

怀疑有人使用了邪恶的三山海技术把你 jc 了。(雾

篡改 using namespace std 人

#define sto using
#define zdc namespace
#define orz std;
sto zdc orz

千年老膜人法永流传。

#define Chtholly using
#define Nota namespace
#define Seniorious std;
Chtholly Nota Seniorious

嗯。

#define Nephren using
#define Ruq namespace
#define Insania std;
Nephren Ruq Insania

和上面那位是同一个人。

游寄人

你先别急,文件等会再开

// ... 前面省略很多东西
int f(int w)
{
    freopen("holiday.in","r",stdin);
    freopen("holiday.out",'w',stdout);
    for(int i=1;i<=n;i++)
    {
        if(o==4)
        {
            return 0;
        }
        if(q[i].a==w)
        {
            o++;
            int ss=s[q[i].a];
            i=found(i,ss);
            ans+=ss;
            f(i);
        }
    }
}

int main()
{
    cin>>n>>m>>k;
    s[1]=0;
    for(int i=2;i<=n;i++)
    {
        cin>>s[i];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>q[i].a>>q[i].b;
    }
    for(int i=1;i<=m;i++)
    {
        if(q[i].a==1)
        {
            ans=0;
            o=0;
            f(1);
            if(ans>maxn)
            {
                maxn=ans;
            }
        }
    }
    cout<<maxn<<endl;
}

此外,你的 freopen 里的 w 为什么是 'w' 而不是 "w"?

此外,这位选手的文件结构长这样:

节哀。

黑子人

kkk + cz 人

if(kkk+cz>k)ans++;

windows.h 人

你确实上了,而且不是因为 114514 上的,而是因为 CE 了。祝贺的同时请节哀。