procon

This documentation is automatically generated by online-judge-tools/verification-helper

View the Project on GitHub mugen1337/procon

:heavy_check_mark: test/AOJ_ITP_Dice_III.test.cpp

Depends on

Code

#define PROBLEM "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_C"

#include "../template.hpp"

#include "../Other/Dice.hpp"

signed main(){
    Dice<int> A,B;
    cin>>A.u>>A.f>>A.r>>A.l>>A.b>>A.d;
    cin>>B.u>>B.f>>B.r>>B.l>>B.b>>B.d;
    cout<<(same_dice(A,B)?"Yes":"No")<<endl;
    return 0;
}
#line 1 "test/AOJ_ITP_Dice_III.test.cpp"
#define PROBLEM "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_11_C"

#line 1 "template.hpp"
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) begin(x),end(x)
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}
template<typename T>
istream &operator>>(istream &is,vector<T>&v){
    for(T &x:v)is>>x;
    return is;
}

#line 4 "test/AOJ_ITP_Dice_III.test.cpp"

#line 1 "Other/Dice.hpp"
template<typename T>
struct Dice{
    //left, right, front, back, down, up
    T l,r,f,b,d,u;

    void RollF(){ // y-- (next, d <- f)
        int tmp=d; d=f; f=u; u=b; b=tmp;
    }

    void RollB(){ // y++ (next, d <- b)
        int tmp=d; d=b; b=u; u=f; f=tmp;
    }

    void RollL(){ // x-- (next, d <- l)
        int tmp=d; d=l; l=u; u=r; r=tmp;
    }

    void RollR(){ // x++ (next, d <- r)
        int tmp=d; d=r; r=u; u=l; l=tmp;
    }
};

template<typename T>
bool same_dice_same_state(Dice<T> a,Dice<T> b){
    return (a.b==b.b and a.f==b.f and a.l==b.l and a.r==b.r and a.u==b.u and a.d==b.d);
}

template<typename T>
bool same_dice(Dice<T> a,Dice<T> b){
    for(int i=0;i<4;i++){
        a.RollL();
        for(int j=0;j<4;j++){
            a.RollB();
            for(int k=0;k<4;k++){
                a.RollL();
                if(same_dice_same_state(a,b)) return true;
            }
        }
    }
    return false;
}
#line 6 "test/AOJ_ITP_Dice_III.test.cpp"

signed main(){
    Dice<int> A,B;
    cin>>A.u>>A.f>>A.r>>A.l>>A.b>>A.d;
    cin>>B.u>>B.f>>B.r>>B.l>>B.b>>B.d;
    cout<<(same_dice(A,B)?"Yes":"No")<<endl;
    return 0;
}
Back to top page