結果

問題 No.1218 Something Like a Theorem
ユーザー umezoumezo
提出日時 2020-09-04 22:19:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 2,313 ms
コンパイル使用メモリ 207,864 KB
実行使用メモリ 17,664 KB
最終ジャッジ日時 2024-05-04 23:27:40
合計ジャッジ時間 10,272 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 374 ms
17,536 KB
testcase_01 AC 363 ms
17,536 KB
testcase_02 AC 369 ms
17,536 KB
testcase_03 AC 372 ms
17,664 KB
testcase_04 AC 380 ms
17,536 KB
testcase_05 AC 376 ms
17,536 KB
testcase_06 AC 375 ms
17,536 KB
testcase_07 AC 370 ms
17,536 KB
testcase_08 AC 388 ms
17,536 KB
testcase_09 AC 380 ms
17,536 KB
testcase_10 AC 394 ms
17,536 KB
testcase_11 AC 405 ms
17,536 KB
testcase_12 AC 378 ms
17,408 KB
testcase_13 AC 390 ms
17,408 KB
testcase_14 AC 398 ms
17,536 KB
testcase_15 AC 391 ms
17,536 KB
testcase_16 AC 388 ms
17,536 KB
testcase_17 AC 382 ms
17,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0