結果

問題 No.1218 Something Like a Theorem
ユーザー umezoumezo
提出日時 2020-09-04 22:19:42
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 445 ms / 2,000 ms
コード長 567 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 205,548 KB
実行使用メモリ 17,668 KB
最終ジャッジ日時 2023-08-17 16:48:16
合計ジャッジ時間 9,708 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 360 ms
17,376 KB
testcase_01 AC 349 ms
17,540 KB
testcase_02 AC 345 ms
17,388 KB
testcase_03 AC 350 ms
17,396 KB
testcase_04 AC 349 ms
17,448 KB
testcase_05 AC 358 ms
17,380 KB
testcase_06 AC 340 ms
17,392 KB
testcase_07 AC 348 ms
17,400 KB
testcase_08 AC 347 ms
17,436 KB
testcase_09 AC 346 ms
17,388 KB
testcase_10 AC 349 ms
17,668 KB
testcase_11 AC 355 ms
17,448 KB
testcase_12 AC 445 ms
17,384 KB
testcase_13 AC 418 ms
17,444 KB
testcase_14 AC 344 ms
17,404 KB
testcase_15 AC 351 ms
17,396 KB
testcase_16 AC 345 ms
17,504 KB
testcase_17 AC 346 ms
17,396 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