2020 CCPC Wannafly Winter Camp Day6 Div.1&2 M-自闭

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

 

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

#include
#include<string>
#include 
#include 
#include
#include
#include
#include
#include
#include
#include<set>
#include
#include 

// #pragma comment(linker, "/STACK:1024000000,1024000000")
// #define pi acos(-1)
// #include
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\n";
#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;
vectorint, 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\n", 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;

}

 

你可能感兴趣的:(2020 CCPC Wannafly Winter Camp Day6 Div.1&2 M-自闭)