QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#227389#6801. BlackjackjzhWA 151ms7752kbC++141.2kb2023-10-27 13:53:022023-10-27 13:53:02

Judging History

你现在查看的是最新测评结果

  • [2023-10-27 13:53:02]
  • 评测
  • 测评结果:WA
  • 用时:151ms
  • 内存:7752kb
  • [2023-10-27 13:53:02]
  • 提交

answer

#include <bits/stdc++.h>
#define perr(a...) fprintf(stderr, a)
#define dbg(a...) perr("\033[32;1m"), perr(a), perr("\033[0m")
template <class T, class U>
inline bool smin(T &x, const U &y) {
  return y < x ? x = y, 1 : 0;
}
template <class T, class U>
inline bool smax(T &x, const U &y) {
  return x < y ? x = y, 1 : 0;
}
 
using LL = long long;
using PII = std::pair<int, int>;
 
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n, a, b;
  std::cin >> n >> a >> b;
  std::vector<std::vector<double>> f(1, std::vector<double>(b + 1)), g;
  f[0][0] = 1;
  std::vector<int> v(n);
  for (auto &x : v) {
    std::cin >> x;
    f.emplace_back(b + 1);
    for (int i = f.size() - 1; i; i--) {
      for (int j = b; j >= x; j--) {
        f[i][j] += f[i - 1][j - x] / (n - i + 1) * i;
      }
    }
  }
  double ans = 0;
  for (auto x : v) {
    g = f;
    for (int i = 1; i <= n; i++)
      for (int j = x; j <= b; j++) {
        g[i][j] -= g[i - 1][j - x] / (n - i + 1) * i;
      }
    for (int i = 0; i < n; i++) {
      for (int j = std::max(a + 1, x); j - x <= a && j <= b; j++) {
        ans += g[i][j - x] / (n - i);
      }
    }
  }
  printf("%.10f\n", ans);
  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3728kb

input:

5 2 4
1 1 1 5 5

output:

0.1000000000

result:

ok found '0.1000000', expected '0.1000000', error '0.0000000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

5 2 4
1 1 1 3 5

output:

0.4500000000

result:

ok found '0.4500000', expected '0.4500000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

18 10 11
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

output:

0.0000000000

result:

ok found '0.0000000', expected '-0.0000000', error '-0.0000000'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

14 15 16
3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

7 20 23
4 4 4 4 4 4 4

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

10 25 27
5 5 5 5 5 5 5 5 5 5

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3780kb

input:

6 30 35
6 6 6 6 6 6

output:

0.0000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

9 35 36
7 7 7 7 7 7 7 7 7

output:

0.0000000000

result:

ok found '0.0000000', expected '-0.0000000', error '-0.0000000'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

14 33 40
8 8 8 8 8 8 8 8 8 8 8 8 8 8

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

7 43 45
9 9 9 9 9 9 9

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

7 49 50
10 10 10 10 10 10 10

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

7 49 55
11 11 11 11 11 11 11

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

16 53 60
12 12 12 12 12 12 12 12 12 12 12 12 12 12 12 12

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

16 53 65
13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

10 55 60
8 2 8 10 8 8 1 2 8 10

output:

0.5638888889

result:

ok found '0.5638889', expected '0.5638889', error '0.0000000'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3740kb

input:

10 38 43
5 8 1 9 7 2 1 9 3 1

output:

0.4888888889

result:

ok found '0.4888889', expected '0.4888889', error '0.0000000'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

10 49 52
8 2 8 10 6 2 10 5 1 5

output:

0.3861111111

result:

ok found '0.3861111', expected '0.3861111', error '0.0000000'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

10 44 49
3 10 3 2 7 5 5 10 5 4

output:

0.6777777778

result:

ok found '0.6777778', expected '0.6777778', error '0.0000000'

Test #19:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

10 54 58
5 9 8 2 4 3 8 7 7 6

output:

0.3000000000

result:

ok found '0.3000000', expected '0.3000000', error '0.0000000'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

10 46 49
2 2 3 9 9 3 4 5 7 7

output:

0.5000000000

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

10 50 51
10 9 10 4 8 2 1 1 2 10

