Submission #1182279


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORD(i,a,b) for (int i = (a); i >= (b); i--)
#define REP(i,a) FOR(i,0,(int)(a)-1)
#define reset(a,b) memset(a,b,sizeof(a))
#define BUG(x) cout << #x << " = " << x << endl
#define PR(x,a,b) {cout << #x << " = "; FOR (_,a,b) cout << x[_] << ' '; cout << endl;}
#define CON(x) {cout << #x << " = "; for(auto i:x) cout << i << ' '; cout << endl;}
#define mod 1000000007
#define pi acos(-1)
#define eps 0.00000001
#define pb push_back
#define sqr(x) (x) * (x)
#define _1 first
#define _2 second

long long n, a, b, lis[55], high, low;
map<long long, long long> m;
long long c[55][55];

int main() {
  ios::sync_with_stdio(false);
  FOR (i, 1, 50) {
  	c[i][0] = 1;
  	FOR (j, 1, i) c[i][j] = c[i][j - 1] * (i - j + 1) / j;
  }
  cin >> n >> a >> b;
  REP (i, n) cin >> lis[i], m[lis[i]]++;
  sort(lis, lis + n);
  high = lis[n - 1];
  low = lis[n - a];
  long long s = 0;
  FOR (i, n - a, n - 1) s += lis[i];
  cout << setprecision(11) << 1.0 * s / a << endl;
  if (high == low) {
  	b = min(b, m[low]);
  	long long ans = 0;
  	FOR (i, a, b) ans += c[m[low]][i];
  	cout << ans;
  } else {
  	int tmp = 0;
  	FOR (i, n - a, n - 1) if (lis[i] == low) tmp++;
  	cout << c[m[low]][tmp];
  }
}

Submission Info

Submission Time
Task D - Maximum Average Sets
User ngochai
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1336 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 4
AC × 19
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
subtask_1_1.txt AC 1 ms 256 KB
subtask_1_10.txt AC 1 ms 256 KB
subtask_1_11.txt AC 1 ms 256 KB
subtask_1_12.txt AC 1 ms 256 KB
subtask_1_13.txt AC 1 ms 256 KB
subtask_1_14.txt AC 1 ms 256 KB
subtask_1_15.txt AC 1 ms 256 KB
subtask_1_2.txt AC 1 ms 256 KB
subtask_1_3.txt AC 1 ms 256 KB
subtask_1_4.txt AC 1 ms 256 KB
subtask_1_5.txt AC 1 ms 256 KB
subtask_1_6.txt AC 1 ms 256 KB
subtask_1_7.txt AC 1 ms 256 KB
subtask_1_8.txt AC 1 ms 256 KB
subtask_1_9.txt AC 1 ms 256 KB