Processing math: 100%

2020 camp-day6-M

模拟题

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <cstdio>
#include <vector>
#include <algorithm>
 
#define RE register
#define FOR(i,a,b) for(RE int i=a;i<=b;++i)
#define ROF(i,a,b) for(RE int i=a;i>=b;--i)
#define P pair<int,int>
#define sc(n) scanf("%d",&n)
 
using namespace std;
 
const int maxn = 110;
 
int person[102][12], test[12], wa[102][12], maxwa[102][12];
int n, m, w, a, b, c;
long long ans[102];
 
int main()
{
    sc(n); sc(m); sc(w);
    FOR(i, 1, w)
    {
        sc(a), sc(b), sc(c);
        if(!person[a][0])person[a][0] = 1;
        if (c)
        {
            if (!person[a][b])++person[a][0],person[a][b] = 1, ++test[b];
            wa[a][b] = 0;
        }
        else ++wa[a][b], maxwa[a][b] = max(maxwa[a][b], wa[a][b]);
    }
    FOR(i, 1, n)
    {
        if (!person[i][0]) { puts("998244353"); continue; }
        if (person[i][0] == 1) { puts("1000000"); continue; }
        if (person[i][0] == m + 1) { puts("0"); continue; }
        else
            FOR(j, 1, m)
            {
                if (test[j] && !person[i][j])
                    if (test[j] >= n / 2)ans[i] += 30;
                    else ans[i] += 20;
                if (!person[i][j])ans[i] += 2ll * maxwa[i][j] * maxwa[i][j];
                else ans[i] += 1ll * maxwa[i][j] * maxwa[i][j];
            }
        printf("%lld\n", ans[i]);
    }
    return 0;
}

  

本文作者:洛绫璃

本文链接:https://www.cnblogs.com/2aptx4869/p/12216746.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   洛绫璃  阅读(101)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起