hdu 1084 作业

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
#include <cassert>
//#include <unordered_set>
//#include <unordered_map>
#define ll              long long
#define pii             pair<int, int>
#define rep(i,a,b)      for(int  i=a;i<=b;i++)
#define dec(i,a,b)      for(int  i=a;i>=b;i--)
#define forn(i, n)      for(int i = 0; i < int(n); i++)
using namespace std;
int dir[4][2] = { { 1,0 },{ 0,1 } ,{ 0,-1 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = 1e9 + 7;

inline ll read()
{
    ll x = 0; bool f = true; char c = getchar();
    while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
    while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return f ? x : -x;
}
inline ll gcd(ll m, ll n)
{
    return n == 0 ? m : gcd(n, m % n);
}
void exgcd(ll A, ll B, ll& x, ll& y)
{
    if (B) exgcd(B, A % B, y, x), y -= A / B * x; else x = 1, y = 0;
}
inline int qpow(int x, ll n) {
    int r = 1;
    while (n > 0) {
        if (n & 1) r = 1ll * r * x % mod;
        n >>= 1; x = 1ll * x * x % mod;
    }
    return r;
}
inline int inv(int x) {
    return qpow(x, mod - 2);
}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
/**********************************************************/
const int N = 1e5 + 5;

struct node
{
    string time;
    int key, solve=0, grade;
};

bool cmp1(node a, node b)
{
    if (a.solve == b.solve)
        return a.time < b.time;
    return a.solve > b.solve;
}

bool cmp2(node a, node b)
{
    return a.key < b.key;
}

int main()
{
    int n;
    while (cin >> n,n!=-1)
    {   
        vector<node> v;
        vector<int> a(6);
        rep(i, 1, n)
        {
            node t;
            cin >> t.solve >> t.time;
            t.key = i;
            v.push_back(t);
            a[t.solve]++;
        }
        sort(v.begin(), v.end(), cmp1);
        rep(i, 0, n - 1)
        {
            v[i].grade = v[i].solve * 10 + 50;
            if (v[i].solve == 4)
            {
                if (i - a[5] + 1 <= a[4] / 2)
                    v[i].grade += 5;
            }
            if (v[i].solve == 3)
            {
                if (i - a[5]-a[4] + 1 <= a[3] / 2)
                    v[i].grade += 5;
            }
            if (v[i].solve == 2)
            {
                if (i - a[5] -a[4]-a[3]+ 1 <= a[2] / 2)
                    v[i].grade += 5;
            }
            if (v[i].solve == 1)
            {
                if (i - a[5] - a[4] - a[3] -a[2]+ 1 <= a[1] / 2)
                    v[i].grade += 5;
            }
        }
        sort(v.begin(), v.end(), cmp2);
        rep(i, 0, n - 1)
        {
            cout << v[i].grade << endl;
        }
        cout << endl;
    }
    return 0;
}

 

posted @ 2020-09-01 15:25  DeaL57  阅读(125)  评论(0编辑  收藏  举报