求助!本地样例全过,但是自测爆零。
查看原帖
求助!本地样例全过,但是自测爆零。
235839
ST_AS_IS_ZHY楼主2023/10/22 08:54
/*
good luck and fast mind.

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

#define int long long

const int N=1e2+5;

/*
memory and time!!

baoli code is useful.

debug code del!!
don't worry.the future is unexpected and lucky.
*/

int c,n,x,y,a[N][N],t[N],ans,res,tmp;
// vector<int> e[N];
int dif[3],dfid[3];

void dfs(int id){
    if(id==6){
        for(int k=1;k<=n;k++){
            int dfc=0;
            for(int i=1;i<=5;i++){
                if(a[k][i]==t[i])continue;
                dif[++dfc]=a[k][i]-t[i];
                dfid[dfc]=i;
            }
            if(dfc==1||dfc==2){
                if(dfc==2){
                    if(dfid[1]!=dfid[2]-1)return ;
                    if((dif[1]+10)%10!=(dif[2]+10)%10)return ;
                }
            }else return ;
        }
        ans++;
        return ;
    }
    for(int i=0;i<10;i++){
        t[id]=i;
        dfs(id+1);
    }
}
signed main(){
    freopen("lock.in","r",stdin);
    freopen("lock.out","w",stdout);
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=5;j++){
            scanf("%lld",&a[i][j]);
        }
    }


    dfs(1);

    printf("%lld\n",ans);

    return 0;
}

2023/10/22 08:54
加载中...