結果

問題 No.1584 Stones around Circle Pond
ユーザー SSRSSSRS
提出日時 2021-07-02 22:39:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,293 bytes
コンパイル時間 1,582 ms
コンパイル使用メモリ 172,772 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 22:59:28
合計ジャッジ時間 3,656 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 2 ms
4,376 KB
testcase_50 AC 2 ms
4,380 KB
testcase_51 AC 2 ms
4,380 KB
testcase_52 AC 2 ms
4,380 KB
testcase_53 AC 2 ms
4,380 KB
testcase_54 AC 1 ms
4,380 KB
testcase_55 AC 2 ms
4,380 KB
testcase_56 AC 2 ms
4,380 KB
testcase_57 AC 2 ms
4,380 KB
testcase_58 AC 2 ms
4,376 KB
testcase_59 AC 2 ms
4,376 KB
testcase_60 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//WA
#include <bits/stdc++.h>
using namespace std;
const long long INF = 100000000000000000;
int main(){
  int N, L;
  cin >> N >> L;
  vector<int> d(N);
  for (int i = 0; i < N; i++){
    cin >> d[i];
  }
  vector<int> B(N * 2);
  for (int i = 0; i < N * 2; i++){
    cin >> B[i];
  }
  vector<int> p(N * 2);
  for (int i = 0; i < N; i++){
    p[i] = d[i];
    p[N + i] = L + d[i];
  }
  vector<vector<long long>> s(N * 2, vector<long long>(N * 2, 0));
  for (int i = 0; i < N * 2; i++){
    for (int j = 0; j < N * 2; j++){
      s[i][j] = min(abs(p[j] - p[i]), L * 2 - abs(p[j] - p[i]));
    }
  }
  long long sum1 = 0;
  for (int i = 0; i < N * 2; i++){
    sum1 += s[0][i];
  }
  long long sum2 = 0;
  for (int i = 0; i < N * 2; i++){
    sum2 += B[i];
  }
  if (sum2 % sum1 != 0){
    cout << "No" << endl;
  } else {
    long long c = sum2 / sum1;
    bool ok = true;
    vector<long long> s(N);
    for (int i = 0; i < N; i++){
      int j = i + 1;
      long long d1 = B[j] - B[i];
      long long d2 = p[j] - p[i];
      if (d1 % d2 != 0){
        ok = false;
      } else if (abs(d1) / d2 % 2 != c % 2){
        ok = false;
      } else {
        s[i] = (c - d1 / d2) / 2;
      }
    }
    if (!ok){
      cout << "No" << endl;
    } else {
      cout << "Yes" << endl;
    }
  }
}
0