#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,n) for (long long i=0;i #define vvl vector> #define inf 4000000000000000000 #define mod 998244353 //#define mod 1000000007 //関数 bool isSqrt(ll); ll power(ll,ll); vector makePrime(ll); ll power_mod(ll,ll); ll ncr(ll,ll); string cnvString(const string &str, int mode); //乱数、ファイル入出力 random_device rnd;// 非決定的な乱数生成器 mt19937 mt(rnd());// メルセンヌ・ツイスタの32ビット版、引数は初期シード ifstream fin("./DefaultFile"); ofstream fout("./DefaultFile");//出力する場合の出力先を指定 //メイン int main(){ int t; cin>>t; vl xs(t); vl ys(t); vl as(t); vl bs(t); vector ds(t); vector es(t); rep(z,t){ cin>>xs[z]>>ys[z]>>ds[z]>>as[z]>>bs[z]>>es[z]; } rep(z,t){ ll x,y,a,b,d,e; x=xs[z]; y=ys[z]; a=as[z]; b=bs[z]; if(ds[z]=="R")d=0; if(ds[z]=="U")d=1; if(ds[z]=="L")d=2; if(ds[z]=="D")d=3; if(es[z]=="R")e=0; if(es[z]=="U")e=1; if(es[z]=="L")e=2; if(es[z]=="D")e=3; x-=a; y-=b; while(1){ if(e%4==0){ d%=4; break; } ll tmp=-y; y=x; x=tmp; d++; e++; } if(d==0){ cout<<"No"<=0)cout<<"Yes"<=0&&y==0)cout<<"Yes"<=0)cout<<"Yes"<(sqrt(n)); return sqrtN * sqrtN == n; } //整数同士の累乗の計算をする。 ll power(ll A, ll B) { ll result = 1; for (ll i=0;i makePrime(ll n){ vector factors; while (n % 2 == 0) { factors.push_back(2); n /= 2; } for (ll i=3; i*i<=n;i+=2) { while (n%i == 0) { factors.push_back(i); n /= i; } } if (n > 2) { factors.push_back(n); } return factors; } // nのk乗をmodで割った余りを計算 ll power_mod(ll n, ll k) { long long result = 1; while (k > 0){ if ((k&1) ==1)result=(result*n)%mod; n=n*n%mod; k >>= 1; } return result; } //場合の数 nCr を求める ll ncr(ll n,ll r) { vvl dp(n+1,vl(r+1)); rep (i,n+1)dp[i][0] = 1; rep (i,r+1)dp[i][i] = 1; loop (i,1,n){ loop (j,1,min((ll)i-1,r)) { //nCr= n-1Cr-1 + n-1Cr dp[i][j] = dp[i-1][j-1] + dp[i-1][j]; } } return dp[n][r]; } //受け取った文字列を、第2引数が0なら全て小文字に、1なら大文字に変換する関数 string cnvString(const string &str, int mode) { string result = str; if (mode == 0) { // 小文字に変換 for (char &c : result) { c = tolower(c); } } else if (mode == 1) { // 大文字に変換 for (char &c : result) { c = toupper(c); } } return result; }