Submission #1183577
Source Code Expand
#include <bits/stdc++.h>
// limit
#define mod1 22439423LL
#define mod2 42342432LL
#define mod3 56454765LL
#define mod4 66867574LL
#define oo 1000000007LL
#define OO 1000000000000000007LL
#define maxN 2000007
// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftosqrt(i, x, y) for(int i = (x); i*i <= (y); ++i)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)
// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;
// operation
#define mp make_pair
#define pb push_back
#define pf push_front
// structure
#define ii pair<int, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>
#define matrix vector<vll>
// get value
#define FF first
#define SS second
// data type
#define ll long long
#define ull unsigned long long
// function
#define lb lower_bound
#define ub upper_bound
// const value
#define pi 3.14159265358979323846264338327950288419716939937510
using namespace std;
template <class T>
T min(T a, T b, T c) {
return min(a, min(b, c));
}
template <class T>
T min(T a, T b, T c, T d) {
return min(a, min(b, min(c, d)));
}
template <class T>
T max(T a, T b, T c) {
return max(a, max(b, c));
}
template <class T>
T max(T a, T b, T c, T d) {
return max(a, max(b, max(c, d)));
}
bool cmp(const ll& a, const ll& b) {return a > b;}
int cnt[maxN];
ll a[maxN];
map <ll, int> m, M;
string toStr(int n) {
string s = "";
while (n) {
s += (char)(n%10+'0');
n /= 10;
}
reverse(s.begin(), s.end());
return s;
}
string add(string a, string b)
{
string res="";
while(a.length() < b.length()) a="0"+a;
while(b.length() < a.length()) b="0"+b;
int carry=0;
for(int i=a.length()-1;i>=0;i--)
{
int tmp=a[i]-48 + b[i]-48 + carry;
carry=tmp/10;
tmp=tmp%10;
res=(char)(tmp+48)+res;
}
if(carry>0) res="1"+res;
return res;
}
string sub(string a, string b)
{
string res="";
while(a.length() < b.length()) a="0"+a;
while(b.length() < a.length()) b="0"+b;
bool neg=false;
if(a<b)
{
swap(a,b);
neg=true;
}
int borrow=0;
for(int i=a.length()-1; i>=0;i--)
{
int tmp=a[i]-b[i]-borrow;
if(tmp<0)
{
tmp+=10;
borrow=1;
}
else borrow=0;
res=(char)(tmp%10 + 48) + res;
}
while(res.length()>1 && res[0]=='0') res.erase(0,1);
if(neg) res="-"+res;
return res;
}
string mul(string a, string b)
{
string res="";
int n=a.length();
int m=b.length();
int len=n+m-1;
int carry=0;
for(int i=len;i>=0;i--)
{
int tmp=0;
for(int j=n-1;j>=0;j--)
if(i-j<=m && i-j>=1)
{
int a1=a[j]-48;
int b1=b[i-j-1]-48;
tmp+=a1*b1;
}
tmp+=carry;
carry=tmp/10;
res=(char)(tmp%10 + 48)+res;
}
while(res.length()>1 && res[0]=='0') res.erase(0,1);
return res;
}
string c(int k, int n) {
fto (i, 1, 100) cnt[i] = 0;
fto (i, 1, n) {
int t = i;
fto (j, 2, t) {
while (t%j == 0) {
++cnt[j];
t /= j;
}
}
}
fto (i, 1, k) {
int t = i;
fto (j, 2, t) {
while (t%j == 0) {
--cnt[j];
t /= j;
}
}
}
fto (i, 1, n-k) {
int t = i;
fto (j, 2, t) {
while (t%j == 0) {
--cnt[j];
t /= j;
}
}
}
string ans = "1";
fto (i, 1, 100) {
fto (j, 1, cnt[i]) ans = mul(ans, toStr(i));
}
return ans;
}
int main() {
// #ifndef ONLINE_JUDGE
// freopen("tmp.inp", "r", stdin);
// freopen("tmp.out", "w", stdout);
// #endif // ONLINE_JUDGE
int n, u, v;
scanf("%d%d%d", &n, &u, &v);
fto (i, 1, n) scanf("%lld", &a[i]);
sort(a+1, a+n+1, cmp);
double tmp = 0.0;
fto (i, 1, u) tmp += (double)a[i];
fto (i, 1, u) ++m[a[i]];
fto (i, 1, n) ++M[a[i]];
string ans = "1";
fto (i, 1, u) ans = mul(ans, c(m[a[i]], M[a[i]]));
printf("%.20f\n", tmp/u);
cout << ans;
return 0;
}
Submission Info
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:206:32: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d%d", &n, &u, &v);
^
./Main.cpp:208:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fto (i, 1, n) scanf("%lld", &a[i]);
^
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 400 |
Status |
|
|
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 |
2 ms |
2304 KB |
sample_02.txt |
AC |
2 ms |
2304 KB |
sample_03.txt |
AC |
2 ms |
2304 KB |
sample_04.txt |
WA |
2 ms |
2304 KB |
subtask_1_1.txt |
AC |
2 ms |
2304 KB |
subtask_1_10.txt |
WA |
2 ms |
2304 KB |
subtask_1_11.txt |
WA |
2 ms |
2304 KB |
subtask_1_12.txt |
WA |
2 ms |
2304 KB |
subtask_1_13.txt |
WA |
2 ms |
2304 KB |
subtask_1_14.txt |
WA |
2 ms |
2304 KB |
subtask_1_15.txt |
WA |
2 ms |
2304 KB |
subtask_1_2.txt |
AC |
2 ms |
2304 KB |
subtask_1_3.txt |
AC |
2 ms |
2304 KB |
subtask_1_4.txt |
AC |
2 ms |
2304 KB |
subtask_1_5.txt |
AC |
2 ms |
2304 KB |
subtask_1_6.txt |
WA |
2 ms |
2304 KB |
subtask_1_7.txt |
AC |
2 ms |
2304 KB |
subtask_1_8.txt |
WA |
2 ms |
2304 KB |
subtask_1_9.txt |
WA |
2 ms |
2304 KB |