Submission #122599


Source Code Expand

Copy
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <set>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <complex>
#include <functional>
#include <utility>
#include <iomanip>
#include <iterator>
#include <vector>
#include <limits>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <typeinfo>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cfloat>
#include <cassert>
#include <cmath>
#include <cctype>
#include <ctime>
#include <sstream>
#include <bitset>

#define reb(i,b,n) for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n) reb(i,0,n)
#define rer(i,n) for(int i=1; i<=n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreb(i,n,b) for(int i = n; i >= b; i--)
#define resz(i,v) rep(i,sz(v))
#define let(v, x) __typeof(x) v = (x)
#define each(it,v) for(let(it, (v).begin()); it!=(v).end(); it++)
#define reach(it,v) for(let(it, (v).rbegin());i!=(v).rend();i++)
#define priArr(table, n) rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define priAr2(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}
#define vall(x) (x).begin(), (x).end()
#define rvall(x) (x).rbegin(), (x).rend()
#define vsort(v) sort(vall(v))
#define rvsort(v) sort(rvall(v))
#define len(array) (sizeof (array) / sizeof *(array))
#define aall(x) x, x+len(x)
#define asort(x) sort(aall(x))
#define rasort(a, type) sort(aall(a), greater<type>())
#define afill(a, v) fill(aall(a), v)
#define afill2(a, v, type) fill((type *)a, (type *)(a + len(a)), v)
#define sz(x) (int)(x).size()
#define mp(a, b) make_pair(a, b)
#define dmax(x,y) x = max(x,y);
#define dmin(x,y) x = min(x,y);
#define dadd(x,y) x = (x+(y))%MOD;
#define ddel(x,y) x = (x-(y)+MOD)%MOD;
#define dmul(x,y) x = ((ll)x*(y))%MOD;
#define snuke srand((unsigned)clock()+(unsigned)time(NULL))
#define fi first
#define se second
#define pb push_back
#define _USE_MATH_DEFINES

using std::stringstream;
using namespace std;

typedef long long ll; typedef unsigned long long ull;
typedef pair <int, int> P; typedef pair <int, P> PP;
typedef vector<int> vi;typedef vector<vi> vvi;typedef vector<string> vs;
typedef vector<ll> vl; typedef vector<P > vP; typedef vector<char> vc;
typedef long double ld;

const static int INF = 0x3f3f3f3f;
const static ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const static double EPS = 1e-9;
const static ll MOD = 1000000007LL;

inline int toInt(std::string s) {int v; std::istringstream sin(s);sin>>v;return v;}
template<class T> inline std::string toString(T x) {std::ostringstream sout;sout<<x;return sout.str();}

int dx[] = {1,0,-1,0}, dy[] = {0,1,0,-1};
/* --------------------------------------------------------------- */

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(0); // off the sync synchronous of cin and cout

    int n, k;
    cin >> n >> k;

    double r[n];
    rep(i, n) {
        cin >> r[i];
    }
    asort(r);

    double ans = 0;
    reb(i, n-k, n) {
        ans = (ans + r[i]) / 2;
    }

    cout << fixed << setprecision(9);
    
    cout << (double)ans << endl;

    return 0;
}

Submission Info

Submission Time
Task C - AtCoderプログラミング講座
User emacs
Language C++ (G++ 4.6.4)
Score 100
Code Size 3249 Byte
Status AC
Exec Time 23 ms
Memory 936 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 34
Set Name Test Cases
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 21 ms 936 KB
00_sample_02.txt AC 21 ms 936 KB
00_sample_03.txt AC 22 ms 928 KB
00_sample_04.txt AC 20 ms 800 KB
test_01.txt AC 21 ms 932 KB
test_02.txt AC 21 ms 804 KB
test_03.txt AC 21 ms 932 KB
test_04.txt AC 21 ms 804 KB
test_05.txt AC 21 ms 932 KB
test_06.txt AC 21 ms 808 KB
test_07.txt AC 21 ms 804 KB
test_08.txt AC 21 ms 808 KB
test_09.txt AC 21 ms 804 KB
test_10.txt AC 21 ms 928 KB
test_11.txt AC 21 ms 932 KB
test_12.txt AC 21 ms 932 KB
test_13.txt AC 22 ms 932 KB
test_14.txt AC 20 ms 924 KB
test_15.txt AC 21 ms 808 KB
test_16.txt AC 22 ms 812 KB
test_17.txt AC 20 ms 800 KB
test_18.txt AC 20 ms 804 KB
test_19.txt AC 21 ms 936 KB
test_20.txt AC 21 ms 928 KB
test_21.txt AC 23 ms 804 KB
test_22.txt AC 21 ms 804 KB
test_23.txt AC 22 ms 924 KB
test_24.txt AC 21 ms 932 KB
test_25.txt AC 20 ms 932 KB
test_26.txt AC 21 ms 928 KB
test_27.txt AC 21 ms 808 KB
test_28.txt AC 21 ms 796 KB
test_29.txt AC 21 ms 804 KB
test_30.txt AC 21 ms 804 KB