hiho week 189 register

Ended

Participants:100

Verdict:Accepted
Score:100 / 100
Submitted:2018-02-15 01:56:32

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
const int MAX=2e5;
int a[MAX],b[200],n,m;
double cla(int x)
{
    a[x]++;
    double ans=1;
    for(int i=1;i<=m;i++)ans*=pow(a[i],1.0/b[i]);
    a[x]--;
    return ans;
}
int main()
{
    cin>>n>>m;
    for(int i=1;i<=m;i++)scanf("%d",&a[i]);
    for(int i=1;i<=m;i++)scanf("%d",&b[i]);
    double ans=1;
    for(int i=1;i<=m;i++)ans*=pow(a[i],1.0/b[i]);
    for(int i=1;i<=n;i++)
    {
        int x;
        for(int j=1;j<=m;j++)
        {
            if(cla(j)>ans)
            {
                ans=cla(j);
                x=j;
            }
        }
        a[x]++;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX