Submission #703460

# Submission time Handle Problem Language Result Execution time Memory
703460 2023-02-27T12:34:30 Z Darren0724 Roads (CEOI20_roads) C++17
30 / 100
207 ms 6392 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);
        }
    }
};
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;
    sort(all(v),[&](line a,line b){
         if(a.y2*tmp1-a.x2*tmp2==b.y2*tmp1-b.x2*tmp2){
            return a.y2<b.y2;
         }
         return a.y2*tmp1-a.x2*tmp2<b.y2*tmp1-b.x2*tmp2;
    });
    for(int i=1;i<n;i++){
        cout<<v[i-1].x2<<' '<<v[i-1].y2<<' '<<v[i].x1<<' '<<v[i].y1<<endl;
    }


    return 0;
}
# Verdict Execution time Memory Grader output
1 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 19 ms 868 KB Output is correct
5 Correct 42 ms 1516 KB Output is correct
# Verdict Execution time Memory 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 21 ms 852 KB Output is correct
5 Correct 41 ms 1444 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 19 ms 836 KB Output is correct
10 Correct 207 ms 6392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 26 ms 828 KB Output is correct
5 Correct 49 ms 1420 KB Output is correct
6 Failed 1 ms 220 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 1 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 Halted 0 ms 0 KB -