output:

0.0575396825

result:

ok found '0.0575397', expected '0.0575397', error '0.0000000'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

10 35 39
8 6 4 1 3 1 9 6 2 3

output:

0.5888888889

result:

ok found '0.5888889', expected '0.5888889', error '0.0000000'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

10 62 64
10 8 7 4 4 7 10 10 8 1

output:

0.0444444444

result:

ok found '0.0444444', expected '0.0444444', error '0.0000000'

Test #24:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

10 40 41
2 2 2 4 6 4 4 6 5 10

output:

0.3666666667

result:

ok found '0.3666667', expected '0.3666667', error '0.0000000'

Test #25:

score: 0
Accepted
time: 144ms
memory: 7568kb

input:

500 392 500
21 90 87 268 118 213 27 34 32 41 186 21 116 237 110 219 115 117 118 407 298 123 111 170 273 451 273 206 122 333 249 85 53 414 254 71 305 2 287 370 440 397 158 471 406 425 161 200 355 338 44 421 27 132 236 439 428 353 22 125 269 208 373 130 213 272 403 203 60 127 378 126 383 417 320 439 9...

output:

0.4703330828

result:

ok found '0.4703331', expected '0.4703331', error '0.0000000'

Test #26:

score: 0
Accepted
time: 110ms
memory: 7572kb

input:

500 486 500
133 197 245 112 78 52 362 132 225 275 182 299 152 444 464 119 292 119 198 416 401 292 435 38 9 479 431 222 367 175 315 350 27 405 377 61 494 201 494 242 107 437 207 482 472 456 18 12 43 495 220 315 191 454 398 123 449 334 438 225 210 311 431 34 54 244 91 41 396 95 169 107 273 457 164 12 ...

output:

0.0809303363

result:

ok found '0.0809303', expected '0.0809303', error '0.0000000'

Test #27:

score: 0
Accepted
time: 131ms
memory: 7752kb

input:

500 407 500
6 211 284 430 421 209 460 45 31 37 204 330 179 10 440 469 312 197 143 137 472 71 386 387 22 361 407 350 220 258 295 231 84 115 9 282 383 280 437 360 235 428 213 237 151 14 401 304 493 15 356 391 171 61 240 475 125 187 207 398 205 324 312 491 188 461 320 451 208 413 402 117 340 234 270 48...

output:

0.4134767527

result:

ok found '0.4134768', expected '0.4134767', error '0.0000000'

Test #28:

score: 0
Accepted
time: 123ms
memory: 7684kb

input:

500 466 500
306 462 90 122 193 369 198 178 188 452 327 285 290 430 114 47 469 256 132 169 235 396 123 68 438 270 147 496 319 25 192 141 433 388 326 329 344 325 165 38 53 136 413 77 365 165 448 78 330 76 77 442 426 64 71 470 76 473 497 233 332 218 114 479 77 496 35 4 233 431 376 66 360 499 447 213 31...

output:

0.1690965152

result:

ok found '0.1690965', expected '0.1690965', error '0.0000000'

Test #29:

score: 0
Accepted
time: 122ms
memory: 7740kb

input:

500 442 500
396 224 234 493 9 385 449 297 90 298 231 361 124 431 91 37 123 472 427 421 204 407 235 89 141 433 387 252 421 46 378 20 79 120 390 342 149 451 437 432 298 294 206 24 170 383 393 499 492 85 310 263 384 95 308 259 135 4 469 371 111 412 245 127 394 61 447 160 30 88 189 339 58 403 195 407 47...

output:

0.2782330669

result:

ok found '0.2782331', expected '0.2782331', error '0.0000000'

Test #30:

score: 0
Accepted
time: 84ms
memory: 7224kb

input:

500 437 457
30 37 34 25 29 11 8 24 40 29 3 38 33 17 36 30 49 10 10 40 20 9 37 29 36 15 45 41 35 33 3 15 3 45 26 23 11 30 28 1 23 14 20 41 21 50 9 31 29 31 383 365 460 290 294 309 328 378 480 268 447 332 419 401 283 440 272 309 295 401 450 306 299 474 467 271 468 394 362 441 483 465 341 447 384 430 4...

