#include<bits/stdc++.h>
using namespace std;
int n,now[50],la[50],cnt;string pan="0ABC";
void move(int x,int y)
{
    if(now[x]==y)return;
    for(int i=x-1;i>=1;i--)
        move(i,6-(now[x]+y));
    printf("move %d from %c to %c\n",x,pan[now[x]],pan[y]);
    now[x]=y,cnt++;
}
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //ios::sync_with_stdio(false);
    /*
只能用freopen看出来
加了ios::sync_with_stdio(false);
ans:
7
move 1 from A to B
move 2 from A to C
move 1 from B to C
move 3 from A to B
move 1 from C to B
move 2 from C to A
move 1 from B to C
不加
ans:
move 1 from A to B
move 2 from A to C
move 1 from B to C
move 3 from A to B
move 1 from C to B
move 2 from C to A
move 1 from B to C
7
????
*/
    cin>>n;
    for(int i=1;i<=3;i++)
    {
        int p;cin>>p;
        for(int j=1;j<=p;j++)
        {
            int a;cin>>a;
            now[a]=i;
        }
    }
    for(int i=1;i<=3;i++)
    {
        int p;cin>>p;
        for(int j=1;j<=p;j++)
        {
            int a;cin>>a;
            la[a]=i;
        }
    }
    for(int i=n;i>=1;i--)
        move(i,la[i]);
    cout<<cnt<<endl;
    return 0;
}

1 条评论

  • 1

信息

ID
1548
难度
6
分类
(无)
标签
递交数
26
已通过
10
通过率
38%
被复制
2
上传者