ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#213956 | #2400. 椅子 | a_sad_soul | Compile Error | / | / | C++ | 751b | 2024-11-14 20:02:17 | 2024-11-14 23:04:36 |
answer
#include<bits/stdc++.h>
using namespace std;
int n,m;
int ans;
const int MAXN = 5e5+10;
struct node{
int l,r;
bool operator<(const node x)const {
if(l==x.l)return r>x.r;
return l<x.l;
}
}a[MAXN];
priority_queue<int,vector<int>,greater<int>>q;
int l,r;
int cnt;
int p[MAXN];
int main(){
scanf("%d%d",&n,&m);l=1,r=m;
for(int i=1;i<=n;++i)scanf("%d%d",&a[i].l,&a[i].r);
sort(a+1,a+1+n);
for(int i=1;i<=n;++i){
q.push(a[i].r);
if(l<=r&&l<=a[i].l)++l;
else {
p[++cnt]=q.top();q.pop();
}
}
sort(p+1,p+1+cnt);
for(int i=cnt;i;--i){
if(l<=r&&p[i]<=r)--r;
else ++ans;
}
cout<<ans<<endl;
return 0;
}
详细
answer.code:13:43: error: '>>' should be '> >' within a nested template argument list priority_queue<int,vector<int>,greater<int>>q;\x0d ^ answer.code: In function 'int main()': answer.code:18:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d",&n,&m);l=1,r=m;\x0d ^ answer.code:19:55: warning: ignoring return value of 'int scanf(const char*...