結果
問題 |
No.1850 Rewrite Product
|
ユーザー |
![]() |
提出日時 | 2022-02-25 23:49:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 711 bytes |
コンパイル時間 | 2,414 ms |
コンパイル使用メモリ | 201,544 KB |
最終ジャッジ日時 | 2025-01-28 02:51:18 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 1 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; unordered_map<ll,bool> m; bool f(ll x,ll y){ if(x==y) return true; if(m.count(x)) return m[x]; bool b=false; for(ll i=x+1;i<=sqrt(x);i++){ if(i*(x-i)>y) continue; if(f(i*(x-i),y)){ b=true; break; } } if(b) return true; else return false; } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int t; cin>>t; while(t--){ ll x,y; cin>>x>>y; if(x>=y){ cout<<"Yes"<<endl; continue; } if(f(x,y)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }