結果

問題 No.1884 Sequence
ユーザー osk_x64osk_x64
提出日時 2022-03-25 22:06:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 2,425 ms
コンパイル使用メモリ 200,520 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 06:47:02
合計ジャッジ時間 7,954 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 RE -
testcase_10 AC 144 ms
5,376 KB
testcase_11 AC 141 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 30 ms
5,376 KB
testcase_15 AC 88 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 86 ms
5,376 KB
testcase_19 AC 70 ms
5,376 KB
testcase_20 AC 77 ms
5,376 KB
testcase_21 AC 60 ms
5,376 KB
testcase_22 AC 83 ms
5,376 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 132 ms
5,376 KB
testcase_26 AC 140 ms
5,376 KB
testcase_27 AC 36 ms
5,376 KB
testcase_28 AC 36 ms
5,376 KB
testcase_29 WA -
testcase_30 AC 36 ms
5,376 KB
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 127 ms
5,376 KB
testcase_34 AC 128 ms
5,376 KB
testcase_35 AC 43 ms
5,376 KB
testcase_36 AC 96 ms
5,376 KB
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 AC 113 ms
5,376 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
using ll = long long;

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(ALL(A));
  
  ll t = 1LL << 60;
  int z = 0;
  for (int i = 0; i < N-1; i++) {
    if(A[i] == 0) z++;
    else t = min(t, A[i+1] - A[i]);
  }
  
  bool ans = true;
  for (int i = 0; i < N-1; i++) {
    if(A[i] == 0) continue;
    int x = A[i+1] - A[i];
    if(x == t) continue;
    if(x % t) ans = false;
    z -= x / t -1;
    if(z < 0) ans = false;
  }
  cout << (ans ? "Yes" : "No") << endl;
  return 0;
}
0