2020 camp-day6-M
模拟题
#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; }