답안 #791458

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
791458 2023-07-24T06:43:48 Z PoonYaPat Roads (CEOI20_roads) C++14
15 / 100
13 ms 1364 KB
#include <bits/stdc++.h>
using namespace std;

struct point {
    int x,y;
};
typedef pair<point,point> ppp;

vector<ppp> v;
bool u;
int n;

bool comp(ppp A, ppp B) {
    point a=A.first, b=B.first;
    if (A.first.x==A.second.x) {
        if (a.x!=b.x) return a.x<b.x;
        else return a.y>b.y;
    } else if (u) {
        if (a.y-a.x!=b.y-b.x) return a.y-a.x<b.y-b.x;
        else return a.y>b.y;
    } else {
        if (a.x+a.y!=b.x+b.y) return a.x+a.y<b.x+b.y;
        else return a.y>b.y;
    }
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>n;
    for (int i=0; i<n; ++i) {
        point a,b;
        cin>>a.x>>a.y>>b.x>>b.y;
        if (a.y>b.y) swap(a,b);
        v.push_back(ppp(a,b));
    }
    if (v[0].first.x<v[0].second.x) u=true;
    sort(v.begin(),v.end(),comp);
    for (int i=1; i<v.size(); ++i) cout<<v[i-1].first.x<<" "<<v[i-1].first.y<<" "<<v[i].second.x<<" "<<v[i].second.y<<"\n";
}

Compilation message

roads.cpp: In function 'int main()':
roads.cpp:38:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<point, point> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i=1; i<v.size(); ++i) cout<<v[i-1].first.x<<" "<<v[i-1].first.y<<" "<<v[i].second.x<<" "<<v[i].second.y<<"\n";
      |                   ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 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 340 KB Output is correct
4 Correct 7 ms 876 KB Output is correct
5 Correct 13 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 7 ms 856 KB Output is correct
5 Correct 13 ms 1292 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Failed 1 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pa], S[*pf])"
8 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 368 KB Output is correct
4 Correct 6 ms 912 KB Output is correct
5 Correct 13 ms 1364 KB Output is correct
6 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Failed 0 ms 212 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
2 Halted 0 ms 0 KB -