# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
698058 |
2023-02-12T07:31:33 Z |
vjudge1 |
Mobile (BOI12_mobile) |
C++17 |
|
1000 ms |
87236 KB |
#include <bits/stdc++.h>
#define int int64_t
#define f first
#define s second
#define mp make_pair
using namespace std;
bool check(int r, int L, const vector<array<int, 2>>& stations)
{
set<pair<int, int>> intervals;
for (const array<int, 2>& station : stations)
{
int diff_sqrd = r * r - station[1] * station[1];
if (diff_sqrd < 0)
continue;
int diff = sqrt(diff_sqrd);
int _l = station[0] - diff, _r = station[0] + diff;
if (_l > L || _r < 0)
continue;
intervals.insert(mp(_l, _r));
}
if (intervals.begin()->f > 0)
return false;
int last = (*intervals.begin()).s;
for (auto it = intervals.begin(); it != intervals.end() && last < L && it->f <= last; it++)
{
last = max(last, it->s);
}
return last >= L;
}
int32_t main()
{
int N, L;
cin >> N >> L;
vector<array<int, 2>> stations(N);
for (int i = 0; i < N; i++)
{
for (int j = 0; j < 2; j++)
{
cin >> stations[i][j];
stations[i][j] *= 1e4;
}
}
L *= 1e4;
int l = 0, r = 4e13;
while (r - l > 1)
{
int m = l+r>>1;
if (check(m, L, stations))
r = m;
else
l = m;
}
cout << (static_cast<double>(r) / 1e4) << "\n";
}
Compilation message
mobile.cpp: In function 'int32_t main()':
mobile.cpp:51:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
51 | int m = l+r>>1;
| ~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
16 ms |
696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
275 ms |
6836 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
384 ms |
7132 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
593 ms |
7756 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
718 ms |
9660 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
257 ms |
5836 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
43588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
39336 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1071 ms |
52332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
43716 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
61020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
51424 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
69712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
58496 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
87236 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
70976 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |