UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#213956#2400. 椅子a_sad_soulCompile Error//C++751b2024-11-14 20:02:172024-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*...