結果

問題 No.576 E869120 and Rings
ユーザー TangentDayTangentDay
提出日時 2017-10-14 02:37:36
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,679 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 99,196 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 18:03:13
合計ジャッジ時間 2,454 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 12 ms
6,944 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
6,940 KB
testcase_25 WA -
testcase_26 AC 1 ms
6,940 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <random>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

vector<double> slide_min(vector<double> a, int k){
    vector<double> ret;
    deque<double> dq;
    REP(i,a.size()){
        while (!dq.empty() && a[dq.back()] >= a[i]) dq.pop_back();
        dq.push_back(i);
        if (i - k + 1 >= 0){
            ret.push_back(a[dq.front()]);
            if (dq.front() == i - k + 1) dq.pop_front();
        }
    }
    return ret;
}

bool check(vector<double> a, int k){
    int n = a.size() / 2;
    vector<double> b(2*n+1);
    REP(i,2*n) b[i+1] += b[i] + a[i];
    vector<double> mi = slide_min(b, n - k + 1);
    REP(i,n) if (mi[i] <= b[n+1+i]) return true;
    return false;
}

int main() {
    int n, k;
    string s;
    cin >> n >> k;
    cin >> s;

    cout << 0 << endl;
    return 0;

    vector<double> a(n);
    REP(i,n) a[i] = s[i] - '0';
    REP(i,n) a.push_back(a[i]);

    double ok = 0.0, ng = 1.0;
    REP(_,100){
        vector<double> b(a);
        double mi = (ok + ng) / 2.0;
        REP(i,2*n) b[i] -= mi;
        if (check(b, k)) ok = mi;
        else ng = mi;
    }
    printf("%.10f\n", ok);

    return 0;
}
0