Submission #492494

# Submission time Handle Problem Language Result Execution time Memory
492494 2021-12-07T15:07:08 Z LittleCube Roads (CEOI20_roads) C++14
30 / 100
169 ms 9728 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)
         {
             if (p[i1 * 2].F * dy - p[i1 * 2].S * dx != p[i2 * 2].F * dy - p[i2 * 2].S * dx)
                 return p[i1 * 2].F * dy - p[i1 * 2].S * dx < p[i2 * 2].F * dy - p[i2 * 2].S * dx;
             else
                 return p[i1 * 2] < p[i2 * 2];
         });
    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 Correct 16 ms 992 KB Output is correct
5 Correct 34 ms 1712 KB Output is correct
# 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 Correct 16 ms 980 KB Output is correct
5 Correct 35 ms 1604 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 3 ms 312 KB Output is correct
9 Correct 17 ms 1228 KB Output is correct
10 Correct 169 ms 9728 KB Output is correct
# 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 Correct 17 ms 900 KB Output is correct
5 Correct 35 ms 1640 KB Output is correct
6 Failed 0 ms 204 KB Condition failed: "pf == Sline.end() || !Cross(S[*pa], S[*pf])"
7 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 -