求救,20pts,马蜂良好
  • 板块P10464 Task
  • 楼主T7_Daniel
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/10/1 08:16
  • 上次更新2024/10/1 11:26:21
查看原帖
求救,20pts,马蜂良好
903392
T7_Daniel楼主2024/10/1 08:16
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5+5;
struct node1{
    int x,y;
}a[N];
struct node2{
    int x,y;
}b[N];
bool vis[N];
inline int read(){
    int s=0,f=1;
    char ch=getchar();
    while(!isdigit(ch)){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(isdigit(ch)){
        s=(s<<3)+(s<<1)+(ch-'0');
        ch=getchar();
    }
    return s*f;
}
inline bool operator < (node1 x,node1 y){
    if(x.x!=y.x) return x.x>y.x;
    return x.y>y.y;
}
inline bool operator < (node2 x,node2 y){
    if(x.x!=y.x) return x.x>y.x;
    return x.y>y.y;
}
signed main(){
	freopen("10.in","r",stdin);
	int n,m;cin>>n>>m;
    for(int i=1;i<=n;i++){
        a[i].x=read();a[i].y=read();
    }
    for(int i=1;i<=m;i++){
        b[i].x=read();b[i].y=read();
    }
    sort(a+1,a+n+1);
    sort(b+1,b+m+1);
    int pla=0,ans=0,cnt=0;
    for(int i=1;i<=m;i++){
        while(a[pla+1].x>=b[i].x && a[pla+1].y>=b[i].y && pla<n) pla++;
        for(int j=pla;j>=1;j--){
            if(vis[j]==0){
                vis[j]=1;
                cnt++;
                ans+=(1ll*500*b[i].x+2*b[i].y);
                break;
            }
        }
    }
    printf("%lld %lld",cnt,ans);
	return 0;
}
2024/10/1 08:16
加载中...