답안 #703443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
703443 2023-02-27T12:07:11 Z Darren0724 Roads (CEOI20_roads) C++17
15 / 100
61 ms 2344 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
struct line{
    int x1,y1,x2,y2;
    line(){}
    line(int a,int b,int c,int d){
        x1=a,y1=b,x2=c,y2=d;
        if(y1>y2){
            swap(x1,x2);
            swap(y1,y2);
        }
    }
};
bool operator<(line a,line b){
    if(a.x1==b.x1){
        return a.y1<b.y1;
    }
    return a.x1<b.x1;
}

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    vector<line> v(n);
    for(int i=0;i<n;i++){
        int a,b,c,d;cin>>a>>b>>c>>d;
        v[i]=line(a,b,c,d);
    }
    int tmp1=v[0].x2-v[0].x1;
    int tmp2=v[0].y2-v[0].y1;
    if(tmp2==0){
        for(int i=0;i<n;i++){
            swap(v[i].x1,v[i].y1);
            swap(v[i].x2,v[i].y2);
        }
        sort(all(v));
        for(int i=0;i<n;i++){
            swap(v[i].x1,v[i].y1);
            swap(v[i].x2,v[i].y2);
        }
        for(int i=1;i<n;i++){
            cout<<v[i-1].x2<<' '<<v[i-1].y2<<' '<<v[i].x1-(v[i].y2-v[i].y1)/tmp2*tmp1<<' '<<v[i].y1<<endl;
        }
        return 0;
    }
    for(int i=0;i<n;i++){
        v[i].x1+=(v[i].y2-v[i].y1)/tmp2*tmp1;
    }
    sort(all(v));
    for(int i=1;i<n;i++){
        cout<<v[i-1].x2<<' '<<v[i-1].y2<<' '<<v[i].x1-(v[i].y2-v[i].y1)/tmp2*tmp1<<' '<<v[i].y1<<endl;
    }


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Failed 61 ms 2296 KB Condition failed: "!Cross(S[*pi], S[*pa])"
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 18 ms 852 KB Output is correct
5 Correct 35 ms 1420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 18 ms 940 KB Output is correct
5 Correct 36 ms 1464 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Failed 1 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 20 ms 912 KB Output is correct
5 Correct 34 ms 1440 KB Output is correct
6 Runtime error 1 ms 340 KB Execution killed with signal 8
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 18 ms 932 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Failed 1 ms 212 KB Condition failed: "!Cross(S[*pi], S[*pa])"
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Failed 58 ms 2344 KB Condition failed: "!Cross(S[*pi], S[*pa])"
3 Halted 0 ms 0 KB -