結果

問題 No.983 Convolution
ユーザー risujiroh
提出日時 2020-02-11 13:38:55
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 23 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 166,472 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-01 07:22:32
合計ジャッジ時間 2,875 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long res = 0;
  while (n--) {
    long long a;
    cin >> a;
    if (a != -1) {
      res = __gcd(res, a * a);
    }
  }
  if (res == 0) {
    res = -1;
  }
  cout << res << '\n';
}
0