QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#373839#8255. Room Temperaturelmeowdn#100 ✓49ms7972kbC++141.5kb2024-04-02 08:42:022024-07-04 03:33:04

Judging History

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

  • [2024-07-04 03:33:04]
  • 评测
  • 测评结果:100
  • 用时:49ms
  • 内存:7972kb
  • [2024-04-02 08:42:02]
  • 提交

answer

//Shirasu Azusa 2024.3
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef double ld;
typedef long long ll;
typedef unsigned long long ull;
template<typename T,typename U>
T ceil(T x, U y) {return (x>0?(x+y-1)/y:x/y);}
template<typename T,typename U>
T floor(T x, U y) {return (x>0?x/y:(x-y+1)/y);}
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}
int popcnt(int x) {return __builtin_popcount(x);}
int popcnt(ll x)  {return __builtin_popcountll(x);}
int topbit(int x) {return (x==0?-1:31-__builtin_clz(x));}
int topbit(ll x)  {return (x==0?-1:63-__builtin_clzll(x));}
int lowbit(int x) {return (x==0?-1:__builtin_ctz(x));}
int lowbit(ll x)  {return (x==0?-1:__builtin_ctzll(x));}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vp;
typedef tuple<int,int,int> tiii;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;
}

const int N=5e5+5;
int n,a[N],T,ans;
signed main() {
  n=read(), T=read();
  rep(i,1,n) a[i]=read(), a[i]%=T;
  sort(a+1,a+n+1);
  ans=(a[n]-a[1]+1)/2;
  rep(i,2,n+1) chmin(ans,(a[i-1]+T-a[i]+1)/2);
  printf("%lld\n",ans);
  return 0;
}

详细

Subtask #1:

score: 15
Accepted

Test #1:

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

input:

2 1000000000
870851814 881870957

output:

5509572

result:

ok 1 number(s): "5509572"

Test #2:

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

input:

2 2691
205734472 599908142

output:

660

result:

ok 1 number(s): "660"

Test #3:

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

input:

2 1000000000
594215883 41345726

output:

223564922

result:

ok 1 number(s): "223564922"

Test #4:

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

input:

2 2691
667489049 282547821

output:

470

result:

ok 1 number(s): "470"

Test #5:

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

input:

2 1000000000
263981200 857652688

output:

203164256

result:

ok 1 number(s): "203164256"

Test #6:

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

input:

2 2691
938568750 473949653

output:

445

result:

ok 1 number(s): "445"

Test #7:

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

input:

2 1000000000
40944021 145199528

output:

52127754

result:

ok 1 number(s): "52127754"

Test #8:

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

input:

2 2691
907627168 852663911

output:

209

result:

ok 1 number(s): "209"

Test #9:

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

input:

2 1
1 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

2 1
999999999 1

output:

0

result:

ok 1 number(s): "0"

Subtask #2:

score: 5
Accepted

Test #11:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

3000 1
527962400 375396162 403550632 368119563 98122336 575071005 735930417 713872349 126691431 587408550 68301442 78445831 779182574 900615066 540352310 97512141 56370167 875603720 977151830 187655072 321929392 68890256 341544318 18277276 427645487 5442872 264570852 285260601 560506154 919011927 20...

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

3000 1
125514453 768659053 486755528 299945084 862360713 8675510 858615908 36113622 852434719 631544026 152565003 248475502 152208269 372824161 605166385 947406972 22495491 16144197 428103403 540600274 825892700 402884826 869448753 21131099 563254083 482692292 836456471 136772702 161953814 632591878...

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

500 1
877137499 911480798 105327978 808804265 727937304 637853446 718031798 765195806 838206927 484239981 607467844 605792967 38697323 332194610 273988993 323047109 798562931 435509933 372308228 443534704 707117313 487932300 211775548 761591411 77454451 882287790 277784787 263090914 819288580 176177...

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

3000 1
302072813 159511621 389241523 87239051 654013995 612092525 811507271 759331557 82587805 4610835 527337463 225987819 848995387 369192513 837790413 257183405 827634015 124043241 120492531 441525119 740937 215335731 287893333 646763119 353975191 806994341 813045851 410859105 603701099 713224409 ...

