QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#66002 | #2379. Absolute Game | gyh20# | AC ✓ | 4ms | 3592kb | C++14 | 830b | 2022-12-05 16:50:10 | 2022-12-05 16:50:13 |
Judging History
answer
#include<bits/stdc++.h>
#define re register
using namespace std;
inline int read(){
re int t=0;re char v=getchar();
while(v<'0')v=getchar();
while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
return t;
}
const int M=998244353;
inline void add(re int &x,re int y){(x+=y)>=M?x-=M:x;}
inline int Mod(re int x){return x>=M?x-M:x;}
inline int ksm(re int x,re int y){
re int s=1;
while(y){
if(y&1)s=1ll*s*x%M;
x=1ll*x*x%M,y>>=1;
}
return s;
}
int n,a[1002],b[1002],ans;
int main(){
n=read(),ans=0;
for(re int i=1;i<=n;++i)a[i]=read();sort(a+1,a+n+1);
for(re int i=1;i<=n;++i)b[i]=read();sort(b+1,b+n+1);
if(n==1)return printf("%d",abs(a[1]-b[1])),0;
for(re int i=1;i<=n;++i){
re int s=1e9;
for(re int j=1;j<=n;++j)s=min(s,abs(a[i]-b[j]));
ans=max(ans,s);
}
printf("%d",ans);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3528kb
input:
4 2 14 7 14 5 10 9 22
output:
4
result:
ok single line: '4'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3328kb
input:
1 14 42
output:
28
result:
ok single line: '28'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3456kb
input:
1000 657869894 12244197 302751325 391063232 821704902 918351183 911667041 414131481 556158495 532207266 811890152 401118704 474105790 920464458 363136546 386056258 201743030 836389366 341427747 904710546 10486332 810273816 162407523 690627683 544009771 458562152 915779647 609419967 988646785 2829737...
output:
2619170
result:
ok single line: '2619170'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
999 751700952 917182298 226716276 440233084 547026439 414001531 447683043 500416199 569643794 324417098 208874154 52426717 709679461 31632125 671214192 913851838 631298947 385749247 240145969 99617246 543133825 577997422 626227388 630176679 774274696 822582430 511462709 986819829 323940694 362412692...
output:
3138267
result:
ok single line: '3138267'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
998 868584824 343633454 632935722 414603606 712901378 724298563 422943764 862264915 643676934 747145620 534613715 290866973 771879371 711838396 304019677 691179729 348051224 231501689 71747951 805577198 396070076 957849644 256344071 408302296 46928135 952272221 798368488 701362264 5259086 175145525 ...
output:
2911489
result:
ok single line: '2911489'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
997 690501400 475117314 188898272 683941425 733552124 179819786 842914885 814048223 422742779 464841438 860353275 379564126 129046577 832236155 82049354 613731812 919579310 77254130 198317229 661280253 543973624 777893355 741236562 891460617 24614278 522153501 790306971 120937403 981544774 282845655...
output:
3071191
result:
ok single line: '3071191'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
996 512417976 196535765 595117719 658311947 899427063 635341009 113142901 470864235 496775920 477504551 481060132 618004382 191246486 512442425 714854839 536283895 636331588 72749676 29919211 222016012 251685683 157745577 226129052 669586233 2300421 651843293 77212750 100321054 808087357 535769977 7...
output:
3713221
result:
ok single line: '3713221'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3344kb
input:
995 629301848 622986921 151080269 927649766 920077809 945638040 383370918 127680247 275841764 900233073 806799692 561477342 958479100 632840184 492884516 458835978 207859673 213469414 451455785 222943259 399589230 537597799 416054247 7520362 274953860 781533084 364118528 814863489 79340341 643470106...
output:
3598798
result:
ok single line: '3598798'
Test #9:
score: 0
Accepted
time: 4ms
memory: 3452kb
input:
994 451218423 754470780 557299715 461828800 645761259 401159263 508374743 784496259 54907609 617928891 132539252 94884895 315646306 313046455 270914193 381388060 219579247 913997664 283057767 783679019 252525482 767706917 341138226 785645979 547607299 56447068 356057011 234438628 200850220 751170236...
output:
3637314
result:
ok single line: '3637314'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3472kb
input:
993 273134999 326146128 963519162 731166618 811636198 561713190 73570055 736279567 833973453 630592004 898470301 38357855 523070408 728411510 608752382 598907439 86074628 54717401 114659749 784606266 105461733 147559140 826030716 563771596 525293442 776071452 642962790 803756871 882168612 563903070 ...
output:
4325419
result:
ok single line: '4325419'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3428kb
input:
992 95051575 457629988 519481712 705537141 832286944 17234414 903606584 98128283 908006594 348287822 224209861 422022303 585270317 408617780 681749355 376235330 802826906 755245651 241229026 640309321 813173793 822378658 310923207 46929917 797946881 905761244 634901273 928364714 298645788 671603200 ...
output:
3793940
result:
ok single line: '3793940'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
991 211935447 179048439 925701158 974874959 147904987 32564149 173834601 754944295 687072438 771016344 549949422 365495264 942437523 529015539 19587544 298787413 374354991 895965389 72831008 201045080 961077340 347455072 795815698 825055533 775633024 35451035 921807052 202715661 979964179 779303329 ...
output:
2468042
result:
ok single line: '2468042'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
990 33852023 605499595 186696413 804021289 313779925 488085372 739029914 411760307 466138283 783679458 875688982 603935520 4637433 209221810 797617221 221339496 386074565 301526343 199400286 201972327 814013592 727307294 130965084 162989662 753319167 310365019 208712831 917258096 956249867 887003459...
output:
3773051
result:
ok single line: '3773051'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
4 7 4 2 5 10 3 1 7
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
1000 908012381 850034661 850034661 850034661 822811907 366211223 936360140 936360140 936360140 936360140 290411189 850034661 850034661 629296439 737784819 629296439 711390561 711390561 850034661 822811907 629296439 737784819 936360140 737784819 711390561 908012381 822811907 936360140 290411189 71139...
output:
64262176
result:
ok single line: '64262176'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3528kb
input:
1000 475105033 244557589 178861532 373902935 373902935 742589466 933977280 107641598 674555020 874595919 244557589 678492067 778400053 631602529 874595919 739913457 631602529 303745231 424492764 85254225 982756999 573157221 400545930 745831091 612312865 276902058 474134153 908047787 631888507 823581...
output:
22369566
result:
ok single line: '22369566'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3400kb
input:
1000 793908229 994582982 686057013 999209232 839995191 465403642 183468351 292675951 927612154 397995303 533595208 494851931 172894305 25222061 634556856 656367575 388596442 183468351 270873941 639722350 105243704 42578157 496095623 197239853 324289025 673102105 957150668 421607936 364721897 9151836...
output:
6315050
result:
ok single line: '6315050'
Test #18:
score: 0
Accepted
time: 3ms
memory: 3392kb
input:
1000 261204164 136518741 34133743 187905913 224961366 687283178 839562920 907800978 955644665 498851656 882211314 840610246 868250348 583112079 919435433 452928689 29971181 732462088 589036106 613628220 310095405 529823561 406233924 98152302 823282611 69073198 754375615 954845470 364767145 874225573...
output:
5006180
result:
ok single line: '5006180'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
1000 600664750 597079878 861473054 630086938 867574566 607965116 432417360 4237940 793134206 108370903 1406552 160296738 502479242 427985313 471488853 807771900 347937270 892496384 743034464 934207481 357745598 183668683 448096289 48536828 89956025 992006482 707025508 587174087 481266610 669319649 8...
output:
5007361
result:
ok single line: '5007361'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3468kb
input:
1 1 1
output:
0
result:
ok single line: '0'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
1 1 1000000000
output:
999999999
result:
ok single line: '999999999'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
1 1000000000 1000000000
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 3ms
memory: 3388kb
input:
1000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...
output:
999999999
result:
ok single line: '999999999'
Test #24:
score: 0
Accepted
time: 3ms
memory: 3428kb
input:
1000 947351932 954972028 909958876 912630306 935385845 992491673 990113448 931334932 988213814 901580157 974121689 910071732 965182390 921333440 978952872 959526695 954181286 934227147 914967420 901457620 980017186 961028517 960901048 920746211 932840722 914465339 949754641 959159646 922128196 99036...
output:
900064096
result:
ok single line: '900064096'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3452kb
input:
1000 383204008 415682489 252857031 367645873 386878748 409893271 194260992 194681893 150812845 144791097 314830277 300112212 59578572 374650910 240253865 147099360 18847529 290314248 39037820 301192105 465732278 74107640 120748623 267898576 114601380 285557551 165720692 159853495 186184803 436096814...
output:
498433223
result:
ok single line: '498433223'
Test #26:
score: 0
Accepted
time: 3ms
memory: 3468kb
input:
1000 233352475 100324802 76819331 204126594 649791935 561986677 620866243 353319694 109469860 211981221 182218910 732936310 686710157 257064481 191830644 270272427 198588537 244277884 136302694 69339744 92124714 735531782 159199958 643431940 443801249 669123280 590124261 166922056 313138975 43108113...
output:
249876606
result:
ok single line: '249876606'