output:

0.0931743777

result:

ok found '0.0931744', expected '0.0931742', error '0.0000002'

Test #31:

score: 0
Accepted
time: 87ms
memory: 7324kb

input:

500 437 446
41 20 12 14 37 44 10 43 23 48 5 42 12 17 48 7 12 23 43 23 32 11 38 35 17 39 25 18 4 11 32 44 23 46 18 22 30 15 45 15 48 19 12 49 34 31 20 28 5 23 35 23 3 5 32 44 29 8 30 40 31 19 37 8 1 28 29 20 34 26 37 44 9 49 45 20 24 20 12 44 20 43 40 44 5 27 26 32 26 4 7 37 1 42 43 14 11 36 6 11 16 ...

output:

0.0580672655

result:

ok found '0.0580673', expected '0.0580671', error '0.0000002'

Test #32:

score: 0
Accepted
time: 102ms
memory: 7124kb

input:

500 409 439
21 46 39 13 29 6 17 38 44 48 24 3 12 30 6 20 26 21 48 1 11 50 27 44 37 48 3 24 33 39 5 15 43 41 8 42 37 24 6 6 16 2 10 44 25 19 19 27 40 33 50 4 28 20 12 14 6 22 35 33 20 48 30 37 31 21 25 28 29 40 23 39 14 32 42 25 15 36 33 39 16 20 30 3 22 48 7 39 11 46 1 17 18 7 42 10 38 47 1 41 21 9 ...

output:

0.1836244776

result:

ok found '0.1836245', expected '0.1836244', error '0.0000001'

Test #33:

score: 0
Accepted
time: 103ms
memory: 7228kb

input:

500 419 440
33 6 39 33 25 13 29 5 16 27 5 21 8 8 34 45 28 10 48 45 29 48 5 48 17 32 28 44 30 10 21 38 13 9 8 33 3 29 42 9 49 35 15 16 12 18 50 39 44 1 22 37 44 40 44 49 38 8 5 42 29 16 10 4 41 4 37 26 30 48 5 41 8 42 3 34 40 9 30 16 5 40 30 1 39 26 37 2 30 42 27 17 14 43 7 19 9 14 6 24 28 26 13 30 2...

output:

0.1821539827

result:

ok found '0.1821540', expected '0.1821539', error '0.0000001'

Test #34:

score: 0
Accepted
time: 118ms
memory: 7380kb

input:

500 419 453
27 27 17 1 35 27 32 5 45 41 32 49 26 4 24 38 41 7 34 41 39 20 15 33 9 13 46 14 49 37 19 48 6 21 8 10 15 16 40 15 13 8 31 34 44 4 9 18 26 29 16 32 46 17 30 44 26 20 40 18 27 9 20 22 30 42 38 19 29 28 45 2 30 36 44 10 4 15 23 37 30 17 40 16 38 39 36 30 2 6 37 20 2 42 7 25 28 25 10 5 29 43 ...

output:

0.3879850267

result:

ok found '0.3879850', expected '0.3879850', error '0.0000000'

Test #35:

score: 0
Accepted
time: 2ms
memory: 3824kb

input:

137 68 69
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 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:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #36:

score: 0
Accepted
time: 3ms
memory: 4016kb

input:

190 95 96
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 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:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #37:

score: 0
Accepted
time: 151ms
memory: 7748kb

input:

500 100 500
182 99 112 84 20 163 11 38 36 189 73 173 72 31 124 32 161 104 77 75 81 73 44 29 33 31 111 133 47 153 18 139 167 88 50 74 163 165 119 62 8 42 157 29 54 33 44 2 152 197 2 175 88 190 62 159 115 17 127 86 6 62 117 174 16 74 27 27 146 56 82 88 77 110 83 63 121 33 152 42 133 63 133 83 30 37 13...

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #38:

score: 0
Accepted
time: 150ms
memory: 7744kb

input:

500 100 500
168 41 109 58 52 29 113 58 136 158 5 70 192 67 74 150 31 34 39 156 31 146 138 123 12 162 83 176 152 34 98 143 174 41 109 99 137 121 38 155 140 195 27 153 129 1 38 92 142 20 163 158 95 199 70 163 51 197 163 123 157 131 177 167 142 5 141 122 148 115 127 42 118 86 136 167 99 136 100 140 123...

