首页 > 代码库 > 我是逗比!!!!!!

我是逗比!!!!!!

set和map都不怎么会用的逗比就这样完挂了第一次cf

div2 D

#include <cstdio>#include <cstring>#include <set>#include <iostream>#include <algorithm>#include <cstdlib>using namespace std;set<int> a,b,c;int aa[400001],bb[400001];int n,kd[200001];int l;int x,y;int main(){    cin>>n>>l>>x>>y;    for (int i=1;i<=n;i++)    {       cin>>kd[i];      a.insert(kd[i]);    }    sort(kd+1,kd+n+1);    int f1=0,f2=0;    for (int i=1;i<=n;i++)    {        if (a.find(kd[i]+x)!=a.end()||a.find(kd[i]-x)!=a.end())         f1=1;       if (a.find(kd[i]+y)!=a.end()||a.find(kd[i]-y)!=a.end())         f2=1;       if (f1==1&&f2==1)       {           printf("0");           return 0;       }    }    int js=0;    for (int i=1;i<=n;i++)    {        if (kd[i]-x>=0)        {          aa[++js]=kd[i]-x;          b.insert(kd[i]-x);        }        if (kd[i]+x<=l)        {          aa[++js]=kd[i]+x;          b.insert(kd[i]+x);        }    }    js=0;    for (int i=1;i<=n;i++)    {        if (kd[i]-y>=0)        {          bb[++js]=kd[i]-y;          c.insert(kd[i]-y);        }        if (kd[i]+y<=l)        {          bb[++js]=kd[i]+y;          c.insert(kd[i]+y);        }    }    if (f1==1)    {        printf("1 %d",bb[1]);        return 0;    }    if (f2==1)    {        printf("1 %d",aa[1]);        return 0;    }    for (int i=1;i<=js;i++)    {        if (b.find(bb[i])!=b.end())        {            printf("1 %d",bb[i]);            return 0;        }    }    printf("2 %d %d",aa[1],bb[1]);    }

代码很丑

我是逗比!!!!!!