跳到正文

个人记录

2026.5.1 Happy Labor Day mock competition

miller2014约 11 分钟
原文

这是 2026年5月1日 存档的第 1 版,不是当前版本。查看当前版本

文章信息与版本

文章信息

发布
2026年5月1日
收录
2026年5月1日
更新
2026年11月17日
篇幅
约 11 分钟
获赞
1

版本

  1. v2当前
  2. v1

Score

Score

score estimation: 100+100+40+0=240100+100+40+0=240。
actual score: 100+60+40+0=200100+60+40+0=200。

Reason

  1. T2 does not write the correct binary solution.
  2. Although the classification discussion can pass, I am missing 66 class in categories (how many?

Competition Process

Not yet completed.

Process

8:00 start
8:00 T1 read
8:02 T1 think 1/2
8:03 T1 think 2/2
8:06 T1 write 1/1
8:08 T1 debug 1/3
8:08 T1 debug 2/3
8:09 T1 debug 3/3
8:10 T1 hand make debug 1/1
8:10 T2 read
8:12 T2 think 1/1
8:13 T3 read
8:17 T4 read
8:23 T2 write 1/3
8:25 T2 write 2/3
8:28 [say]
8:29 [hack]
8:39 [mistake] T2 think 0
8:45 T2 sub1&2 think 1/1
8:49 T2 sub1&2 write 1/?
8:54 T2 sub1&2 write 2/2
9:04 T2 sub1&2 debug 0/?
9:07 T2 sub1&2 debug 0/?
9:10 T2 sub1&2 debug 1/?
9:11 [break]
9:32 T1 debug 2/3
9:33 T1 debug 3/3
9:40 T2 write 3/?

Competition Way Of Thinking

T1

The answer is in [0,3][0,3].So if gcd⁡i=1nai=1\gcd\limits_{i=1}^{n}a_i=1 then the answer is 00.

Because gcd⁡(n,n−1)=1\gcd(n,n-1)=1 so the answer for all situations is ≤(n−n+1)+[n−(n−1)+1]=3\le (n-n+1)+[n-(n-1)+1]=3.

If gcd⁡(gcd⁡i=1nai,n)=1\gcd(\gcd\limits_{i=1}^{n}a_i,n)=1 then the answer is n−n+1=1n-n+1=1.If gcd⁡(gcd⁡i=1nai,n−1)=1\gcd(\gcd\limits_{i=1}^{n}a_i,n-1)=1 then the answer is n−(n−1)+1=2n-(n-1)+1=2.

If gcd⁡(gcd⁡i=1nai,n)≠1\gcd(\gcd\limits_{i=1}^{n}a_i,n) \ne 1 and gcd⁡(gcd⁡i=1nai,n−1)≠1\gcd(\gcd\limits_{i=1}^{n}a_i,n-1) \ne 1 then the answer is 33.

T2

Because n≤1500n \le 1500,so the time should not exceed O(n2)O(n^2).

Frist,find the longest horizontal chain,second longest horizontal chain,longest vertical chain,second longest vertical chain.Then,let classification discussion:

  1. The second longest horizontal chain is possible answers.And the second longest vertical chain is possible answers.
  2. The half of longest horizontal chain is possible answers.And the half of longest vertical chain is possible answers.
  3. If the longest horizontal chain and the longest vertical chain non intersecting,then the minimum value of the longest horizontal chain and the longest vertical chain is possible answers.

Output all the possible answers max.

T3

It is so hard.I can not AC.But I can do sub 1 and sub 2.

Because n≤5000n \le 5000,so the time should not exceed O(n2)O(n^2).

Frist,calculate aa.
Then,Let maxxi,jmaxx_{i,j} represent max⁡k=ijak\max\limits_{k=i}^{j}a_k.Find maxxi,j=max⁡(maxxi,i,maxxi+1,j)maxx_{i,j}=\max(maxx_{i,i},maxx_{i+1,j}).Attention maxxi,i=aimaxx_{i,i}=a_i.
Then,calculate ansi=min⁡s=1s+i−1≤nmaxxs,s+i−1ans_i=\min\limits_{s=1}^{s+i-1 \le n}maxx_{s,s+i-1}.
Finally,calculate gg and output.

T4

It is so hard.I can not AC.So I won’t do it.

Code

T1

AC code
C++
#include<bits/stdc++.h>
using namespace std;
int n,a[100005],x;
int main()
{
    // freopen("unite.in","r",stdin);
    // freopen("unite.out","w",stdout);
    cin>>n>>x;
    for(int i=2;i<=n;i++)
    {
        cin>>a[i];
        x=__gcd(x,a[i]);
    }
    if(x==1)
    {
        cout<<0;
        return 0;
    }
    for(int i=n,j=1;i;i--,j++)
    {
        if(__gcd(x,i)==1)
        {
            cout<<j;
            return 0;
        }
    }
    // cout<<3;
    return 0;
}

T2

AC code
C++
#include<bits/stdc++.h>
using namespace std;
int n,sum;
char s,c[1505][1505];
struct node
{
    int x,y,s;
};
vector<node>ex,ey;
bool cmp(node rrr,node rrrr)
{
    return rrr.s>rrrr.s;
}
int main()
{
    // freopen("color.in","r",stdin);
    // freopen("color.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)cin>>c[i][j];
        c[0][i]=c[i][0]=c[n+1][i]=c[i][n+1]='X';
    }
    c[0][0]=c[0][n+1]=c[n+1][0]=c[n+1][n+1]='X';
    //--------------------
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n+1;j++)
        {
            if(c[i][j]=='X')
            {
                if(sum)
                ex.push_back({i,j-1,sum}),sum=0;
            }
            else sum++;
        }
    }
    sum=0;
    //||||||||||||||||||||
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n+1;j++)
        {
            if(c[j][i]=='X')
            {
                if(sum)
                ey.push_back({j-1,i,sum}),sum=0;
            }
            else sum++;
        }
    }
    if(!ex.size())return (cout<<0)&&0;
    sort(ex.begin(),ex.end(),cmp),sort(ey.begin(),ey.end(),cmp);
    int i=ex[0].x,j=ex[0].y-ex[0].s+1,k=ey[0].x-ey[0].s+1,l=ey[0].y,o=ex[0].y,p=ey[0].x;
    //cout<<ex[1].s<<" "<<ey[1].s<<" "<<ex[0].s<<" "<<ey[0].s<<"\n";
    cout<<max(
        max(max(ex.size()>1?max(ex[1].s,ex[0].s/2):ex[0].s/2,ey.size()>1?max(ey[1].s,ey[0].s/2):ey[0].s/2),(l>=j&&l<=o&&i>=k&&i<=p?-1:min(ex[0].s,ey[0].s))),
        l>=j&&l<=o&&i>=k&&i<=p?max(max(min(l-j,ey[0].s),min(o-l,ey[0].s)),max(min(i-k,ex[0].s),min(p-i,ex[0].s))):-1);
    return 0;
}

T3

Sub1 and sub2
C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,x,y,z,maxx[5005][5005],ans[5005],g[5005];
signed main()
{
    // freopen("value.in","r",stdin);
    // freopen("value.out","w",stdout);
    cin>>n>>x>>y>>z;
    for(int i=1;i<=n;i++)ans[i]=z;
    for(int i=1;i<=n;i++)maxx[i][i]=(maxx[i-1][i-1]*x+y)%z,ans[1]=min(ans[1],maxx[i][i]);
    for(int l=2;l<=n;l++)
        for(int start=1;start+l-1<=n;start++)
            maxx[start][start+l-1]=max(maxx[start][start],maxx[start+1][start+l-1]),ans[l]=min(ans[l],maxx[start][start+l-1]);
    for(int i=1;i<=n;i++)g[i]=(g[i-1]*x+ans[i]+y)%z;
    cout<<g[n];
    return 0;
}

T4

Nothing
C++
//I can not AC.