QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#216374 | #6609. Scholomance Academy | Tdfccc | TL | 887ms | 8260kb | C++14 | 1.1kb | 2023-10-15 17:47:50 | 2023-10-15 17:47:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> v(n);
vector<char> c(n);
for(int i = 0; i < n; i ++)
cin >> c[i] >> v[i];
set<double> st;
map<double, double> to;
set<double> check;
for(auto x : v)
{
if(check.count(x)) continue;
if(!check.count(x))
{
check.insert(x);
}
int TP = 0, FN = 0, FP = 0, TN = 0;
for(int j = 0; j < n; j ++)
{
if(v[j] >= x)
{
if(c[j] == '+') TP ++;
else FP ++;
}
else
{
if(c[j] == '+') FN ++;
else TN ++;
}
}
double TPR = TP * 1.0 / (TP + FN);
double FPR = FP * 1.0 / (TN + FP);
if(!st.count(FPR))
{
st.insert(FPR);
to[FPR] = TPR;
}
else
{
to[FPR] = max(to[FPR], TPR);
}
}
double now1 = 0;
double now2 = 0;
double ans = 0;
for(auto x : st)
{
if(x == 0)
{
now2 = to[x];
continue;
}
ans += (x - now1) * now2;
now1 = x;
now2 = to[x];
}
cout << fixed << setprecision(12) << ans << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
input:
3 + 2 - 3 - 1
output:
0.500000000000
result:
ok found '0.500000000', expected '0.500000000', error '0.000000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
6 + 7 - 2 - 5 + 4 - 2 + 6
output:
0.888888888889
result:
ok found '0.888888889', expected '0.888888889', error '0.000000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
8 + 34 + 33 + 26 - 34 - 38 + 39 - 7 - 27
output:
0.562500000000
result:
ok found '0.562500000', expected '0.562500000', error '0.000000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
2 + 12345135 - 12345135
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 + 4 - 3
output:
1.000000000000
result:
ok found '1.000000000', expected '1.000000000', error '0.000000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
2 - 3 + 4
output:
1.000000000000
result:
ok found '1.000000000', expected '1.000000000', error '0.000000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
2 - 12 + 11
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 + 7 - 9
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
2 - 4 + 4
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #10:
score: 0
Accepted
time: 42ms
memory: 7896kb
input:
1000000 + 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 - 1 + 1 - 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 - 1 - 1 - 1 + 1 - 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 - 1 + 1 + 1 - 1 + 1 + 1 - 1 + 1 - 1 + 1 + 1 + 1 + 1 + 1 - 1 - 1 + 1 ...
output:
0.000000000000
result:
ok found '0.000000000', expected '0.000000000', error '-0.000000000'
Test #11:
score: 0
Accepted
time: 52ms
memory: 8016kb
input:
999999 + 2 - 1 + 1 - 2 + 2 - 1 - 1 + 1 - 2 + 2 - 1 - 2 + 1 - 2 - 1 + 2 - 2 - 1 - 1 - 2 + 2 + 1 - 1 - 2 + 2 + 1 - 1 - 1 + 2 - 2 + 2 - 1 + 1 + 1 - 2 + 2 + 1 + 2 + 1 + 2 - 2 + 1 - 2 + 1 - 2 + 2 + 2 - 1 - 1 - 1 + 2 + 1 + 2 - 1 - 1 - 2 + 2 - 1 + 2 - 2 - 2 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 1 - 2 - 2 - 1 - 1 -...
output:
0.249738137353
result:
ok found '0.249738137', expected '0.249738137', error '0.000000000'
Test #12:
score: 0
Accepted
time: 49ms
memory: 8032kb
input:
1000000 + 2 + 1 - 2 - 1 + 2 - 1 + 1 + 1 - 1 + 2 - 2 + 1 + 2 - 1 - 2 - 1 + 2 + 1 + 2 - 1 - 2 - 2 - 1 - 1 + 1 - 1 - 1 - 1 - 1 - 2 - 1 + 2 - 1 + 1 - 1 + 2 + 1 + 1 - 2 + 1 + 1 + 2 - 2 - 2 - 1 - 1 - 1 + 2 + 2 + 1 - 1 + 2 - 1 + 2 - 2 + 1 - 1 + 1 + 2 + 1 - 1 + 1 + 1 + 2 - 2 + 2 + 2 - 1 + 1 - 2 + 2 + 1 + 1 ...
output:
0.249491781899
result:
ok found '0.249491782', expected '0.249491782', error '0.000000000'
Test #13:
score: 0
Accepted
time: 90ms
memory: 8036kb
input:
999999 + 20 - 6 + 13 - 20 - 19 + 17 + 13 - 8 + 3 + 6 - 17 + 17 + 16 - 16 + 8 + 11 - 7 - 20 - 13 + 6 - 7 + 19 + 10 - 5 - 9 - 16 - 17 + 13 + 7 + 18 - 17 + 13 + 16 + 10 + 17 - 9 - 6 + 11 - 7 + 8 - 5 + 20 - 18 + 1 + 8 - 9 + 4 + 5 + 14 - 11 - 15 - 8 - 7 - 7 + 15 + 15 + 8 - 3 + 13 - 5 + 9 - 14 + 6 - 8 + 3...
output:
0.474153711501
result:
ok found '0.474153712', expected '0.474153712', error '0.000000000'
Test #14:
score: 0
Accepted
time: 89ms
memory: 7980kb
input:
1000000 + 22 - 6 + 13 - 20 - 19 + 24 + 24 - 15 + 17 + 3 + 23 + 20 - 17 + 23 + 16 - 21 - 22 + 8 + 11 - 23 + 17 - 24 - 13 + 6 - 7 + 19 + 21 - 14 + 18 - 22 - 11 - 21 - 21 + 13 + 24 + 20 + 18 - 17 + 13 + 16 + 10 + 25 - 24 - 14 + 7 - 15 + 22 + 8 - 5 + 20 - 18 + 1 + 8 - 9 + 4 + 25 + 1 - 9 - 9 - 14 + 14 + ...
output:
0.479541696161
result:
ok found '0.479541696', expected '0.479541696', error '0.000000000'
Test #15:
score: 0
Accepted
time: 887ms
memory: 8260kb
input:
999999 - 595 + 975 + 320 - 300 + 871 - 170 + 103 - 360 + 868 - 631 - 851 - 509 + 725 + 627 - 983 - 63 - 845 + 367 + 1000 - 980 - 846 - 605 - 987 + 582 - 367 - 724 - 579 + 944 + 566 - 873 - 889 - 991 + 562 + 209 + 625 + 328 - 463 + 673 + 77 + 365 - 275 + 667 - 424 - 85 + 942 + 504 + 447 - 90 + 780 + ...
output:
0.500354941226
result:
ok found '0.500354941', expected '0.500354941', error '0.000000000'
Test #16:
score: 0
Accepted
time: 875ms
memory: 8248kb
input:
1000000 - 18 - 59 - 824 + 193 - 373 - 462 - 707 + 765 - 285 - 664 + 186 - 374 - 360 + 295 - 339 + 144 - 88 + 96 - 103 + 809 - 453 - 624 - 509 - 435 + 158 + 503 + 160 + 194 - 579 + 135 - 276 + 605 - 564 - 549 - 219 - 246 - 399 - 893 + 166 + 749 - 551 + 729 + 787 - 507 + 563 + 222 + 767 - 117 - 232 - ...
output:
0.499615806802
result:
ok found '0.499615807', expected '0.499615807', error '0.000000000'
Test #17:
score: -100
Time Limit Exceeded
input:
999999 + 649917 - 505960 - 144512 - 570407 + 262265 - 623272 + 743202 - 886356 - 199591 + 951022 + 966769 + 770209 + 256025 - 118843 + 168738 + 516944 + 160812 - 283717 + 254929 - 442969 - 897288 + 74809 - 419482 - 845143 - 967020 + 883637 - 767990 - 173181 + 230007 + 638724 - 950239 + 836557 + 7156...