output:

0

result:

ok 1 number(s): "0"

Test #15:

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

input:

500 1
81888042 43067133 107207954 11840122 12213120 1564709 591852273 88838690 961663051 516561909 168803248 844631608 873195256 827482724 743609376 619362989 538294587 82184630 144127319 243409882 211682139 271003483 663591071 168473717 654369346 16498799 591919038 700712177 385773734 618206739 813...

output:

0

result:

ok 1 number(s): "0"

Subtask #3:

score: 30
Accepted

Dependency #2:

100%
Accepted

Test #16:

score: 30
Accepted
time: 0ms
memory: 3784kb

input:

3000 2
885745611 864341459 300047319 287916141 644603625 884166447 590534965 653358937 990188463 990316905 558306521 980116759 553013905 519316677 185497721 825112521 474133783 274235087 415114857 272795329 667603077 923296831 577923973 907451785 74744583 582644091 637370755 55344013 145242745 11163...

output:

0

result:

ok 1 number(s): "0"

Test #17:

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

input:

3000 2
815254336 124748890 922650362 491188496 844408566 4477401 897872910 543206825 520044175 152252928 137325742 296978488 94941447 128102092 232850362 442060951 176696075 19548785 80969000 215525942 924301170 837296603 303165509 108844385 266183198 990018404 686038287 219436341 911589193 14746520...

output:

1

result:

ok 1 number(s): "1"

Test #18:

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

input:

500 2
401665219 27125575 775455335 839862311 960668465 238565856 738888265 901690231 304617077 103869276 209825343 618624634 605291100 268367109 261071747 998379490 704657059 187305917 910307778 870658986 536558030 6581819 190056964 211565999 892305820 620959159 360551386 791369750 697844538 6282286...

output:

1

result:

ok 1 number(s): "1"

Test #19:

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

input:

3000 2
522476642 810060218 147624038 855137278 915087104 81884778 525414244 894662888 410263396 941820940 423155602 520147790 615706710 710760688 226912160 596683116 203181268 324211490 679562872 268407934 204591892 80890276 839993536 16090044 796081826 673760802 901037356 780466340 43952110 3614940...

output:

0

result:

ok 1 number(s): "0"

Test #20:

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

input:

500 2
401575885 412743311 771792855 497402889 589191539 886766329 406659227 453993629 496243093 779810717 930633301 930956619 242644227 356605399 364800377 126585217 707620365 253271779 307180205 20790719 91049019 110549957 578458983 224326281 202269525 831044405 944165261 175228805 838484973 876412...

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

3000 2
303563168 71740834 195834514 3380992 22250404 75355492 9181252 637320910 700179430 343368856 609982580 819446272 657025786 417130700 869124046 29260574 635565794 960260466 88361168 62855338 937906970 272056128 691558732 38964352 156445024 972341020 952652654 209319766 866597994 310506834 8648...

output:

0

result:

ok 1 number(s): "0"

Test #22:

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

input:

3000 2
354850469 308022921 982030052 204243429 81359634 396352087 818660632 346171682 414089414 858843314 833282674 666064122 822445534 820666553 65489973 666985874 349651060 420770828 851434715 109309679 326719078 292037079 553269053 165517023 457752713 386379859 34971829 142091597 181586420 199000...

output:

1

result:

ok 1 number(s): "1"

Test #23:

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

input:

500 2
203412544 61851007 586535587 486968143 875369021 985875249 316089162 929955174 401867218 186579046 471528419 82273912 962932206 269786079 680174046 836866080 761653128 283496098 474840952 11671544 148873680 913438388 102086606 188883488 192992369 187379128 552781119 473926266 433670893 2121962...

output:

1

result:

ok 1 number(s): "1"

Test #24:

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

input:

3000 2
68755410 923083310 590388927 432449601 829287927 156119923 831497540 435929505 202167093 259654068 823404393 366667751 387824239 255289399 474809364 311198520 223107837 18229805 206717099 58481453 562234436 251622772 215421828 775829160 630537818 120589081 704348542 84404675 973185256 1896456...

output:

1

result:

ok 1 number(s): "1"

Test #25:

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

input:

