I - Dice

There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a 1.a 2,a 3,a 4,a 5,a 6 to be numbers written on top face, bottom face, left face, right face, front face and back face of dice A. Similarly, consider b 1.b 2,b 3,b 4,b 5,b 6 to be numbers on specific faces of dice B. It’s guaranteed that all numbers written on dices are integers no smaller than 1 and no more than 6 while a i ≠ a j and b i ≠ b j for all i ≠ j. Specially, sum of numbers on opposite faces may not be 7. 

At the beginning, the two dices may face different(which means there exist some i, ai ≠ b i). Ddy wants to make the two dices look the same from all directions(which means for all i, a i = b i) only by the following four rotation operations.(Please read the picture for more information) 


Now Ddy wants to calculate the minimal steps that he has to take to achieve his goal. 
Input
There are multiple test cases. Please process till EOF. 

For each case, the first line consists of six integers a 1,a 2,a 3,a 4,a 5,a 6, representing the numbers on dice A. 

The second line consists of six integers b 1,b 2,b 3,b 4,b 5,b 6, representing the numbers on dice B.
Output
For each test case, print a line with a number representing the answer. If there’s no way to make two dices exactly the same, output -1.
Sample Input
1 2 3 4 5 6
1 2 3 4 5 6
1 2 3 4 5 6
1 2 5 6 4 3
1 2 3 4 5 6
1 4 2 5 3 6
Sample Output
0
3
-1
#include<stdio.h>
#include<string.h>
#include<queue>
using namespace std;
int aa[8],bb[8];
int book[7][7][7];
int flag;
struct note
{
    int a,b,c,d,e,f,s;
};
void bfs()
{
    queue<note>Q;
    note now,tmp;
    now.a=bb[0];
    now.b=bb[1];
    now.c=bb[2];
    now.d=bb[3];
    now.e=bb[4];
    now.f=bb[5];
    now.s=0;
    book[bb[0]][bb[2]][bb[4]]=1;
    Q.push(now);
    while(!Q.empty())
    {

        now=Q.front();
        Q.pop();
        if(now.a==aa[0]&&now.b==aa[1]&&now.c==aa[2]&&now.d==aa[3]&&now.e==aa[4]&&now.f==aa[5])
        {
            flag=1;
            printf("%d\n",now.s);
            break;
        }
        for(int i=0; i<4; i++)
        {
            if(i==0)
            {
                tmp.a=now.d;
                tmp.b=now.c;
                tmp.c=now.a;
                tmp.d=now.b;
                tmp.e=now.e;
                tmp.f=now.f;
            }
            if(i==1)
            {
                tmp.a=now.c;
                tmp.b=now.d;
                tmp.c=now.b;
                tmp.d=now.a;
                tmp.e=now.e;
                tmp.f=now.f;
            }
            if(i==2)
            {
                tmp.a=now.f;
                tmp.b=now.e;
                tmp.c=now.c;
                tmp.d=now.d;
                tmp.e=now.a;
                tmp.f=now.b;
            }
            if(i==3)
            {
                tmp.a=now.e;
                tmp.b=now.f;
                tmp.c=now.c;
                tmp.d=now.d;
                tmp.e=now.b;
                tmp.f=now.a;
            }
            if(book[tmp.a][tmp.c][tmp.e]==0)
            {

                book[tmp.a][tmp.c][tmp.e]=1;
                tmp.s=now.s+1;
                Q.push(tmp);
            }

        }
    }

}
int main()
{
    while(~scanf("%d",&aa[0]))
    {
        flag=0;
        int i,j;
        memset(book,0,sizeof(book));
        for(i=1; i<6; i++)
            scanf("%d",&aa[i]);
        for(j=0; j<6; j++)
            scanf("%d",&bb[j]);

        bfs();
        if(flag==0)printf("-1\n");
    }
    return 0;
}

Security-feature-detection-system 安全检测系统 简介 安全检测系统-多目标识别(YOLOv5)和人脸识别(Facenet)快速部署系统。 功能上:本项目使用YOLOv5实现多目标识别,使用Facenet实现人脸识别,最终需要人脸和此人应具备的多目标同时满足才能通过安全检测,部署上:使用pyqt5实现前端可视化,在前端页面运行YOLOv5多目标识别系统(将模型运行封装到Qt中),使用Docker封装人脸识别后端系统,使用网络请求等包实现前后端交互 案例:进行多目标识别的同时,进行人脸识别,前端系统发送请求,携带参数到后端进行人脸识别,最终返回人脸识别结果,获取人脸识别结果后,检索该成员应具备的多目标特征,与YOLOv5多目标识别的实际结果进行比对,若无误则通过安全检测。 根据原作 https://pan.quark.cn/s/9784cdf4abfd 的源码改编 项目背景 出于一些比赛的需要,以及逃离懵懂状态开始探索,我于2023.12~2024.1(大二上)开始一些CV、LLM项目的研究,苦于能力有限,当时大部分的项目都是依托开源搭建而来,诸如本项目就是依托开源的Compreface和Yolov5搭建,我只不过做了缝合的工作,所以在此必须提及这两个项目的巨大贡献:https://.com/exadel-inc/CompreFace https://.com/ultralytics/yolov5 今天是2024.7.11(大二下暑假),时隔半年我才开始这个项目的开源工作是因为,半年前的水平有限,虽然自己能实现项目的运作,但是恐很多细节介绍不好,当然本文自发出,后续我还会跟进,欢迎指正:22012100039@stu.xidian.edu.c...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值