結果
問題 | No.2564 衝突予測 |
ユーザー |
|
提出日時 | 2023-12-02 16:42:05 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 333 ms / 2,000 ms |
コード長 | 3,270 bytes |
コンパイル時間 | 1,670 ms |
コンパイル使用メモリ | 145,728 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-09-26 20:37:31 |
合計ジャッジ時間 | 5,593 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:52:30: warning: 'e' may be used uninitialized [-Wmaybe-uninitialized] 52 | ll x,y,a,b,d,e; | ^ main.cpp:52:28: warning: 'd' may be used uninitialized [-Wmaybe-uninitialized] 52 | ll x,y,a,b,d,e; | ^
ソースコード
#include<iostream>#include<algorithm>#include<vector>#include<string>#include<map>#include<deque>#include<iomanip>#include<tuple>#include<cmath>#include<cctype>#include<fstream>#include<random>using namespace std;#define rep(i,n) for (long long i=0;i<n;i++)#define loop(i,m,n) for(long long i=m;i<=n;i++)#define range(value,range) for(const auto &value : range)#define ll long long#define vl vector<long long>#define vvl vector<vector<long long>>#define inf 4000000000000000000#define mod 998244353//#define mod 1000000007//関数bool isSqrt(ll);ll power(ll,ll);vector<ll> 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<string> ds(t);vector<string> 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"<<endl;}else if(d==1){if(x==-y&&x>=0)cout<<"Yes"<<endl;else cout<<"No"<<endl;}else if(d==2){if(x>=0&&y==0)cout<<"Yes"<<endl;else cout<<"No"<<endl;}else if(d==3){if(x==y&&x>=0)cout<<"Yes"<<endl;else cout<<"No"<<endl;}}return 0;}//√の値が整数かを調べるbool isSqrt(ll n) {if (n < 0) return false;ll sqrtN = static_cast<ll>(sqrt(n));return sqrtN * sqrtN == n;}//整数同士の累乗の計算をする。ll power(ll A, ll B) {ll result = 1;for (ll i=0;i<B;i++){result *= A;}return result;}//素因数分解vector<ll> makePrime(ll n){vector<ll> 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-1Crdp[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;}