Thursday, 31 December 2015

UVa 253 - Cube painting

//\\__ hr1212 __//\\

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef map<int,int> mi;

#define si(a) scanf("%d",&a)
#define sii(a,b) scanf("%d %d",&a,&b)
#define siii(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define pi(a) printf("%d\n",a)
#define nl printf("\n");
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define f(i,a,b) for(i=a;i<b;i++)
#define rf(i,a,b) for(i=a;i>=b;i--)
#define clr(x,a) memset(x,a,sizeof(x))
#define MAX 1000100
#define MOD 1000000007

int n,m;

int a[24][6] = {
  {1,2,3,4,5,6},
  {1,4,2,5,3,6},
  {1,5,4,3,2,6},
  {1,3,5,2,4,6},

  {2,3,1,6,4,5},
  {2,6,3,4,1,5},
  {2,4,6,1,3,5},
  {2,1,4,3,6,5},

  {3,1,2,5,6,4},
  {3,2,6,1,5,4},
  {3,6,5,2,1,4},
  {3,5,1,6,2,4},

  {4,5,6,1,2,3},
  {4,1,5,2,6,3},
  {4,2,1,6,5,3},
  {4,6,2,5,1,3},

  {5,6,4,3,1,2},
  {5,3,6,1,4,2},
  {5,1,3,4,6,2},
  {5,4,1,6,3,2},

  {6,5,3,4,2,1},
  {6,4,5,2,3,1},
  {6,2,4,3,5,1},
  {6,3,2,5,4,1}
};
int main(){
    int r,k,i,c=0,x=0,y=0,j,t,l,z,x1=0,y1=0;
    ll ans=0;string p,s1,s2;


    while(getline(cin,p)){
        s1=p.substr(0,6);
        s2=p.substr(6,6);
        z=0;
        f(i,0,24){
            c=0;
            string l;
            f(j,0,6){
                x=a[i][j]-1;
                l+=s1[x];
            }
            if(l==s2){
                z=1;
                break;
            }
        }
        if(z)
            cout<<"TRUE";
        else
            cout<<"FALSE";
        nl;
    }

    return 0;
}

No comments:

Post a Comment