NOIP 2025 游记——人生如梦

· · 生活·游记

往期回顾。

相较于上次参加 CSP。NOIP 时就怀有一颗大大的平常心了。不论吃饭、住宿还是睡觉,已然没有了往昔紧张的焦躁与不安。适度的放松、愉悦地刷视屏、慵懒地睡觉与起床,一切的轻松平常仿佛都是一个梦,一个关于 [email protected]:dream 的梦······

来到考场,登记姓名,解压那天的 day1.pdf,花了大约 20 分钟浏览了前 2 道题目,便迫不及待地开始编写 T1 的代码。好像是个贪心,但思路尚不明晰,竟然写了 3 个多小时,打遍了所有的 AB 特殊性质,穷尽了 4if else 的神力。接着开 T2,40 分钟写完了一个骗分代码,虽然最后也是 1 分也没骗上。

::::info[candy 屎山代码]

考场实测,共计 2516 B 的大小,蒟蒻实力不强,求大家看过之后轻点喷。

#include <bits/stdc++.h>
using namespace std;
pair<unsigned int,unsigned int> min_pos;
unsigned int n,a[100010][3],sum[100010],pos;
unsigned long long m,cnt=0;
bool f1=true,f2=true,f3[100010][3];
unsigned long long my_gcd(unsigned long long a,unsigned long long b)
{
    if(b==0) return a;
    return my_gcd(b,a%b);
}
unsigned int res1,res2;
pair<unsigned int,unsigned int> my_min()
{
    unsigned int w=4200000001;
    for(unsigned int i=1;i<=n;++i)
    {
        if(a[i][1]<=w&&f3[i][1]==true&&i!=pos)
        {
            w=a[i][1];
            res1=i;
            res2=1;
        }
        if(a[i][2]<=w&&f3[i][2]==true&&i!=pos)
        {
            w=a[i][2];
            res1=i;
            res2=2;
        }
    }
    if(res2==1)
    {
        f3[res1][1]=false;
        f3[res1][2]=true;
    }
    else
    {
        f3[res1][2]=false;
        f3[res1][1]=true;
    }
    pair<int,int> n;
    n.first=res1;
    n.second=res2;
    return n;
}
int main()
{
    freopen("candy.in","r",stdin);
    freopen("candy.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>m;

    if(n==1)
    {
        unsigned int x,y;
        cin>>x>>y;
        for(unsigned int i=1;m>=0;++i)
        {
            if(i%2==1)
            {
                if(m>=x)
                {
                    m-=x;
                    ++cnt;
                }
                else break;
            }
            else
            {
                if(m>=y)
                {
                    m-=y;
                    ++cnt;
                }
                else break;
            }
        }
        cout<<cnt;
        return 0;
    }

    for(unsigned int i=1;i<=n;++i)
    {
        cin>>a[i][1]>>a[i][2];
        sum[i]=a[i][1]+a[i][2];
        if(a[i][1]!=a[i][2]) f1=false;
        if(a[i][1]<a[i][2]) f2=false;
    }

//  a[0][1]=4200000001;
//  a[0][2]=4200000001;
    sum[0]=4200000001;
    for(unsigned int i=1;i<=n;++i)
    {
        if(sum[i]<sum[pos]) pos=i; 
    }

    if(f1==true)
    {
        cout<<m/(sum[pos]/2);
        return 0;
    }

    for(unsigned int i=1;i<=n;++i)
    {
        f3[i][1]=true;
        f3[i][2]=false;
    }
    if(f2)
    {
        for(unsigned int i=1;;i==1?(i=2):(i=1))
        {
            if(m>=a[pos][i])
            {
                m-=a[pos][i];
                ++cnt;
            }
            else break;
        }
        min_pos=my_min();
        while(m>=a[min_pos.first][min_pos.second])
        {
            m-=a[min_pos.first][min_pos.second];
            ++cnt;
            min_pos=my_min();
        }
        cout<<cnt;
        return 0;
    }

    if(my_gcd((unsigned long long)m,(unsigned long long)sum[pos])==(unsigned long long)sum[pos])
    {
        cnt=m/sum[pos];
        cout<<cnt*2;
        return 0;
    }

    while(my_gcd((unsigned long long)m,(unsigned long long)sum[pos])!=(unsigned long long)sum[pos])
    {
        min_pos=my_min();
        m-=a[min_pos.first][min_pos.second];
        ++cnt;
    }
    unsigned long long cnt2=(m/sum[pos])*2;
    cout<<cnt+cnt2;
    return 0;
} 

::::

最终 candy 一题因为计算顺序失误,挂分 15 pts,最终得了 55 分。可我又常常追忆过去,如果那年的自己没有大脑突然短路,被 CCF 的题面所迷惑,T1 就能打出 70 的“高分”,不至于终身抱憾而归了···

::::info[sale 骗分代码]

急急忙忙写了 40 分钟,还能叫我怎样呢?不是 TLE 就是 RE···一瞬间,我竟无语凝噎······

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

unsigned int c,t,n,m,a[5010];
unsigned __int128 cnt;

inline unsigned __int128 jiecheng(unsigned int a)
{
    unsigned __int128 res=1;
    for(unsigned int i=2;i<=a;++i)
        res*=i;
    return res;
}

inline unsigned __int128 C(unsigned int m,unsigned int n)
{
    return (jiecheng(n))/(jiecheng(m)*jiecheng(n-m));
}

inline unsigned int my_min(unsigned int m,unsigned int n)
{
    if(m<=n) return m;
    return n;
}

char s[45];
void write(unsigned __int128 a)
{
    int i=0;
    while(a)
    {
        s[i]=a%10+('0'-0);
        a/=10;
        ++i;
    }
    for(int j=i-1;j>=0;--j)
        cout<<s[j];
}
int main()
{
    freopen("sale.in","r",stdin);
    freopen("sale.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>c>>t;
    while(t--)
    {
        cin>>n>>m;
        for(unsigned int i=1;i<=n;++i)
        {
            cin>>a[i];
        }

        if(c==18)
        {
            if(m==n)
                cout<<1<<"\n";
            else if(n>m)
            {
                for(unsigned int i=0;i<=n-m;++i)
                {
                    cnt+=C(i,n-m);
                    cnt%=998244353;
                }
                write(cnt);
                cout<<"\n";
            }
            else
            {
                unsigned int x=my_min(n,m-n);
                for(unsigned int i=0;i<=x;++i)
                {
                    cnt+=C(i,n);
                    cnt%=998244353;
                }
                write(cnt);
                cout<<"\n";
            }
        }

        else
        {
            for(unsigned int i=0;i<=n-m;++i)
            {
                cnt+=C(i,n-m);
                cnt%=998244353;
            }
            write(cnt);
            cout<<"\n";
        }

        cnt=0;

    }

    return 0;
}

::::

纪念我失去的青春,纪念我第一场也是最后一场 NOIP···

:::align{center}

\Large\displaystyle \int_{-\infty}^{+\infty} \normalsize{\text{the\ end\ of\ NOIP2025\ and\ my\ OI\ career}}.

:::