AC日记——Dynamic Problem Scoring codeforces 807d

Dynamic Problem Scoring

思路:

  水题;

代码:

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define maxn 130

int n,ai[maxn][6],ac[6],cnt,all,last1,last2;

double map[3][6];

inline void in(int &now)
{
    int if_z=1;now=0;
    char Cget=getchar();
    while(Cget>‘9‘||Cget<‘0‘)
    {
        if(Cget==‘-‘) if_z=-1;
        Cget=getchar();
    }
    while(Cget>=‘0‘&&Cget<=‘9‘)
    {
        now=now*10+Cget-‘0‘;
        Cget=getchar();
    }
    now*=if_z;
}

int point(int a,int s,int t)
{
    if(t==-1) return 0;
    int res=0;
    double p=(double)a/(double)s;
    if(p>0.5&&p<=1) res+=500-2*t;
    else if(p>0.25&&p<=0.5) res+=1000-4*t;
    else if(p>0.125&&p<=0.25) res+=1500-t*6;
    else if(p>0.0625&&p<=0.125) res+=2000-t*8;
    else if(p>0.03125&&p<=0.0625) res+=2500-t*10;
    else if(p>0&&p<=0.03125) res+=3000-t*12;
    return res;
}

int main()
{
    in(n);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=5;j++)
        {
            in(ai[i][j]);
            if(ai[i][j]!=-1) ac[j]++;
        }
    }
    for(int i=1;i<=5;i++)
    {
        last1+=point(ac[i],n,ai[1][i]);
        last2+=point(ac[i],n,ai[2][i]);
    }
    cnt=n;
    if(last1>last2)
    {
        printf("0");
        return 0;
    }
    for(int j=1;j<=10000;j++)
    {
        cnt++;
        int sco1=0,sco2=0;
        bool if_[6];
        for(int i=1;i<=5;i++)
        {
            if(ai[1][i]==-1&&ai[2][i]==-1) continue;
            int k1=point(ac[i]+1,cnt,ai[1][i]);
            int k2=point(ac[i],cnt,ai[1][i]);
            int g1=point(ac[i]+1,cnt,ai[2][i]);
            int g2=point(ac[i],cnt,ai[2][i]);
            if(ai[1][i]==-1)
            {
                sco2+=g2;
                continue;
            }
            if(ai[2][i]==-1)
            {
                sco1+=k2;
                continue;
            }
            if(ai[1][i]<ai[2][i])
            {
                sco1+=k2;
                sco2+=g2;
            }
            else
            {
                ac[i]++;
                sco1+=k1;
                sco2+=g1;
            }
        }
        last1=sco1,last2=sco2;
        if(last1>last2)
        {
            cout<<cnt-n;
            return 0;
        }
    }
    cout<<-1;
    return 0;
}
时间: 2024-08-08 21:51:16

AC日记——Dynamic Problem Scoring codeforces 807d的相关文章

AC日记——Dynamic Ranking 洛谷 P2617

Dynamic Ranking 思路: 可持久化树状数组: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 10005 #define maxtot maxn*600 struct QueryType { int l,r,k; char op[4]; }; struct QueryType qu[maxn]; int n,m,ai[maxn],bi[maxn<<1],root[maxn]; int pos

AC日记——Sagheer and Crossroads codeforces 812a

812A - Sagheer and Crossroads 思路: 模拟: 代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define Yes {puts("YES\n");return 0;} int ai[5][5]; int main() { for(int i=1;i&l

AC日记——Sagheer, the Hausmeister codeforces 812b

812B - Sagheer, the Hausmeister 思路: 搜索: 代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define maxn 20 #define maxm 105 #define INF 0x7fffffff int n,m,deep[maxn][2],num[maxn],

AC日记——Is it rated? codeforces 807a

Is it rated? 思路: 水题: 代码: #include <cstdio> #include <cstring> using namespace std; int n,a[1001],b[1001],last=5000; int main() { scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d%d",&a[i],&b[i]); if(a[i]!=b[i

AC日记——Rmq Problem bzoj 3339

3339 思路: 恶心: 代码: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define maxn 200005 struct TreeNodeType { int l,r,dis,mid,flag; bool if_; }; struct TreeNodeType tree[maxn<<2

AC日记——Aragorn&#39;s Story HDU 3966

Aragorn's Story Time Limit: 10000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10510    Accepted Submission(s): 2766 Problem Description Our protagonist is the handsome human prince Aragorn comes from The Lor

Problem E CodeForces 237C

Description You've decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors. Consider positive integers a, a + 1, ..., b (a ≤ b).

Problem F CodeForces 16E

Description n fish, numbered from 1 to n, live in a lake. Every day right one pair of fish meet, and the probability of each other pair meeting is the same. If two fish with indexes i and j meet, the first will eat up the second with the probability 

Problem B Codeforces 295B 最短路(floyd)

Description Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has invented a new game: The game consists