Submission #12285583


Source Code Expand

Copy
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
#include<complex>

using namespace std;

#define ll long long
#define ld long double
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

const double PI=acos(-1);
const double EPS=1e-9; //うまくいかなかったらゆるめる

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<pii,int> ppi;
typedef pair<int,pii> pip;
typedef vector<pii> vp;
typedef vector<vi> vvi;

int gcd(int a, int b){if(b==0) return a;return gcd(b,a%b);}
int lcm(int a, int b){return a/gcd(a,b)*b;}

signed main(void) {
    int n;
    cin >> n;
    vvi a(n,vi(6));
    vi num;//座圧用配列
    rep(i,n)rep(j,6){
        cin >> a[i][j];
        num.push_back(a[i][j]);
    }

    //座圧
    sort(all(num));
    num.erase(unique(all(num)),num.end());

    int max_number = num.size();
    vvi dice(max_number+1);//dice[i]:=出目がiのサイコロのindex
    rep(i,n)rep(j,6){
        int ind = lower_bound(all(num),a[i][j]) - num.begin();//座圧後のindex
        dice[ind+1].push_back(i);//1-indexedにする
    }

    vector<double> dp(max_number+1,0),exp(n,0);
    double max_exp = 0;
    for(int i = max_number; i >= 0; i--){
        dp[i] = max_exp + 1;
        rep(j,dice[i].size()){
            //サイコロdice[i][j]に出目iが書かれている
            exp[dice[i][j]] += dp[i]/6.0;
            max_exp = max(max_exp, exp[dice[i][j]]);
        }
    }

    cout << shosu(10) << dp[0] << endl;
}

Submission Info

Submission Time
Task O - Endurance
User rika0384
Language C++14 (GCC 5.4.1)
Score 6
Code Size 2038 Byte
Status
Exec Time 148 ms
Memory 15732 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 example_01.txt, example_02.txt
All 6 / 6 example_01.txt, example_02.txt, subtask_01_01.txt, subtask_01_02.txt, subtask_01_03.txt, subtask_01_04.txt, subtask_01_05.txt, subtask_01_06.txt, subtask_01_07.txt, subtask_01_08.txt, subtask_01_09.txt, subtask_01_10.txt, subtask_01_11.txt, subtask_01_12.txt, subtask_01_13.txt, subtask_01_14.txt, subtask_01_15.txt, subtask_01_16.txt, subtask_01_17.txt, subtask_01_18.txt, subtask_01_19.txt, subtask_01_20.txt, subtask_01_21.txt
Case Name Status Exec Time Memory
example_01.txt 1 ms 256 KB
example_02.txt 1 ms 256 KB
subtask_01_01.txt 1 ms 256 KB
subtask_01_02.txt 1 ms 256 KB
subtask_01_03.txt 1 ms 256 KB
subtask_01_04.txt 122 ms 14192 KB
subtask_01_05.txt 139 ms 15732 KB
subtask_01_06.txt 3 ms 512 KB
subtask_01_07.txt 139 ms 15732 KB
subtask_01_08.txt 13 ms 1788 KB
subtask_01_09.txt 148 ms 15732 KB
subtask_01_10.txt 87 ms 11760 KB
subtask_01_11.txt 4 ms 640 KB
subtask_01_12.txt 63 ms 8564 KB
subtask_01_13.txt 50 ms 6772 KB
subtask_01_14.txt 25 ms 3320 KB
subtask_01_15.txt 130 ms 15732 KB
subtask_01_16.txt 119 ms 15732 KB
subtask_01_17.txt 120 ms 15732 KB
subtask_01_18.txt 125 ms 15732 KB
subtask_01_19.txt 129 ms 15732 KB
subtask_01_20.txt 136 ms 15732 KB
subtask_01_21.txt 135 ms 15732 KB