# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
624180 |
2022-08-07T11:45:17 Z |
Vladth11 |
Roads (CEOI20_roads) |
C++14 |
|
89 ms |
11256 KB |
#include <bits/stdc++.h>
#define C 1
#define P 0
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
using namespace std;
typedef long long ll;
typedef pair <long double, long double> pii;
const ll NMAX = 100001;
const ll VMAX = 101;
const ll INF = (1LL << 60);
const ll MOD = 1000000007;
const ll BLOCK = 447;
const ll base = 117;
const ll nr_of_bits = 18;
const ll inv2 = 500000004;
map <pii, pii> mp;
pii v[NMAX * 2];
struct ura{
pii a, b;
};
const long double pi = 3.14159265358979323846;
vector <ura> sol;
map <pii, bool> scutit;
long double slope = 1;
bool mic(pii a, pii b){
return a < b;
}
bool cmp(pii a, pii b){
return (mic(a, b));
}
long double dd(pii a, pii b){
return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second));
}
map <pii, pair <int, int> > cine;
long double tg(long double x){
return sin(x) / cos(x);
}
int main() {
//ifstream cin(".in");
//ofstream cout(".out");
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, i;
cin >> n;
for(i = 1; i <= n; i++){
pii a, b;
cin >> a.first >> a.second >> b.first >> b.second;
if(mic(a, b))
swap(a, b);
if(b.first != a.first){
slope = (a.second - b.second) / (a.first - b.first);
}
pii d;
long double distanta = dd(a, b);
pii mijloc = {(a.first + b.first) / 2.0, (a.second + b.second) / 2.0};
d.first = mijloc.first;
d.second = mijloc.second - distanta / 2.0;
cine[d] = a;
a = d;
v[i] = a;
pii c = {a.first, 0};
c.second = a.second + distanta;
cine[c] = b;
b = c;
mp[a] = b;
mp[b] = a;
}
sort(v + 1, v + n + 1, cmp);
for(i = 1; i < n; i++){
sol.push_back({v[i], mp[v[i + 1]]});
}
for(auto x : sol){
cout << cine[x.a].first << " " << cine[x.a].second << " " << cine[x.b].first << " " << cine[x.b].second << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Failed |
0 ms |
340 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
5 ms |
852 KB |
Output is correct |
4 |
Correct |
45 ms |
5876 KB |
Output is correct |
5 |
Correct |
82 ms |
11256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
6 ms |
916 KB |
Output is correct |
4 |
Correct |
47 ms |
5864 KB |
Output is correct |
5 |
Correct |
80 ms |
11252 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Failed |
1 ms |
468 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
3 ms |
852 KB |
Output is correct |
4 |
Correct |
36 ms |
5884 KB |
Output is correct |
5 |
Correct |
89 ms |
11184 KB |
Output is correct |
6 |
Failed |
0 ms |
340 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Failed |
0 ms |
212 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Failed |
0 ms |
340 KB |
Condition failed: "!Cross(S[*pi], S[*pa])" |
2 |
Halted |
0 ms |
0 KB |
- |