CSP2021 J自测有感

· · 个人记录

title1:T1\longrightarrow我真的对了吗?

T1$确实是个数学水题,但$\dots\dots

我真的是对的吗 (疑惑ing)。
根据良心人士的正解,我发现,我好蒻啊
别人的代码:

#include<bits/stdc++.h>
using namespace std;
int n,l,r;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>l>>r;
   if(r/n==l/n) cout<<r%n;
   else cout<<n-1<<endl;
   return 0;
}

真好,orz。
我的代码:

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,l,r,J,maxR;
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>l>>r;
    J=(l-1)/n*n+n;
    if(J<=r) {
        if(r-J>=n-1) {
            cout<<n-1;
            return 0;
        }
        else maxR=r-J;
        if(J-l>=1) {
            cout<<n-1;
            return 0;
        }
        else {
            cout<<maxR;
            return 0;
        }
    }
    else cout<<r%n;
    return 0;
} 

都是O(1)我咋写的那么长?
后来才发现我喜欢把事情搞复杂了。反正A了不知道CCF的数据我能A吗?

title2:T2\longrightarrow两个晚上才A!!!

有趣的是我打了好几个代码,心态炸裂。 ## $\bullet$代码$1

一开始直接吓死,以为是Spaly,打了半天,结果样例都过不了。

\bullet代码2

脑子抽筋,想利用洛谷的民间弱弱数据A掉,打了个暴力,结果80。

\bullet代码3

再挑战平衡树,不过用pbds,结果和第一次一样,样例都不过。

\bullet代码4

原本是想放弃不过,仔细想了想,想到了1操作O(n),2操作O(1)的绝妙方法算法。然后就开心的A了!!

四次代码终于让我体会到了OI的险恶。

title3:T3\longrightarrow配吗?

第三题题目老长了,感觉好难的样子,但\dots\dots
中等模拟题!!!这作为T3有点不够资格诶。
只不过,不知道CCF的数据我能A吗?反正洛谷上A了。
我的蒻蒻代码:

#include<bits/stdc++.h>
#define r register
using namespace std;
int n;
string s,IP;
map<string ,int>Map;
bool check(string str) {
    int f1=0,f2=0;
    for(int i=0;i<str.size();i++) {
        if(str[i]=='.') f1++;
        else if(str[i]==':'&&f1!=3) return false;
        else if(str[i]==':') f2++;
    }
    if(f1!=3||f2!=1) return false;
    int cnt=0,f3=0,x=0;
    for(int i=0;i<str.size();i++)
        if(isdigit(str[i])) {
            if(f3!=1) {
                f3=1;
                cnt++;
                if(isdigit(str[i+1])&&str[i]=='0') return false;
            }
            x=x*10+str[i]-'0';
        }
        else {
            f3=0;
            if(x>255) return false;
            x=0;
        }
    if(cnt!=5) return false;
    if(x>65535) return false;
    return true;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(r int i=1;i<=n;i++) {
        cin>>s>>IP;
        if(s=="Server")
            if(!check(IP)) cout<<"ERR"<<endl;
            else
                if(!Map[IP]) {
                    Map[IP]=i;
                    cout<<"OK"<<endl;
                }
                else cout<<"FAIL"<<endl;
        else 
            if(!check(IP)) cout<<"ERR"<<endl;
            else 
                if(Map[IP]) cout<<Map[IP]<<endl;
                else cout<<"FAIL"<<endl; 
    }
    return 0;
} 

错了就尴尬了。呵呵!!

title4:T4\longrightarrow真or假·模拟题?

和$T2$一样写了好几次代码。 ## $\bullet$代码$1

第一眼,额,水,队列直接上。然后就70了。

\bullet代码2

想了一想,好像是并查集诶,抓紧干,结果\dots\dots
样例都没过,可恶的OI。

\bullet代码3,4,5

由于心态问题,开始了很多变态思路,我又想打Splay了,打了个正常的,样例没过。pbds版的,还是没过。后来出现了各种各样的数据结构,全错。

\bullet代码6

已经没有心态了,觉得已经挺好了,但睡觉的时候灵机一动,双向链表好像也可以。第二天起来准备try one try。结果\dots\dots

# $title5$:总结$\longrightarrow$真的水? 相信谁都认为这次简单,但$\dots\dots

现场考呢?OI的难熬和第一次比赛的紧张感,无不压迫着每一位OIER。
实话来讲,这次的难度不是太难,但还是有一定的思维系数。那最后评一个等级吧!!

满分: \star \star \star \star \star

算法难度:\star \star

坑人级别:\star

语文水平:\star \star \star \star \star

思维含金量:\star \star \star

个人总评:\star \star \star \star

终于写完了。

THE END