output:

1.0000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #39:

score: 0
Accepted
time: 117ms
memory: 7452kb

input:

500 483 484
156 186 181 195 180 175 110 102 170 150 142 121 179 144 129 123 137 139 107 150 147 155 121 194 195 158 129 119 187 132 174 175 123 102 122 161 157 194 144 119 102 166 129 200 189 162 159 158 125 105 178 111 126 181 168 136 111 175 160 166 148 176 160 193 102 183 117 113 110 115 124 121 ...

output:

0.0072122376

result:

ok found '0.0072122', expected '0.0072122', error '0.0000000'

Test #40:

score: 0
Accepted
time: 114ms
memory: 7452kb

input:

500 481 484
114 188 148 119 131 116 157 148 171 156 178 179 157 139 112 130 191 174 150 151 181 117 138 146 129 112 169 174 103 116 121 164 107 147 127 109 165 103 118 139 114 105 192 135 142 167 192 178 196 192 150 184 158 119 164 144 141 152 187 123 132 145 111 109 190 196 199 134 173 161 119 104 ...

output:

0.0215630373

result:

ok found '0.0215630', expected '0.0215630', error '0.0000000'

Test #41:

score: 0
Accepted
time: 113ms
memory: 7464kb

input:

500 481 484
197 191 114 128 148 182 169 162 200 124 154 194 138 186 117 200 112 157 157 182 110 119 107 151 112 125 119 179 132 112 113 150 196 122 182 148 185 127 182 140 192 169 113 153 111 195 147 140 176 153 147 114 142 130 182 146 186 143 168 138 113 138 200 184 184 101 196 195 111 136 125 158 ...

output:

0.0226963028

result:

ok found '0.0226963', expected '0.0226963', error '0.0000000'

Test #42:

score: 0
Accepted
time: 119ms
memory: 7628kb

input:

500 483 484
151 173 124 138 159 120 139 154 167 106 108 138 149 186 155 160 110 177 116 135 145 195 124 125 134 117 133 184 181 162 107 118 200 153 163 177 118 167 173 171 152 120 139 179 161 122 160 120 153 182 137 200 115 173 198 182 140 101 104 196 113 166 117 148 198 104 133 107 157 104 192 132 ...

output:

0.0072130408

result:

ok found '0.0072130', expected '0.0072130', error '0.0000000'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

44 42 43
2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2

output:

0.5000000000

result:

ok found '0.5000000', expected '0.5000000', error '0.0000000'

Test #44:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

43 43 44
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2

output:

0.4883720930

result:

ok found '0.4883721', expected '0.4883721', error '0.0000000'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

29 44 45
1 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.2241379311

result:

ok found '0.2241379', expected '0.2241379', error '0.0000000'

Test #46:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

29 45 46
1 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.5123152709

result:

ok found '0.5123153', expected '0.5123153', error '0.0000000'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

46 46 47
1 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.1314009662

result:

ok found '0.1314010', expected '0.1314010', error '0.0000000'

Test #48:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

47 47 49
1 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.8741905643

result:

ok found '0.8741906', expected '0.8741906', error '0.0000000'

Test #49:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

47 48 50
1 3 3 3 3 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.5975948196

result:

ok found '0.5975948', expected '0.5975948', error '0.0000000'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

26 49 51
1 3 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

output:

0.5815384614

result:

ok found '0.5815385', expected '0.5815385', error '0.0000000'

Test #51:

score: -100
Wrong Answer
time: 134ms
memory: 7576kb

input:

500 490 500
170 102 10 13 374 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 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:

207589441136124613049310514312290633447232853307853128754105349625140161369810140816197729761376223447277115539456.0000000000

result:

wrong answer 1st numbers differ - expected: '0.3994655', found: '207589441136124613049310514312290633447232853307853128754105349625140161369810140816197729761376223447277115539456.0000000', error = '20758944113612461304931051431229063344723285330785312875410534962514016136981014081619772976137622344...