結果
| 問題 |
No.1905 PURE PHRASE
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-15 22:27:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 967 bytes |
| コンパイル時間 | 2,091 ms |
| コンパイル使用メモリ | 175,884 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 01:18:07 |
| 合計ジャッジ時間 | 3,918 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
V<string> S = {"C4", "D4", "E4", "F4", "G4", "A4", "B4"};
V<double> H = {261.6, 294.3, 327.0, 348.8, 392.4, 436.0, 490.5};
int N;
cin >> N;
V<int> A(N);
rep(i, N) cin >> A[i];
int d = 1 << 30, ansi = 0;
rep(i, 7) {
string s = S[i];
double h = H[i];
int M = h + 1;
show(M);
V<V<int>> G(M);
rep(j, N) {
int ind = h * j / N;
G[ind].push_back(A[j]);
}
int m = min((int)G[0].size(), (int)G[1].size());
int cd = 0;
rep(j, m) cd += abs(G[0][j] - G[1][j]);
if (d > cd) ansi = i, d = cd;
}
cout << S[ansi] << '\n';
return 0;
}