比赛 |
20120712 |
评测结果 |
AAATTTTTTA |
题目名称 |
区间权最大 |
最终得分 |
40 |
用户昵称 |
CC |
运行时间 |
6.001 s |
代码语言 |
C++ |
内存使用 |
1.43 MiB |
提交时间 |
2012-07-12 11:28:31 |
显示代码纯文本
#include <cstdio>
#include <algorithm>
struct node {
int x,y,v;
}a[100005];
int n,m,p,q;
int main() {
freopen("max.in","r",stdin);
freopen("max.out","w",stdout);
scanf("%d%d", &n, &m);
for (int i = 1;i <= n;i++) scanf("%d%d%d", &a[i].x, &a[i].y, &a[i].v);
int tmp = 0;
for (int i = 1;i <= m;i++) {
tmp = 0;
scanf("%d%d", &p, &q);
for (int i = 1;i <= n;i++)
if (a[i].x >= p && a[i].y <= q) tmp = std::max(tmp,a[i].v);
printf("%d\n", tmp);
}
return 0;
}