500 2
398516650 938858974 267530994 514280855 599861463 585730873 708929375 981837909 821418825 964204380 702106030 787046858 954738784 93005000 423786944 361707689 817985175 354667355 531023809 937831653 751111899 882967067 829961299 869476136 196715580 479362190 377271787 67536934 231224157 225451...

output:

1

result:

ok 1 number(s): "1"

Subtask #4:

score: 35
Accepted

Dependency #3:

100%
Accepted

Test #26:

score: 35
Accepted
time: 1ms
memory: 4016kb

input:

3000 3000
533153071 239070382 708344889 674533552 483802927 296899924 329086 80884554 732953835 62102396 940008178 492401942 781501549 216632603 706953056 20746870 92094171 384067282 621705878 480022796 695971496 146935760 479123274 831630107 278433192 534994849 102542881 278470399 551357803 6073189...

output:

1496

result:

ok 1 number(s): "1496"

Test #27:

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

input:

42 3000
754274998 822961596 932465876 339412345 177684528 963952164 141030764 517806972 680542461 968488186 80253359 782540517 56441822 356863563 600705089 728862566 319632076 362033128 807266164 872727071 658130967 851081128 980844898 361681389 206524648 205561797 386232279 672567842 956335507 1787...

output:

1324

result:

ok 1 number(s): "1324"

Test #28:

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

input:

3000 42
354854941 822325099 524749982 990951393 151897977 122977243 542161994 655100949 657272310 978121545 673586877 210362436 221729103 655831609 607486955 634591549 990298100 733294844 496109191 729492128 502001539 582808377 945935328 756682179 536380863 659042891 466968394 858574147 894569965 35...

output:

21

result:

ok 1 number(s): "21"

Test #29:

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

input:

3000 3000
341 1006 1626 1994 1995 2767 928709780 489934049 973950233 34045023 570451389 622069514 925369591 994101097 518157214 982962074 471463087 576145296 369286010 685863008 39459065 764734433 89921876 382849272 155995295 856789469 354343509 374863173 341451236 81026972 710563117 380432893 97200...

output:

1114

result:

ok 1 number(s): "1114"

Test #30:

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

input:

3000 3000
154 543 986 1058 2068 2356 76975978 571609787 429155934 191832099 653094554 286657063 149264888 416591665 938459865 900094061 802815011 561845952 560703869 937912361 696240096 442755866 47886766 610158837 970105542 63467008 628984153 45092877 913119895 508992798 723808880 845194104 8414800...

output:

1306

result:

ok 1 number(s): "1306"

Test #31:

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

input:

3000 3000
867812036 605396783 654104856 32282887 301964616 48878673 607454640 165020919 31454939 62189200 460280407 485405181 57098764 321542252 107039982 909005296 835574151 251516202 47750439 559625154 618752748 666191811 29093705 699404815 120530719 403025483 197741673 777620225 258203676 4154908...

output:

482

result:

ok 1 number(s): "482"

Test #32:

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

input:

3000 3000
111553216 530301520 489590335 181438307 95628580 136221843 554198672 776918628 395824037 659551027 339165394 946668392 761257603 673427641 936608620 356228954 829564142 267297718 773462389 842276300 173454539 159026437 820723252 291558526 494685862 811904787 727049878 388121105 683760572 3...

output:

1495

result:

ok 1 number(s): "1495"

Test #33:

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

input:

42 3000
771491221 728682918 430527432 600092582 297642202 977456633 764136477 562632695 717105791 890157410 306932665 820288030 773111500 849977588 963538571 804358075 705347182 733581358 537602342 64209887 374454962 207795851 16039161 908676658 803633305 90259469 393018087 790843506 857591734 14204...

output:

1324

result:

ok 1 number(s): "1324"

Test #34:

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

input:

3000 42
565202812 947984705 153915530 131046786 606381431 868085234 565035708 820745652 636886530 158249879 344249999 80730146 10849647 190176769 407396863 846442654 262129931 996836276 764872530 631148468 339347288 131889397 894286206 945772653 880702362 61935197 52356595 396688994 264344342 230627...

output:

21

result:

ok 1 number(s): "21"

Subtask #5:

score: 15
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #35:

