結果

問題 No.1944 ∞
ユーザー tnakao0123
提出日時 2022-05-20 23:21:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 39,424 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 00:28:26
合計ジャッジ時間 1,363 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |   scanf("%d%d%d", &n, &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
main.cpp:32:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |   for (int i = 0; i < n; i++) scanf("%d", rs + i), rsum += rs[i];
      |                               ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1944.cc:  No.1944 ∞ - yukicoder
 */

#include<cstdio>
#include<algorithm>

using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef long long ll;

/* global variables */

int rs[MAX_N];

/* subroutines */

/* main */

int main() {
  int n, x, y;
  scanf("%d%d%d", &n, &x, &y);

  ll rsum = 0;
  for (int i = 0; i < n; i++) scanf("%d", rs + i), rsum += rs[i];
  int minr = *min_element(rs, rs + n);

  ll dd = (ll)x * x + (ll)y * y;

  if (n == 1) {
    if ((ll)rs[0] * rs[0] == dd) puts("Yes");
    else puts("No");
  }
  else {
    ll r = 2 * rsum - minr;
    if (r >= 2000000000 || r * r >= dd) puts("Yes");
    else puts("No");
  }

  return 0;
}
0