- 小明的网络游戏
- 2017-10-05 12:57:55 @
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
int n, m, p, axis[50000005];
int main() {
scanf("%d%d%d", &n, &m, &p);
int l = INT_MAX, r = INT_MIN;
for (int i = 1; i <= n; i++) {
int x, y; scanf("%d%d", &x, &y);
axis[x]++, axis[y + 1]--;
l = min(l, x), r = max(r, y);
}
int sum = 0;
p = min(m, p);
unsigned long long ans = 0;
for (int i = l; i <= r; i++) {
sum += axis[i];
ans += (unsigned long long)(sum < p ? sum : p);
}
printf("%llu\n", ans);
return 0;
}
0 条评论
目前还没有评论...