結果

問題 No.1905 PURE PHRASE
ユーザー risujiroh
提出日時 2022-04-15 21:50:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 2,273 ms
コンパイル使用メモリ 195,304 KB
最終ジャッジ日時 2025-01-28 18:12:16
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

std::array<double, 7> const freqs = {261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5};

int main() {
  int N;
  std::cin >> N;
  std::vector<int> A(N);
  for (int& e : A) { std::cin >> e; }

  std::vector<int> suff(N + 1);
  for (int i = N; i--;) { suff[i] = A[i] + suff[i + 1]; }

  int mn = std::numeric_limits<int>::max();
  int ans = -1;
  for (int t = 0; t < 7; ++t) {
    int w = int(std::round(N / freqs[t]));
    int mx = 0;
    for (int i = 0; i + w <= N; ++i) { mx = std::max(mx, std::abs(suff[i] - suff[i + w])); }
    if (mx < mn) {
      mn = mx;
      ans = t;
    }
  }
  std::cout << "CDEFGAB"[ans] << "4\n";
}
0