QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#373838#8255. Room Temperaturelmeowdn#20 1ms6040kbC++141.5kb2024-04-02 08:40:232024-07-04 03:33:00

Judging History

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

  • [2024-07-04 03:33:00]
  • 评测
  • 测评结果:20
  • 用时:1ms
  • 内存:6040kb
  • [2024-04-02 08:40:23]
  • 提交

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); a[n+1]=a[1]+T;
  ans=(a[n]-a[1]+1)/2;
  rep(i,2,n+1) chmin(ans,(a[i]-a[i-1]+1)/2);
  printf("%lld\n",ans);
  return 0;
}

详细

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 6040kb

input:

2 1000000000
870851814 881870957

output:

5509572

result:

ok 1 number(s): "5509572"

Test #2:

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

input:

2 2691
205734472 599908142

output:

660

result:

ok 1 number(s): "660"

Test #3:

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

input:

2 1000000000
594215883 41345726

output:

223564922

result:

ok 1 number(s): "223564922"

Test #4:

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

input:

2 2691
667489049 282547821

output:

470

result:

ok 1 number(s): "470"

Test #5:

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

input:

2 1000000000
263981200 857652688

output:

203164256

result:

ok 1 number(s): "203164256"

Test #6:

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

input:

2 2691
938568750 473949653

output:

445

result:

ok 1 number(s): "445"

Test #7:

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

input:

2 1000000000
40944021 145199528

output:

52127754

result:

ok 1 number(s): "52127754"

Test #8:

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

input:

2 2691
907627168 852663911

output:

209

result:

ok 1 number(s): "209"

Test #9:

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

input:

2 1
1 1000000000

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

2 1
999999999 1

output:

0

result:

ok 1 number(s): "0"

Subtask #2:

score: 5
Accepted

Test #11:

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

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: 3788kb

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: 3724kb

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: 3996kb

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: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #16:

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

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: -30
Wrong Answer
time: 1ms
memory: 4008kb

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:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%