QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#701582 | #86. Mountain Ranges | TheZone | AC ✓ | 1ms | 3888kb | C++20 | 1.6kb | 2024-11-02 14:23:35 | 2024-11-02 14:23:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n, x; cin >> n >> x;
vector<int> v (n);
for(int i = 0; i < n; i++){
cin >> v[i];
}
ll ma = 1;
sort(v.begin(), v.end());
for(int i = 0; i < n; i++){
ll ant = v[i];
ll cont = 1;
for(int j = i+1; j < n ;j++){
if(v[j] - ant <= x)cont++;
else break;
ant = v[j];
}
ma = max(ma, cont);
}
cout << ma << "\n";
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
input:
9 2 3 14 15 92 653 5897 5897 5898 5900
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10 8847 5123 8848 8848 8848 8848 8848 8848 8848 8848 8848
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 8847 881 1239 2510 2559 3634 3832 4717 5912 6901 8174
output:
10
result:
ok single line: '10'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
100 8847 879 2164 3315 4363 4565 4593 5282 5315 5689 6084 6961 7565 8527 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 8848 88...
output:
100
result:
ok single line: '100'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
5 100 40 78 92 167 236
output:
5
result:
ok single line: '5'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
5 100 87 145 189 240 263
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
100 13 13 27 33 39 51 61 75 87 91 96 110 113 128 143 145 159 174 188 188 196 200 213 217 226 228 239 246 250 251 266 270 283 287 299 310 310 321 322 335 344 350 352 354 357 369 370 380 382 382 383 392 394 403 410 413 413 424 425 430 438 441 443 448 463 476 484 487 487 496 510 513 526 534 546 554 560...
output:
34
result:
ok single line: '34'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
100 17 12 12 21 31 32 41 57 67 86 94 107 108 116 123 138 149 163 167 175 179 179 186 199 216 225 242 243 249 259 271 279 288 290 296 302 307 317 332 346 348 349 362 379 388 402 408 411 424 432 434 451 454 472 485 500 519 522 523 533 550 564 574 592 598 611 615 622 623 628 643 656 657 658 658 662 681...
output:
44
result:
ok single line: '44'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
100 21 8 16 21 30 52 76 77 90 117 117 130 156 162 176 201 215 242 253 278 293 316 342 368 392 397 422 428 433 447 458 469 488 491 503 512 523 545 559 568 581 583 594 618 618 632 633 650 653 658 666 675 700 700 709 728 749 752 758 773 781 787 813 828 851 871 882 909 929 936 961 979 1002 1019 1031 103...
output:
11
result:
ok single line: '11'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
100 42 38 75 115 122 124 163 181 213 252 255 287 324 351 371 387 404 441 458 482 516 551 595 634 651 689 735 745 788 812 852 862 873 874 879 910 949 986 999 1010 1023 1064 1079 1080 1095 1136 1158 1188 1233 1248 1263 1282 1318 1320 1336 1381 1416 1424 1469 1501 1505 1524 1538 1572 1579 1600 1613 162...
output:
36
result:
ok single line: '36'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
9 0 3 14 15 92 653 5897 5897 5898 5900
output:
2
result:
ok single line: '2'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
9 8848 3 14 15 92 653 5897 5897 5898 5900
output:
9
result:
ok single line: '9'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
1000 8848 10 19 28 28 35 40 45 46 54 58 68 78 80 87 94 104 108 112 113 119 125 128 137 144 151 157 161 165 175 179 189 198 208 208 213 215 215 217 226 234 238 247 247 248 253 256 256 262 266 268 268 278 281 291 298 302 309 312 321 325 331 337 340 349 353 355 355 364 371 376 376 376 379 380 388 393 3...
output:
1000
result:
ok single line: '1000'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
1000 10 4 14 24 27 33 41 43 49 55 55 60 67 68 76 78 78 85 89 94 96 104 114 117 120 122 132 141 151 153 157 158 160 163 165 175 182 185 192 202 212 215 215 223 227 228 231 231 233 233 240 240 241 242 242 247 251 253 260 265 268 271 279 284 294 295 296 302 304 310 316 325 328 337 340 350 350 359 364 3...
output:
1000
result:
ok single line: '1000'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
1000 10 7 10 19 22 28 34 40 43 48 58 60 65 69 70 78 85 95 105 110 117 126 130 132 135 145 148 156 161 167 174 183 193 198 199 204 213 218 223 225 234 238 240 245 251 261 267 268 274 277 281 287 290 291 301 304 310 314 316 326 331 333 338 341 351 356 362 366 367 374 382 389 391 397 403 404 413 420 42...
output:
1000
result:
ok single line: '1000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
1000 10 11 11 12 15 17 21 23 30 37 37 40 48 49 58 63 68 78 82 87 97 100 104 109 115 120 128 137 141 152 154 156 165 166 170 180 187 191 200 206 210 211 219 224 234 239 248 256 267 273 281 286 291 293 297 303 312 321 332 339 347 350 354 354 355 365 373 379 387 397 405 406 413 413 423 427 435 442 451 ...
output:
47
result:
ok single line: '47'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1000 10 12 20 21 22 28 38 40 43 50 58 61 65 74 83 86 89 93 102 104 107 113 119 120 124 132 141 152 161 163 169 177 179 181 185 194 200 207 209 219 228 231 236 247 252 262 268 271 280 284 291 300 307 313 315 324 325 331 342 343 346 352 360 364 374 378 384 394 398 407 413 417 421 428 434 438 444 447 4...
output:
52
result:
ok single line: '52'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 8848 3094
output:
1
result:
ok single line: '1'