답안 #791402

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791402 2023-07-24T06:02:47 Z ttamx Roads (CEOI20_roads) C++14
30 / 100
86 ms 9372 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int N=1e5+5;
const ld eps=1e-9;

struct point{
    ll x,y;
    point():x(0),y(0){}
    point(ll x,ll y):x(x),y(y){}
    const bool operator<(const point &o)const{
        if(y==o.y)return x<o.x;
        return y<o.y;
    }
};

struct line{
    point p1,p2;
    line(point p1,point p2):p1(min(p1,p2)),p2(max(p1,p2)){}
    line(ll x1,ll y1,ll x2,ll y2){
        *this=line(point(x1,y1),point(x2,y2));
    }
    const ld dx()const{
        return p1.x-p2.x;
    }
    const ld dy()const{
        return p1.y-p2.y;
    }
    const ld c()const{
        if(abs(dx())<eps)return p1.x;
        return p1.y-dy()/dx()*p1.x;
    }
    const bool operator<(const line &o)const{
        ld a=c(),b=o.c();
        if(abs(a-b)<eps)return p1<o.p1;
        return a<b;
    }
};

int n;
vector<line> vec;

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n;
    for(int i=1;i<=n;i++){
        ll a,b,c,d;
        cin >> a >> b >> c >> d;
        vec.emplace_back(line(a,b,c,d));
    }
    sort(vec.begin(),vec.end());
    for(int i=1;i<n;i++){
        cout << vec[i-1].p2.x << " " << vec[i-1].p2.y << " " << vec[i].p1.x << " " << vec[i].p1.y << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 8 ms 1240 KB Output is correct
5 Correct 16 ms 2028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 7 ms 1352 KB Output is correct
5 Correct 18 ms 1844 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 8 ms 1336 KB Output is correct
10 Correct 86 ms 9372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 8 ms 1276 KB Output is correct
5 Correct 15 ms 1932 KB Output is correct
6 Failed 1 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -