結果

問題 No.2564 衝突予測
ユーザー NATTONATTO
提出日時 2023-12-02 16:01:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 4,118 bytes
コンパイル時間 5,624 ms
コンパイル使用メモリ 316,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-26 19:42:41
合計ジャッジ時間 8,398 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 183 ms
5,376 KB
testcase_04 AC 185 ms
5,376 KB
testcase_05 AC 185 ms
5,376 KB
testcase_06 AC 197 ms
5,376 KB
testcase_07 AC 194 ms
5,376 KB
testcase_08 AC 189 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#pragma region header
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
// clang-format off
struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
inline void IN(void)
{
return;
}
template <typename First, typename... Rest>
void IN(First &first, Rest &...rest)
{
cin >> first;
IN(rest...);
return;
}
template <typename T>
istream &operator>>(istream &is, pair<T, T> &p)
{
is >> p.first >> p.second;
return is;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v)
{
for (auto &x : v)
is >> x;
return is;
}
template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
for (auto &x : v)
os << x << " ";
os << endl;
return os;
}
// templetes
//alias
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vs = vector<string>;
using pll = pair<ll, ll>;
//define short
#define vec vector
#define all(obs) (obs).begin(), (obs).end()
#define YESNO(cond) (cond) ? cout << "YES" << endl : cout << "NO" << endl;
#define YesNo(cond) (cond) ? cout << "Yes" << endl : cout << "No" << endl;
#define yesno(cond) (cond) ? cout << "yes" << endl : cout << "no" << endl;
#define sortv(obs) sort(all(obs))
#define rsortv(obs) reverse(sort(all(obs)))
#define bitu(n,i) (((n)>>(i))&1)
#define dig10(n) to_string(n).size()
#define bcnt(n) __builtin_popcount(n)
#define bcntll(n) __builtin_popcountll(n)
#define F first
#define S second
#define pb push_back
#define pq priority_queue
//define loop
#define rep(i, a,b) for(ll i = a; i < (b); i++)
#define rrep(i, a,b) for(ll i = a; i >= (b); i--)
//define INF
const ll INF = 1e18;
template <typename T1,typename T2>
inline void chmin(T1 &a,T2 b){
if(a>b) a = b;
}
template <typename T1,typename T2>
inline void chmax(T1 &a,T2 b){
if(a<b) a = b;
}
#pragma endregion header
// clang-format on
int main(){
ll T;
cin>>T;
map<char,ll> mp;
mp['R']=0;
mp['U']=1;
mp['L']=2;
mp['D']=3;
vll dx = {1,0,-1,0};
vll dy = {0,1,0,-1};
rep(i,0,T){
ll x1,y1;
ll x2,y2;
char d1,d2;
cin>>x1>>y1>>d1;
cin>>x2>>y2>>d2;
if(d1==d2){
cout<<"No"<<endl;
continue;
}
if(mp[d1]%2==mp[d2]%2){
if(d1=='R'||d1=='L'){
if(!(y1==y2)){
cout<<"No"<<endl;
continue;
}
//
ll nx1=x1+dx[mp[d1]],nx2=x2+dx[mp[d2]];
if(abs(x1-x2)>abs(nx1-nx2)){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}else{
if(!(x1==x2)){
cout<<"No"<<endl;
continue;
}
//
ll ny1=y1+dy[mp[d1]],ny2=y2+dy[mp[d2]];
if(abs(y1-y2)>=abs(ny1-ny2)){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
}
else{
//
ll tx,ty;
if(d1=='R'||d1=='L'){
tx=x2;
ty=y1;
ll dir1=d1=='R'?1:-1;
ll dir2=d2=='U'?1:-1;
if((tx-x1)*dir1==(ty-y2)*dir2 && (tx-x1)*dir1>0 && (ty-y2)*dir2>0){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}else{
tx=x1;
ty=y2;
ll dir1=d1=='U'?1:-1;
ll dir2=d2=='R'?1:-1;
if((tx-x2)*dir2==(ty-y1)*dir1 && (tx-x2)*dir2>0 && (ty-y1)*dir1>0){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
}
}
}
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0