• poj2379


    简单题

    题意:对于一场acm比赛,给出所有提交状况,求排名。注意:提交状况并非按时间顺序。

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    #include
    <algorithm>
    using namespace std;

    #define maxn 1005
    #define maxp 25

    struct Team
    {
    int t, p, id;
    }team[maxn];

    struct Sub
    {
    int a, b, c, d;
    }sub[maxn];

    int n, m;
    bool solved[maxn][maxp];
    int reject[maxn][maxp];

    bool operator < (const Team &a, const Team &b)
    {
    if (a.p != b.p)
    return a.p > b.p;
    if (a.t != b.t)
    return a.t < b.t;
    return a.id < b.id;
    }

    bool operator < (const Sub &a, const Sub &b)
    {
    return a.c < b.c;
    }

    int main()
    {
    //freopen("t.txt", "r", stdin);
    scanf("%d%d", &n, &m);
    memset(solved,
    0, sizeof(solved));
    memset(reject,
    0, sizeof(reject));
    memset(team,
    0, sizeof(team));
    for (int i = 1; i <= n; i++)
    team[i].id
    = i;
    for (int i = 0; i < m; i++)
    scanf(
    "%d%d%d%d", &sub[i].a, &sub[i].b, &sub[i].c, &sub[i].d);
    sort(sub, sub
    + m);
    for (int i = 0; i < m; i++)
    {
    int a, b, c, d;
    a
    = sub[i].a;
    b
    = sub[i].b;
    c
    = sub[i].c;
    d
    = sub[i].d;
    if (solved[a][b])
    continue;
    if (d)
    {
    solved[a][b]
    = true;
    team[a].t
    += c + reject[a][b] * 20 * 60;
    team[a].p
    ++;
    }
    else
    reject[a][b]
    ++;
    }
    sort(team
    + 1, team + n + 1);
    printf(
    "%d", team[1].id);
    for (int i = 2; i <= n; i++)
    printf(
    " %d", team[i].id);
    putchar(
    '\n');
    return 0;
    }
  • 相关阅读:
    js模块化历程
    夜深
    出差(六)开会
    高情商的十大典型表现
    出差(五)调整
    HighCharts简单应用
    出差(四)适应
    出差(三)尝试
    出差(二)熟悉
    ZTree简单应用
  • 原文地址:https://www.cnblogs.com/rainydays/p/2115574.html
Copyright © 2020-2023  润新知