結果

問題 No.983 Convolution
ユーザー risujirohrisujiroh
提出日時 2020-02-11 13:38:55
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 1,403 ms
使用メモリ 3,548 KB
最終ジャッジ日時 2022-11-24 17:21:54
合計ジャッジ時間 3,232 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,492 KB
testcase_01 AC 1 ms
3,388 KB
testcase_02 AC 2 ms
3,460 KB
testcase_03 AC 12 ms
3,448 KB
testcase_04 AC 12 ms
3,460 KB
testcase_05 AC 10 ms
3,488 KB
testcase_06 AC 15 ms
3,512 KB
testcase_07 AC 12 ms
3,512 KB
testcase_08 AC 3 ms
3,440 KB
testcase_09 AC 4 ms
3,492 KB
testcase_10 AC 2 ms
3,388 KB
testcase_11 AC 4 ms
3,396 KB
testcase_12 AC 13 ms
3,456 KB
testcase_13 AC 6 ms
3,396 KB
testcase_14 AC 7 ms
3,488 KB
testcase_15 AC 10 ms
3,396 KB
testcase_16 AC 7 ms
3,400 KB
testcase_17 AC 12 ms
3,544 KB
testcase_18 AC 3 ms
3,548 KB
testcase_19 AC 9 ms
3,460 KB
testcase_20 AC 14 ms
3,396 KB
testcase_21 AC 14 ms
3,500 KB
testcase_22 AC 4 ms
3,396 KB
testcase_23 AC 8 ms
3,392 KB
testcase_24 AC 2 ms
3,440 KB
testcase_25 AC 3 ms
3,396 KB
testcase_26 AC 6 ms
3,448 KB
testcase_27 AC 4 ms
3,440 KB
testcase_28 AC 11 ms
3,400 KB
testcase_29 AC 20 ms
3,496 KB
testcase_30 AC 11 ms
3,400 KB
testcase_31 AC 7 ms
3,400 KB
testcase_32 AC 12 ms
3,460 KB
testcase_33 AC 1 ms
3,484 KB
testcase_34 AC 1 ms
3,392 KB
testcase_35 AC 1 ms
3,460 KB
権限があれば一括ダウンロードができます

ソースコード

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