csp 202206-4光线追踪 满分代码

该程序使用C++实现了一个数据结构,用于处理线段的插入、删除和查询操作。它涉及到了区间覆盖、映射和队列等数据结构,以及自定义比较函数和二分查找策略。主要处理基于二维坐标系的几何问题。

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<map>
#include<cmath>
#include<set>
using namespace std;
#define mp make_pair
#define ll long long
#define N 600023
ll read()
{
   
   
    ll f=1,x=0;
    char c=getchar();
    while(c>'9'||c<'0')
    {
   
   
        if(c=='-') f=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
   
   
        x=x*10+c-'0';
        c=getchar();
    }
    return f*x;
}
int m;
struct ques{
   
   
    int x1,x2,y1,y2;
    double a;
}q[N];
struct node{
   
   
    int pos,op;
    double a;
    bool operator < (const node A)const
    {
   
   
        return pos<A.pos;
    }
};
int senum;
set<node>se[N];
map<int,int>mh,ml;
void add(int pos,int x,int op,int whc,double ta)
{
   
   
    if(!whc)
    {
   
   
        if(!mh[pos]) mh[pos]=++senum;
        int now=mh[pos];
        se[now].insert(node{
   
   x,op,ta});
    }
    else
    {
   
   
        if(!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值