結果

問題 No.1905 PURE PHRASE
ユーザー RubikunRubikun
提出日時 2022-04-15 21:38:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,518 bytes
コンパイル時間 2,251 ms
コンパイル使用メモリ 209,312 KB
実行使用メモリ 4,552 KB
最終ジャッジ日時 2023-08-26 07:39:39
合計ジャッジ時間 3,733 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,380 KB
testcase_01 AC 9 ms
4,376 KB
testcase_02 AC 9 ms
4,380 KB
testcase_03 AC 9 ms
4,552 KB
testcase_04 AC 9 ms
4,380 KB
testcase_05 AC 9 ms
4,400 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 AC 9 ms
4,380 KB
testcase_08 AC 9 ms
4,380 KB
testcase_09 AC 9 ms
4,396 KB
testcase_10 AC 9 ms
4,408 KB
testcase_11 AC 9 ms
4,444 KB
testcase_12 WA -
testcase_13 AC 8 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 8 ms
4,380 KB
testcase_17 AC 9 ms
4,376 KB
testcase_18 AC 9 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 8 ms
4,380 KB
testcase_22 AC 9 ms
4,380 KB
testcase_23 AC 8 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 9 ms
4,448 KB
testcase_26 AC 8 ms
4,440 KB
testcase_27 AC 9 ms
4,380 KB
testcase_28 WA -
testcase_29 AC 9 ms
4,380 KB
testcase_30 AC 9 ms
4,376 KB
testcase_31 AC 8 ms
4,388 KB
testcase_32 AC 9 ms
4,408 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 9 ms
4,376 KB
testcase_36 AC 9 ms
4,376 KB
testcase_37 AC 8 ms
4,376 KB
testcase_38 WA -
testcase_39 AC 8 ms
4,376 KB
testcase_40 AC 9 ms
4,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
    
    int N;cin>>N;
    ll now=0;
    
    vector<ll> S={262, 294, 327, 349, 392, 436, 491};
    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;
            for(int j=i;j<N;j+=S[t]){
                gosa+=(A[j]-m)*(A[j]-m);
            }
        }
        chmin(mi,mp(gosa,t));
        
        //cout<<gosa<<" "<<t<<endl;
    }
    
    string U="CDEFGAB";
    
    cout<<U[mi.se]<<4<<endl;
}
0