結果
問題 | No.1218 Something Like a Theorem |
ユーザー |
![]() |
提出日時 | 2020-09-04 22:19:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 389 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 1,949 ms |
コンパイル使用メモリ | 199,716 KB |
最終ジャッジ日時 | 2025-01-14 05:55:20 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#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;int A[1010];int main(){int n,z;cin>>n>>z;for(int i=1;i<=1000;i++){A[i]=i*i;}map<int,int> m;for(int i=1;i<=1000;i++){for(int j=1;j<=1000;j++){m[A[i]+A[j]]++;}}if(n>=3) cout<<"No"<<endl;else if(n==1){if(z>=2) cout<<"Yes"<<endl;else cout<<"No"<<endl;}else{if(m[z*z]>0) cout<<"Yes"<<endl;else cout<<"No"<<endl;}return 0;}