破防了普及组月赛我都挂分,蒟蒻求调t3 60分
  • 板块学术版
  • 楼主Svemit
  • 当前回复10
  • 已保存回复10
  • 发布时间2023/8/26 21:53
  • 上次更新2023/11/3 01:00:33
查看原帖
破防了普及组月赛我都挂分,蒟蒻求调t3 60分
503792
Svemit楼主2023/8/26 21:53

rt

#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int N = 2e5 + 5, INF = 0x3f3f3f3f;
const LL mod = 1e9 + 7;
int n, m, q, k;
int cnt[3][N], d[N];
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin >> n >> m >> q >> k;
    while(q --) {
    	int op, x;
    	cin >> op >> x;	
    	cnt[op][x] ++;
    	cnt[op][x] %= k;
    }
    for(int i = 0; i < n; i ++) {
    	d[cnt[1][i]] ++;
    }
    LL ans = 1ll * n * m;
    for(int i = 1; i <= m; i ++) {
    	ans -= d[(k - cnt[2][i]) % k];
    }
    cout << ans << '\n';
    return 0;
}
2023/8/26 21:53
加载中...