代码本地运行没问题,(对拍拍了几百组过了,虽然会超时)
但提交上去全RE
题目
#include <iostream>
#include <queue>
using namespace std;
#define fly_chiken fc
struct fly_chiken{
int begin,end;
friend bool operator >(fc a,fc b){
return (a.begin)>=(b.begin);
}
};
priority_queue<fc,vector<fc>,greater<fc>> t1,t2;
priority_queue<fc,vector<fc>,greater<fc>> ps;
fc last[100025];
int clear(int y){
for(int i=0;i<y;i++){
last[i].begin=0;
last[i].end=0;
}
}
int ret_t1(){
while(!ps.empty()){
fc t=ps.top();
t1.push(t);
ps.pop();
}
return 0;
}
int ret_t2(){
while(!ps.empty()){
fc t=ps.top();
t2.push(t);
ps.pop();
}
return 0;
}
int main(){
int n,m1,m2;
cin>>n>>m1>>m2;
for(int i=0;i<m1;i++){
fc a;
cin>>a.begin;
cin>>a.end;
t1.push(a);
}
for(int j=0;j<m2;j++){
fc a;
cin>>a.begin;
cin>>a.end;
t2.push(a);
}
int sum=0;
for(int u1=0;u1<=n;u1++){
int s=0;
int u2=n-u1;
clear(n);
for(int i=0;i<m1;i++){
fc t=t1.top();
t1.pop();
ps.push(t);
for(int j=0;j<u1;j++){
if(last[j].begin==0||(last[j].end<=t.begin)){
last[j]=t;
s++;
break;
}
}
}
ret_t1();
clear(n);
for(int i=0;i<m2;i++){
fc t=t2.top();
t2.pop();
ps.push(t);
for(int j=0;j<u2;j++){
if(last[j].begin==0||(last[j].end<=t.begin)){
last[j]=t;
s++;
break;
}
}
}
ret_t2();
sum=max(s,sum);
}
cout<<sum<<endl;
return 0;
}