Submission #492492

# Submission time Handle Problem Language Result Execution time Memory
492492 2021-12-07T15:04:10 Z LittleCube Roads (CEOI20_roads) C++14
0 / 100
19 ms 1012 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;

int N;
ll dx, dy;
pll p[200005];
vector<int> v;
signed main()
{
    cin >> N;
    for (int i = 1; i <= N; i++)
        cin >> p[2 * i - 1].F >> p[2 * i - 1].S >> p[2 * i].F >> p[2 * i].S;
    dx = p[2].F - p[1].F;
    dy = p[2].S - p[1].S;
    for (int i = 1; i <= N; i++)
        v.emplace_back(i);
    sort(v.begin(), v.end(), [&](int i1, int i2)
         { return p[i1 * 2].F * dy - p[i1 * 2].S * dx < p[i2 * 2].F * dy - p[i2 * 2].S * dx; });
    for (int i = 1; i < N; i++)
        cout << max(p[2 * v[i - 1] - 1], p[2 * v[i - 1]]).F << " " << max(p[2 * v[i - 1] - 1], p[2 * v[i - 1]]).S << " " << min(p[2 * v[i] - 1], p[2 * v[i]]).F << " " << min(p[2 * v[i] - 1], p[2 * v[i]]).S << '\n';
}
# Verdict Execution time Memory Grader output
1 Failed 0 ms 204 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Failed 19 ms 972 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Failed 17 ms 892 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Failed 16 ms 1012 KB Condition failed: "pf == Sline.end() || !Cross(S[*pi], S[*pf])"
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 0 ms 204 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Failed 0 ms 204 KB Condition failed: "!Cross(S[*pi], S[*pa])"
2 Halted 0 ms 0 KB -