結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 16 ms
5,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 8 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 7 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 8 ms
5,376 KB
testcase_24 AC 8 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 36 ms
5,376 KB
testcase_28 AC 18 ms
5,376 KB
testcase_29 AC 32 ms
5,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 8 ms
5,376 KB
testcase_34 AC 9 ms
5,376 KB
testcase_35 AC 8 ms
5,376 KB
testcase_36 AC 8 ms
5,376 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 8 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  sort(ALL(A));
  
  int t = 1 << 30;
  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