score: 15
Accepted
time: 40ms
memory: 7860kb

input:

500000 1000000000
630508671 110404795 845304804 982383111 410629108 882479561 660871876 938901329 896704981 68655143 438642844 366107936 79487854 78479257 198921400 44557534 220128219 663177963 597033974 418707953 520947143 423646478 594525906 974489220 330237089 109614240 231725216 110016856 391564...

output:

499986203

result:

ok 1 number(s): "499986203"

Test #36:

score: 0
Accepted
time: 40ms
memory: 7608kb

input:

500000 899999999
758790772 65219209 803678182 257220196 583153581 477033725 656490226 895818859 830546477 68959827 365195829 726396612 870590319 62904645 880043932 549071994 576870944 683290117 425402284 623804512 704736422 628779549 201199112 518558048 727583157 32994164 337061105 264817873 7256567...

output:

449988000

result:

ok 1 number(s): "449988000"

Test #37:

score: 0
Accepted
time: 49ms
memory: 7860kb

input:

500000 700000000
950809989 62641797 281111253 549007973 921371769 211524583 461054497 373512510 225759601 131096872 500373374 896513323 654674343 442928672 404045678 188093439 304803385 938661583 204198415 550531619 441745123 51911373 817967287 115259616 384582853 216859992 304717175 821338552 37137...

output:

349988151

result:

ok 1 number(s): "349988151"

Test #38:

score: 0
Accepted
time: 45ms
memory: 7688kb

input:

500000 500000
279294319 950932496 540186765 535758038 400370138 180901011 45412668 349183770 250716345 855133530 521590113 406050235 834905519 248600139 756742860 262084301 245402416 371533741 280303251 607809033 819107461 761788011 986363810 565285555 355754507 156055995 108553464 902045232 9814889...

output:

249993

result:

ok 1 number(s): "249993"

Test #39:

score: 0
Accepted
time: 44ms
memory: 7892kb

input:

500000 1000000000
25444564 192432836 398562796 582216457 611733883 828656565 18003286 305686313 928328803 950241185 985040617 246271659 953316116 926240320 388712712 943344243 890328989 267042743 970404377 304815155 207159116 359249707 328365934 924197598 280572125 328310094 966956489 198410945 2361...

output:

391538659

result:

ok 1 number(s): "391538659"

Test #40:

score: 0
Accepted
time: 48ms
memory: 7972kb

input:

500000 899999999
29450564 359058189 470102912 493428816 538996572 593526027 871559785 424442109 995859 798965269 364658184 721716190 460438126 691596706 736243543 456163154 381474774 857911136 880038303 506402255 535238481 656927793 502974334 431439210 627571895 411067376 895258950 857986863 8729473...

output:

285196187

result:

ok 1 number(s): "285196187"

Test #41:

score: 0
Accepted
time: 48ms
memory: 7608kb

input:

500000 700000000
36745043 399793810 405259494 505349389 607941651 670746511 687288769 600020584 698360890 598891379 540911548 690462874 7686838 596449063 400257004 676393342 562918479 578621860 566477742 594068778 602279129 709897981 679406629 404814556 539240070 563582814 603903225 607372441 518891...

output:

168475617

result:

ok 1 number(s): "168475617"

Test #42:

score: 0
Accepted
time: 44ms
memory: 7700kb

input:

500000 500000
7524 229753 269024 289454 365928 392573 299001199 466915267 288758977 437235548 687796504 869469941 926986746 836920999 348938062 251909726 818246512 41339501 54402051 849409002 507005025 440903428 517811955 541852078 17742588 366333116 635250445 644453987 62249855 997921599 623939469 ...

output:

138886

result:

ok 1 number(s): "138886"

Test #43:

score: 0
Accepted
time: 48ms
memory: 7696kb

input:

500000 5000000
518631014 754620183 264496362 964193184 724748607 183654311 668854172 538994419 84844007 354020450 678793908 598922388 853746285 34003743 888636572 974791715 68719411 703956189 203907410 284831533 954672057 169129107 689466532 434219104 39376414 504816684 739433437 228671046 39671921 ...

output:

684492

result:

ok 1 number(s): "684492"

Extra Test:

score: 0
Extra Test Passed