wa7求hack

P8661 [蓝桥杯 2018 省 B] 日志统计

lrhtom @ 2023-11-14 18:24:41

谢谢佬们

#include <bits/stdc++.h>
using namespace std;
int n, m, qs;
priority_queue<int, vector<int>, greater<int>> q[100010];
map<int, int> mp;
void solve() {
  cin >> n >> m >> qs;
  int num1, num2;
  while (n--) {
    cin >> num1 >> num2;
    mp[num2] = 1;
    q[num2].push(num1);
  }
  int pt, ls, pys;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    pys = (i->first);
    ls = q[pys].top(), pt = 0;
    int j = 0;
    while (q[pys].size()) {
      if (pt == qs) {
        j = 1;
        cout << pys << endl;
        break;
      }
      if (q[pys].top() - ls >= m) {
        pt = 0;
        ls = q[pys].top();
      }
      pt++;
      q[pys].pop();
    }
    if (pt == qs && j == 0) {
      cout << pys << endl;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  solve();
  return 0;
}

|