zoukankan      html  css  js  c++  java
  • 2020 CCPC Wannafly Winter Camp Day6 Div.1&2 M-自闭

    题目链接 https://ac.nowcoder.com/acm/contest/4137/M

    就是一道模拟题, 重要的是题意理解清楚

    #include<iostream>
    #include<string>
    #include <cstdlib>
    #include <algorithm>
    #include<cmath>
    #include<cstring>
    #include<cstdio>
    #include<vector>
    #include<queue>
    #include<map>
    #include<set>
    #include<bitset>
    #include <iomanip>
    
    // #pragma comment(linker, "/STACK:1024000000,1024000000")
    // #define pi acos(-1)
    // #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define INF 0x7f7f7f7f //2139062143
    #define INF1 0x3f3f3f3f //1061109567
    #define INF2 2147483647
    #define llINF 9223372036854775807
    #define pi 3.141592653589793//23846264338327950254
    #define pb push_back
    
    #define debug cout << "debug
    ";
    #define si freopen("in.txt","r",stdin);
    // freopen(".out","w",stdout);
    #define CNM ios::sync_with_stdio(false);cin.tie(NULL);
    #define scai(x) scanf("%d", &x)
    #define sca2i(x, y) scanf("%d %d", &x, &y)
    #define scaf(x) scanf("%lf", &x)
    #define sca2f(x, y) scanf("%lf %lf", &x, &y)
    #define For(m,n) for (int i = m;  i < n; i++)
    
    inline ll read(){
       ll s=0,w=1;
       char ch=getchar();
       while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
       while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
       return s*w;
    }
    #define local
    #ifdef local
    #endif
    
    #define MAX 10233
    #define LCH(i) ((i) << 1)
    #define RCH(i) ((i) << 1 | 1)
    
    const int N = 1e5 + 5;
    const ll mod = 998244353;
    
    ll n, m, W;
    vector<vector<pair<int, int>>> a(101);
    ll t[101][11];
    ll ac[11];
    ll zb[101];
    ll w[101][11][2]; // 记录每个人每道题连续最大的wa
    ll tt[101];
    int main()
    {
        CNM
        si
        cin >> n >> m >> W;
        ll x, y, c;
        for (int i = 0; i < W; i++)
        {
            cin >> x >> y >> c;
            a[x].push_back(make_pair(y, c)); // 记录每个人的提交记录
            if (c == 1 && t[x][y] == 0) // 如果这次提交ac了,且之前这道题还没ac
            {
                ac[y]++; // 过了这道题的人数+1
                t[x][y] = 1ll;  // 标记这个人这道题过了
                t[x][0]++; // 这人人过题的总数+1
            }
            // 更新这个题连续最大的wa
            if (c == 0){
                    w[x][y][1]++;
                    w[x][y][0] = max(w[x][y][1], w[x][y][0]);
                }
            else if (c == 1)
            {
                w[x][y][1] = 0;
            }
        }
       // printf("fdsafdsafdsafdsf%lld  %lld
    ", w[3][1], );
        for (int i = 1; i <= n; i++)
        {
            if (a[i].size() == 0) zb[i] = 998244353ll; // 没提交
            else if (t[i][0] == 0) zb[i] = 1000000ll; // 这个人ac0题
            else if (t[i][0] == m) zb[i] = 0ll; // 这个人ak
            // 枚举每道题
            else
            {
                for (int j = 1; j <= m; j++)
                {
    
                    if (ac[j] && t[i][j] == 0) zb[i] += 20ll;
    
                    if (ac[j] >= n/2 && t[i][j] == 0) zb[i] += 10ll;
    
                    zb[i] += w[i][j][0]*w[i][j][0];
    
                    if (t[i][j] == 0)
                    {
                        zb[i] += w[i][j][0]*w[i][j][0];
                    }
    
                }
    
    
            }
        }
        for (int i = 1; i <= n; i++)
            cout << zb[i] << endl;
    
    }
  • 相关阅读:
    设置win 10 软件开机启动
    win10 无法使用内置管理员账户打开应用
    设置 npm 源为淘宝镜像
    git sh.exe 乱码
    mybatis 获取新增数据的主键
    框架 get 请求乱码
    js在浏览器下的区别小结(部分)
    js调试的一点小知识
    git常用命令
    css水平居中(一)
  • 原文地址:https://www.cnblogs.com/hulian425/p/12250649.html
Copyright © 2011-2022 走看看