QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#379507 | #8022. Walker | comeintocalm# | Compile Error | / | / | C++17 | 1.9kb | 2024-04-06 17:43:13 | 2024-04-06 17:43:15 |
Judging History
This is the latest submission verdict.
- [2024-04-06 17:43:15]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-04-06 17:43:13]
- Submitted
answer
#include <bits/stdc++.h>
#define LL long long
#define db long double
using namespace std;
int T;
constexpr db eps = 1e-15;
db n, p[2], v[2];
bool chk (db t) {
db l1 = t * v[0], l2 = t * v[1];
if (l1 - (p[0] + n) > eps || l1 - (2 * n - p[0]) > eps) {
return true;
}
if (l2 - (p[1] + n) > eps || l2 - (2 * n - p[1]) > eps) {
return true;
}
if (l1 - p[0] < eps || l2 - (n - p[1]) < eps) {
return false;
}
db out1 = std::max(l1 - 2 * p[0], (l1 - p[0]) / 2);
db out2 = std::max(l2 - 2 * (n - p[1]), (l2 - (n - p[1])) / 2);
out1 = std::max(0.0, out1);
out2 = std::max(0.0, out2);
if (out1 + out2 - (p[1] - p[0]) > eps) {
return true;
}
return false;
}
int main() {
// freopen("in", "r", stdin);
scanf ("%d", &T);
while (T--) {
scanf ("%Lf%Lf%Lf%Lf%Lf", &n, &p[0], &v[0], &p[1], &v[1]);
if (p[0] > p[1]) swap (p[0], p[1]), swap (v[0], v[1]);
db L = 0, R = 1e9;
int cnt = 100;
while (cnt--) {
db mid = (L + R) / 2.0;
if (chk (mid)) R = mid;
else L = mid;
}
printf ("%.18Lf\n", L);
/*
db ans = min (calc (0, 0, n), calc (1, 0, n));
//printf ("%.15Lf\n", ((db) 1000) / ((db)0.001));
//printf ("%.15Lf\n", ans);
//return 0;
//ans = min (ans, max (0, 0, p[1]))
//cout << n << endl;
//cout << calc (0, 0, n) << endl;
db L = p[0], R = p[1];
int cnt = 300;
while (cnt--) {
db fm = (R - L) / ((db) 3.0), m1 = L + fm, m2 = R - fm;
db a1 = max (calc (0, 0, m1), calc (1, m1, n));
db a2 = max (calc (0, 0, m2), calc (1, m2, n));
ans = min (ans, a1);
ans = min (ans, a2);
if (a1 < a2) R = m2;
else L = m1;
}
ans = min (ans, max (calc (0, 0, L), calc (1, L, n)));
printf ("%.15Lf\n", ans);
*/
}
return 0;
}
Details
answer.code: In function ‘bool chk(long double)’: answer.code:23:20: error: no matching function for call to ‘max(double, long double&)’ 23 | out1 = std::max(0.0, out1); | ~~~~~~~~^~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: answer.code:23:20: note: deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’) 23 | out1 = std::max(0.0, out1); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: answer.code:23:20: note: deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’) 23 | out1 = std::max(0.0, out1); | ~~~~~~~~^~~~~~~~~~~ In file included from /usr/include/c++/13/algorithm:61: /usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed: answer.code:23:20: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘double’ 23 | out1 = std::max(0.0, out1); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed: answer.code:23:20: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘double’ 23 | out1 = std::max(0.0, out1); | ~~~~~~~~^~~~~~~~~~~ answer.code:24:20: error: no matching function for call to ‘max(double, long double&)’ 24 | out2 = std::max(0.0, out2); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: ‘template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: answer.code:24:20: note: deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’) 24 | out2 = std::max(0.0, out2); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: template argument deduction/substitution failed: answer.code:24:20: note: deduced conflicting types for parameter ‘const _Tp’ (‘double’ and ‘long double’) 24 | out2 = std::max(0.0, out2); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: ‘template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)’ 5795 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5795:5: note: template argument deduction/substitution failed: answer.code:24:20: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘double’ 24 | out2 = std::max(0.0, out2); | ~~~~~~~~^~~~~~~~~~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: ‘template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)’ 5805 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algo.h:5805:5: note: template argument deduction/substitution failed: answer.code:24:20: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘double’ 24 | out2 = std::max(0.0, out2); | ~~~~~~~~^~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:33:11: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | scanf ("%d", &T); | ~~~~~~^~~~~~~~~~ answer.code:35:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 35 | scanf ("%Lf%Lf%Lf%...