QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369128#2434. Single Cut of FailureInfinityNS#Compile Error//C++144.0kb2024-03-27 20:52:302024-03-27 20:52:31

Judging History

你现在查看的是最新测评结果

  • [2024-03-27 20:52:31]
  • 评测
  • [2024-03-27 20:52:30]
  • 提交

answer

#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
using namespace std;
typedef pair<int,int> pii;

const int mod=998244353;
inline int add(int x,int y){int ret=x+y;if(ret>=mod)ret-=mod;return ret;}
inline int sub(int x,int y){int ret=x-y;if(ret<0)ret+=mod;return ret;}
inline int mul(int x,int y){return ((ll)x*y)%mod;}
inline int step(int base,int pw){int ret=1;while(pw){if(pw&1)ret=mul(ret,base);base=mul(base,base);pw>>=1;}return ret;}
inline int invv(int x){return step(x,mod-2);}


const int maxn=2e6+10;

struct pt{
    ll x,y;

    pt(){}
    pt(ll x,ll y){
        this->x=x;
        this->y=y;
    }

    pt operator -(pt b){
        return pt(x-b.x,y-b.y);
    }
    pt operator +(pt b){
        return pt(x+b.x,y+b.y);
    }


    ll cross(pt b){
        return x*b.y-y*b.x;
    }

    ll sqdist(){
        return x*x+y*y;
    }

    void ispis(){
        printf("%lld %lld PT\n",x,y);
    }

};

using int128=__int128_t;
typedef pair<pt,int128> ptl;
typedef pair<pt,pt> ptt;

bool cmp(ptl &a,ptl &b){

    pt pta=a.ff;
    pt ptb=b.ff;

    ll pom=pta.cross(ptb);

    if(pom>0)return 1;
    if(pom<0)return 0;

    if(pta.x==0)return pta.y>ptb.y;
    return pta.x<ptb.x;
}

int n,w,h;
int128 hval[maxn][2];

void ispisi(pt a,pt b){

    cout<<fixed<<setprecision(11)<<((double)a.x+b.x)/2<<" "<<((double)a.y+b.y)/2<<" ";

}

bool nisu_uliniji(ptt a,ptt b){

    if(a.ff.x==a.ss.x && a.ss.x==b.ff.x && b.ff.x==b.ss.x)return false;
    if(a.ff.y==a.ss.y && a.ss.y==b.ff.y && b.ff.y==b.ss.y)return false;
    return true;

}

int128 get_rin128(mt19937_64 &gen){
    ll pom=gen();
    ll pom2=gen();
    return (int128)((int128)pom^( ((int128)pom2) <<62));
}

int main(){

    ///freopen("test.txt","r",stdin);

    scanf("%d %d %d",&n,&w,&h);
    mt19937_64 gen(10);
    int128 currh=0;
    int128 fullh=0;
    vector<ptl>events;
    for(int i=1;i<=n;i++){
        pt a,b;
        scanf("%lld %lld %lld %lld",&a.x,&a.y,&b.x,&b.y);
        if(a.cross(b)<0)swap(a,b);
        hval[i][0]=get_rin128(gen);
        hval[i][1]=get_rin128(gen);
        currh^=hval[i][0];
        fullh^=hval[i][0];
        fullh^=hval[i][1];
        events.pb({a,hval[i][0]^hval[i][1]});
        events.pb({b,hval[i][0]^hval[i][1]});
    }

    events.pb({pt(w,0),0});
    events.pb({pt(0,h),0});
    events.pb({pt(w,h),0});

    sort(events.begin(),events.end(),cmp);

    pt prv(0,0);
    /// isto i kad zavrsis probaj sa 00

    unordered_map<int128,vector<pair<pt,pt>> >mapa;
    mapa.reserve(4*n);
    mapa.max_load_factor(0.25);
    for(int i=0;i<events.size();i++){
        pt cpt=events[i].ff;
        mapa[currh].pb({prv,cpt});
        currh^=events[i].ss;
        prv=cpt;
    }
    mapa[currh].pb({prv,pt(0,0)});

    pt reza1,reza2,rezb1,rezb2;
    bool flag=0;
    for(auto it=mapa.begin();it!=mapa.end();it++){

        int128 val=it->ff;

        if(mapa.find(fullh^val)!=mapa.end()){

            vector<ptt>&aa=it->ss;
            vector<ptt>&bb=mapa[fullh^val];

            for(int i=0;i<aa.size();i++){
            for(int j=0;j<bb.size();j++){
                if(nisu_uliniji(aa[i],bb[i])){
                    reza1=aa[i].ff;
                    reza2=aa[i].ss;
                    rezb1=bb[i].ff;
                    rezb2=bb[i].ss;
                    flag=1;
                    break;
                }
            }
            if(flag)break;
            }

            if(flag)break;
        }

    }

    if(flag){
        printf("1\n");

        /*reza1.ispis();
        reza2.ispis();
        rezb1.ispis();
        rezb2.ispis();*/

        ispisi(reza1,reza2);
        ispisi(rezb1,rezb2);
        printf("\n");
    }
    else{

        printf("2\n");
        cout<<fixed<<setprecision(11)<<0<<" "<<0.5<<" "<<(double)w-0.5<<" "<<h<<endl;
        cout<<fixed<<setprecision(11)<<w<<" "<<0.5<<" "<<0.5<<" "<<h<<endl;
    }

    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:122:47: error: use of deleted function ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = __int128; _Tp = std::vector<std::pair<pt, pt> >; _Hash = std::hash<__int128>; _Pred = std::equal_to<__int128>; _Alloc = std::allocator<std::pair<const __int128, std::vector<std::pair<pt, pt> > > >]’
  122 |     unordered_map<int128,vector<pair<pt,pt>> >mapa;
      |                                               ^~~~
In file included from /usr/include/c++/13/unordered_map:41,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:188,
                 from answer.code:1:
/usr/include/c++/13/bits/unordered_map.h:148:7: note: ‘std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = __int128; _Tp = std::vector<std::pair<pt, pt> >; _Hash = std::hash<__int128>; _Pred = std::equal_to<__int128>; _Alloc = std::allocator<std::pair<const __int128, std::vector<std::pair<pt, pt> > > >]’ is implicitly deleted because the default definition would be ill-formed:
  148 |       unordered_map() = default;
      |       ^~~~~~~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:148:7: error: use of deleted function ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = __int128; _Value = std::pair<const __int128, std::vector<std::pair<pt, pt> > >; _Alloc = std::allocator<std::pair<const __int128, std::vector<std::pair<pt, pt> > > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/13/bits/unordered_map.h:33:
/usr/include/c++/13/bits/hashtable.h:530:7: note: ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = __int128; _Value = std::pair<const __int128, std::vector<std::pair<pt, pt> > >; _Alloc = std::allocator<std::pair<const __int128, std::vector<std::pair<pt, pt> > > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
  530 |       _Hashtable() = default;
      |       ^~~~~~~~~~
/usr/include/c++/13/bits/hashtable.h:530:7: error: use of deleted function ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = __int128; _Value = std::pair<const __int128, std::vector<std::pair<pt, pt> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
In file included from /usr/include/c++/13/bits/hashtable.h:35:
/usr/include/c++/13/bits/hashtable_policy.h:1710:7: note: ‘std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = __int128; _Value = std::pair<const __int128, std::vector<std::pair<pt, pt> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<__int128>; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’ is implicitly deleted because the default definition would be ill-formed:
 1710 |       _Hashtable_base() = default;
      |       ^~~~~~~~~~~~~~~
/usr/include/c++/13/bits/hashtable_policy.h:1710:7: error: use of deleted function ‘std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = __int128; _Value = std::pair<const __int128, std::vector<std::pair<pt, pt> > >; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<__int128>; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]’
/usr/include/c++/13/bits/hashtable_policy.h: In instantiation of ‘std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<__int128>]’:
/usr/include/c++/13/bits/hashtable_policy.h:1297:7:   required from here
/usr/include/c++/13/bits/hashtable_policy.h:1214:49: error: use of deleted function ‘std::hash<__int128>::hash()’
 1214 |       _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
      |                 ...