QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#144745 | #2771. Need for Speed | PetroTarnavskyi# | WA | 1ms | 3840kb | C++17 | 884b | 2023-08-21 18:18:54 | 2023-08-21 18:18:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = int(a); i < int(b); i++)
#define RFOR(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin() a.end()
#define PB push_back
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
const double EPS = 1e-6;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, t;
cin >> n >> t;
VI d(n), s(n);
FOR (i, 0, n) cin >> d[i] >> s[i];
double l = -1e6, r = 1e6;
FOR (it, 0, 74)
{
double m = (l + r) / 2;
double time = 0;
bool ok = 1;
FOR (i, 0, n)
{
double sp = s[i] - m;
if (sp < EPS)
{
ok = 0;
break;
}
time += double(d[i]) / sp;
}
if (!ok || time > t)
r = m;
else
l = m;
}
cout << fixed << setprecision(10) << -l << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3688kb
input:
3 5 4 -1 4 0 10 3
output:
3.0000000000
result:
ok found '3.0000000', expected '3.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
4 10 5 3 2 2 3 6 3 1
output:
-0.5086533768
result:
ok found '-0.5086534', expected '-0.5086534', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
1 500 123 456
output:
-455.7540000000
result:
ok found '-455.7540000', expected '-455.7540000', error '-0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
3 1 1 2 1 3 1 6
output:
-0.0000000000
result:
ok found '-0.0000000', expected '-0.0000000', error '-0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
4 10 1 -1 2 -2 3 -3 4 -5
output:
5.4996199199
result:
ok found '5.4996199', expected '5.4996199', error '0.0000000'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
100 100001 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 10...
output:
-0.0000099999
result:
ok found '-0.0000100', expected '-0.0000100', error '0.0000000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
100 99001 1000 999 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1000 1 1...
output:
0.0000000101
result:
ok found '0.0000000', expected '0.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
1000 300 408 -17 943 -93 4 706 172 -343 472 -812 888 -669 507 -655 117 -324 209 -639 370 142 608 192 521 852 460 -269 93 56 821 -671 141 -240 190 574 608 79 681 295 742 123 954 91 194 -854 759 -807 639 593 901 147 877 740 492 216 498 985 884 -202 229 -982 261 -887 166 255 464 893 50 -63 664 -344 276...
output:
1838.0345693450
result:
ok found '1838.0345693', expected '1838.0345693', error '0.0000000'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3752kb
input:
1000 1 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1000 1000 -1...
output:
1000000.0000000000
result:
wrong answer 1st numbers differ - expected: '1001000.0000000', found: '1000000.0000000', error = '0.0009990'