結果
| 問題 |
No.1905 PURE PHRASE
|
| コンテスト | |
| ユーザー |
Rubikun
|
| 提出日時 | 2022-04-15 21:52:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 1,585 bytes |
| コンパイル時間 | 2,094 ms |
| コンパイル使用メモリ | 206,092 KB |
| 最終ジャッジ日時 | 2025-01-28 18:12:54 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005;
const ll INF=1LL<<60;
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
ll N;cin>>N;
ll now=0;
vector<ll> S={168, 150, 135, 126, 112, 101, 90};
//for(int i=0;i<7;i++) S[i]=N/S[i];
vector<ll> A(N);
vector<int> ord(N);
vector<pair<ll,int>> B(N);
for(int i=0;i<N;i++){
int x;cin>>x;
now+=x;
A[i]=now;
B[i]=mp(now,i);
//cout<<i<<" "<<now<<endl;
}
sort(all(B));
for(int i=0;i<N;i++){
ord[B[i].se]=i;
}
pair<ll,int> mi=mp(INF,-1);
for(int t=0;t<7;t++){
ll gosa=0;
for(int i=0;i<S[t];i++){
ll sum=0,cn=0;
for(int j=i;j<N;j+=S[t]){
sum+=A[j];
cn++;
}
ll m=sum/cn,X=0;
for(int j=i;j<N;j+=S[t]){
X+=(A[j]-m)*(A[j]-m);
}
gosa+=sqrtl((long double)(X)/cn);
}
gosa/=S[t];
chmin(mi,mp(gosa,t));
//cout<<gosa<<" "<<t<<endl;
}
string U="CDEFGAB";
cout<<U[mi.se]<<4<<endl;
}
Rubikun