QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#403372 | #8124. Vrsar | lfxxx# | 70 ✓ | 47ms | 6196kb | C++14 | 1.1kb | 2024-05-02 09:43:28 | 2024-05-02 09:43:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
bool be;
constexpr int N = 1e5 + 5;
int n, m, b[N], suf[N], pre[N];
struct node {
int x, t, s;
}a[N];
bool en;
int main()
{
cerr << (&be - &en) / 1024.0 / 1024 << " MB\n--------------------------------" << endl;
#ifdef IAKIOI
freopen("in.in", "r", stdin);
// freopen("out.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; ++i) cin >> a[i].x >> a[i].t >> a[i].s;
sort(a + 1, a + 1 + n, [](node a, node b) {
return a.x < b.x;
});
for (int i = 1; i <= n; ++i) b[i] = a[i].x;
pre[0] = -1e9;
for (int i = 1; i <= n; ++i) {
pre[i] = max(pre[i - 1], a[i].t + b[i]);
}
suf[n + 1] = -1e9;
for (int i = n; i >= 1; --i) {
suf[i] = max(suf[i + 1], a[i].t - b[i]);
}
while (m--) {
int x;
cin >> x;
int p = lower_bound(b + 1, b + 1 + n, x) - b;
cout << max(suf[p] + x, pre[p - 1] - x) << ' ';
}
return 0;
}
詳細信息
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 1ms
memory: 3892kb
input:
10 10 466367251 100233480 856646172 23616136 95836624 848167799 285824526 504732766 778781745 484144310 45902528 249884410 77146428 247312488 457658792 303741999 449119889 822567584 310490877 635450008 523068941 688770771 830721934 666426060 895820438 617674687 350595970 688493520 120110545 31964270...
output:
324959131 778061457 595585027 409366057 787995914 441429980 363382174 592662119 654664483 452101770
result:
ok 10 numbers
Test #2:
score: 8
Accepted
time: 1ms
memory: 3892kb
input:
10 10 197660415 877926949 830320058 928828274 676041927 577299863 64052596 459296507 30823070 281767889 562185005 611523864 150811690 77570569 809358986 213935620 12505269 961725309 775148210 889695443 157645491 625951805 490758663 477700118 250630503 992248784 824017266 837824049 773366672 58921723...
output:
741618281 957579206 958046653 665103764 845383118 752161980 693538996 729280208 813916400 883997000
result:
ok 10 numbers
Test #3:
score: 8
Accepted
time: 0ms
memory: 3796kb
input:
10 10 93872193 922211237 806257340 25529798 342037761 75596484 493869778 105876679 511024805 651807179 621165749 577855160 189391095 662790478 919270108 335305488 732247700 703098588 720163949 197575873 31235705 875848219 934405215 326308060 929651726 673284090 890869109 962583518 916657141 51208912...
output:
828339044 711761425 593034542 860294210 917694745 818843710 895995394 675242722 923751508 717186451
result:
ok 10 numbers
Test #4:
score: 8
Accepted
time: 1ms
memory: 3836kb
input:
10 10 454732829 15281802 100852165 385136540 331145339 504681932 59562432 69047258 528942487 678215086 555671173 177862075 455746556 61243386 307159562 293330457 60638848 822303026 763677378 636652853 635769350 547186638 950922971 306630375 708444092 113273214 294663455 573868784 399145959 613684236...
output:
403736333 854381381 466564426 934866953 613032553 507152427 943028810 796647462 881992454 810266097
result:
ok 10 numbers
Test #5:
score: 8
Accepted
time: 0ms
memory: 3860kb
input:
10 10 389797255 761003351 511712643 720051440 436560555 715310422 659395226 36341996 864251825 156879410 449403178 774328041 197393627 96333823 280161004 949897727 964389316 537489255 897207072 31678873 689235276 163073430 565210237 413564151 448998087 579222327 861016351 514238319 457403641 7286641...
output:
402136807 642052866 679888724 465402247 716166449 402752109 858047882 620618515 791689883 786944758
result:
ok 10 numbers
Test #6:
score: 8
Accepted
time: 0ms
memory: 3800kb
input:
10 10 287269465 297069647 957231780 403775256 29116356 984487531 793405406 656969070 955813740 645883677 202228793 977317674 563571227 31959182 548449767 243758995 417076271 139799601 667058655 527641002 702061304 11764831 640649845 47899895 828383576 577831525 736655947 474792329 570218483 73748751...
output:
628885014 630282151 516238008 566218010 533106611 558715808 593028992 523409544 595455636 607663894
result:
ok 10 numbers
Subtask #2:
score: 17
Accepted
Test #7:
score: 17
Accepted
time: 24ms
memory: 6144kb
input:
100000 1 53320039 48316003 37819925 770863640 910315870 957734835 466906749 791126408 442399500 312027241 11301038 565496103 691485660 603958964 574732654 989479682 728111217 647104072 843191799 685573031 570351670 169795677 685358070 641488997 795703430 994805186 294018870 21473670 875523013 991777...
output:
995983978
result:
ok 1 number(s): "995983978"
Test #8:
score: 17
Accepted
time: 21ms
memory: 6196kb
input:
100000 1 685937245 290795880 211005526 177778952 802905227 983869446 454912298 343628505 28321462 38243172 631075776 619487766 682651221 240289602 457322605 189471916 957198086 18483085 954626959 191915417 167067901 183628752 126948548 119039254 768289318 34004952 306991192 859775708 740006350 69621...
output:
994454920
result:
ok 1 number(s): "994454920"
Test #9:
score: 17
Accepted
time: 25ms
memory: 6192kb
input:
100000 1 789191504 222974467 26132393 643171429 29199427 429975930 93253098 986888132 818435231 622741039 92276295 625805057 415151319 82624176 231548476 709476321 824999732 515903661 202334222 501136586 414116115 329414984 918271019 283604940 350067855 973975089 40828573 862084361 617785313 3436328...
output:
999684354
result:
ok 1 number(s): "999684354"
Test #10:
score: 17
Accepted
time: 24ms
memory: 6132kb
input:
100000 1 604474130 537620598 984504818 636918864 686701808 971616217 458766000 474373841 771601549 67713650 632411948 620684266 451553645 299309648 658068372 144019942 384532023 199919637 882493353 601022916 773880686 692096494 765549801 447544786 966280814 84732023 337666483 714553341 719139035 739...
output:
996678183
result:
ok 1 number(s): "996678183"
Test #11:
score: 17
Accepted
time: 14ms
memory: 6120kb
input:
100000 1 852429235 916671092 532162590 8966928 790503806 940949256 397323085 213656308 750563499 43785611 637035777 248288048 355962441 365117831 490415665 340083831 211575355 25978716 138144527 577500394 229977301 94301080 551812543 232449187 585483001 615451515 628855963 181158516 954102989 794751...
output:
995372091
result:
ok 1 number(s): "995372091"
Test #12:
score: 17
Accepted
time: 25ms
memory: 6196kb
input:
100000 1 625668756 968912537 869988252 581954375 955236546 979655664 389902987 475748907 317532424 331593993 345131384 339186032 478145777 498003101 501582528 321211625 502307105 719388732 183678728 424664429 884081646 591958022 744966912 43677765 861504705 386449465 771737197 992667988 775159187 27...
output:
994593331
result:
ok 1 number(s): "994593331"
Subtask #3:
score: 19
Accepted
Test #13:
score: 19
Accepted
time: 1ms
memory: 3892kb
input:
1000 1000 772002074 896000991 264744112 388854298 98924088 455149297 417376884 380862219 489995490 623600709 227967696 504868695 730017345 324800592 430914592 822596051 922354700 720756605 520694263 298084968 334175049 355696669 7751208 295045433 209898888 775145315 36300658 449506116 200580532 9933...
output:
961452637 952290361 987335755 988221358 981798488 981773504 967183990 986687731 993577128 986478605 992768168 978139482 985155209 990961472 985276365 950516357 986698375 949129298 948117186 986075994 965677563 977929808 949046295 947644918 976453224 949951072 983327497 965651706 985297316 977108471 ...
result:
ok 1000 numbers
Test #14:
score: 19
Accepted
time: 1ms
memory: 3720kb
input:
1000 1000 778729169 887439397 466745725 548634646 581229903 718067115 59587620 856999162 880703055 81625283 638425359 974367036 484744524 168142010 376081735 57945731 95090267 219404692 696626672 119135631 741367926 813675168 930062517 147397482 639086185 432696527 60706030 676970442 219620465 55075...
output:
976230645 970971922 959553147 964762035 956405909 978982439 987491398 959136735 996931328 985007195 986032168 947424972 981068763 989251365 990027553 987144709 960986700 973947493 931568292 935594108 987999018 998307398 950213421 973455844 987683228 966911697 951645362 962206776 979787261 956042529 ...
result:
ok 1000 numbers
Test #15:
score: 19
Accepted
time: 1ms
memory: 3896kb
input:
1000 1000 363205900 387590442 70607308 573966309 560901733 275965193 813631180 963697512 800717574 263920369 477391550 115253964 742708936 580102223 185139745 216715593 889085711 336948035 115935077 668029619 259869691 549469443 778920464 612271188 438869083 52442569 126336828 139226256 979940608 95...
output:
959731646 974336498 984055905 943668148 992264800 973396029 988169801 989976097 974043214 948230271 996138295 964209959 970202292 950733865 964181059 985482482 983012520 978810331 987850666 983861888 991758781 975535818 984576136 977415909 953469395 990574376 987940454 966363650 977746088 971876574 ...
result:
ok 1000 numbers
Test #16:
score: 19
Accepted
time: 0ms
memory: 3712kb
input:
1000 1000 958995848 160686876 537712759 770073867 699672549 401021320 228430173 508694327 424637835 322993644 661188323 899398966 581226125 278131205 772575777 62821224 595167536 834578529 243653164 773595532 277171584 103870071 426594252 310687926 895834704 544501504 929197903 346787191 439879014 3...
output:
958608642 963804886 942630254 967115367 958789177 977839196 943427884 982306944 970186587 957685049 974686527 932515400 976080720 966520161 974925576 957193113 984763611 985352403 973085944 980935062 983850856 985725761 972042592 976330065 969560881 980950976 997951085 984322164 973177431 967948518 ...
result:
ok 1000 numbers
Test #17:
score: 19
Accepted
time: 1ms
memory: 3928kb
input:
1000 1000 266394265 148250451 120542766 396157525 619576362 847806879 11445049 803025110 165025624 541286601 246969248 155198038 85031548 796120109 759637878 791436430 59282596 558498463 624208350 879480001 459754554 464628044 289421859 978604848 231737959 612823031 926521476 505062438 767781430 970...
output:
961011073 953152208 965490152 966819956 974188540 996928465 970035463 981941264 960692174 986740180 974481627 999774974 975788265 989423257 956515558 966493676 940441911 971481764 975358519 957337919 986174253 968752593 967964033 976609467 966515108 961317479 969937520 993254132 960557150 977086497 ...
result:
ok 1000 numbers
Test #18:
score: 19
Accepted
time: 1ms
memory: 3824kb
input:
1000 1000 436965519 1993993 514102051 757703225 20486419 601014168 720804256 42801919 524392114 722006638 898485204 270788594 670512792 649601947 847106805 198233981 377263386 45328596 429290231 604119145 962331283 304944338 68112203 882286948 352175065 100501284 260119963 296611093 600196967 830262...
output:
941229299 926684167 968613680 958332863 978633496 979869123 968394662 929253598 958942838 975565476 961740332 978096222 967273622 979000888 949586495 965465372 986420073 957495416 974275571 965053314 960714343 963443349 977298309 970836405 971255641 955811698 967821603 995952853 970571671 966910223 ...
result:
ok 1000 numbers
Test #19:
score: 19
Accepted
time: 1ms
memory: 3924kb
input:
1000 1000 700613717 173223031 575577307 782139137 662566823 621634757 755244544 866781296 48310463 764289242 527062299 791767034 252093256 409092286 848913447 609957957 864240327 495832972 397121785 845814366 903226939 505007979 704201916 929290803 970409973 271706783 692123692 778718258 586915498 3...
output:
989340742 980456009 926166392 975975716 967322715 924927061 989730178 999073966 977426152 985135911 955655386 941713546 947804888 987672400 947235919 990388520 972318255 947292952 936299389 998718527 985235292 990849709 965783871 983723714 980386113 995607060 973540481 977924979 938092390 987171425 ...
result:
ok 1000 numbers
Test #20:
score: 19
Accepted
time: 1ms
memory: 3896kb
input:
1000 1000 226070597 775014289 313282974 637462742 846386834 298032184 440150988 742879651 228755846 451679547 731200263 341651787 489757012 514611226 642750046 816283109 470444106 611882434 272321769 128823731 903895852 368980847 236648175 480137587 913274851 386383444 2997624 986250698 582977723 78...
output:
914922516 964848906 964295359 981962755 946071500 982341470 953967355 934290940 987766311 931660693 957694590 952734195 943663191 934810884 970513215 975652313 969220587 961185479 964714825 995749598 994389062 980436496 933663199 970106214 994451240 968968432 935318361 947931454 988541449 973782843 ...
result:
ok 1000 numbers
Test #21:
score: 19
Accepted
time: 1ms
memory: 3868kb
input:
1000 1000 357762552 29758273 512350619 204548267 860052354 357874580 10694593 820842631 660463392 26169575 158733625 252422327 794534182 681841194 144864978 710774125 231669719 387734896 757652885 804542510 991127595 316123807 267439875 58595739 935364409 596091858 104934874 922096837 731325382 4920...
output:
931069710 943009304 958197460 939640444 981251181 968663868 978603938 955188471 954856137 952843712 968047927 963572133 968789843 955599327 969010718 926704769 971293123 995404865 995158084 986057016 948415410 988026397 963483918 967913735 940617886 981408370 953685736 978627959 941783772 971168310 ...
result:
ok 1000 numbers
Test #22:
score: 19
Accepted
time: 1ms
memory: 3884kb
input:
1000 1000 190649927 709585241 543440589 281967122 593575545 138629220 510879816 195792559 120405654 941803613 337363318 268894061 14872256 725439548 913573103 404358102 499584350 142016891 89963150 217777446 811658880 587525382 499104581 829384963 316771987 685887291 70789456 260963036 627778280 869...
output:
980138998 940031727 942947479 923275658 922740267 937179194 994304901 967132212 964388851 981490958 968810174 926801897 976445077 971477869 928085791 935256932 977073961 986541473 969368927 972503469 985035813 988204648 971747438 955949595 983945842 973091919 934990898 967347460 960692665 979514196 ...
result:
ok 1000 numbers
Subtask #4:
score: 26
Accepted
Test #23:
score: 26
Accepted
time: 41ms
memory: 6152kb
input:
100000 100000 521965876 33870591 856400954 206067435 592933982 931261262 178283709 147934752 282409736 563063581 870421027 970567928 631801897 450778938 362656247 144968633 956983527 74676772 269211495 65706335 924510921 808188509 607096121 593666067 121621532 157123020 318243015 690651288 997566425...
output:
999323122 997589739 996663287 998100819 995409305 998365983 995816860 998097239 995435374 995864173 996140540 998474565 998680995 995191964 996510806 997491522 998643969 995686054 996326351 996624761 996647788 997380958 997894133 996030702 995259547 997186790 996066677 998682393 999666726 996362495 ...
result:
ok 100000 numbers
Test #24:
score: 26
Accepted
time: 46ms
memory: 6196kb
input:
100000 100000 435920603 932192567 157376074 596885362 576225874 623124085 758322013 938942877 56287286 67469982 405083406 934046707 860529654 310110629 295472358 152378740 741053936 819163696 836191113 554874050 327285707 666569713 754176292 920268118 284184635 244506967 26744236 808699573 209839847...
output:
998506765 996173079 998028381 997552957 996084359 996244083 999435886 997247600 999317110 998130941 995937665 998202739 996315560 997558789 999521639 998599114 997208673 997705474 997528023 994562300 997842994 996457274 994767561 996853672 999306238 998911977 998493651 995552864 996699162 997436880 ...
result:
ok 100000 numbers
Test #25:
score: 26
Accepted
time: 45ms
memory: 6124kb
input:
100000 100000 39389895 183503892 665133394 18433108 224579704 247159553 991860760 490824434 888495644 582157552 937768493 813249103 370857712 353937824 52209844 774973348 841178050 581760216 918434466 127584156 15151707 554060331 86513415 969306467 157674823 135000362 868489482 871226945 336399298 8...
output:
994506026 997737098 995171718 997546466 995933232 995749778 998056626 996936094 997457038 997949511 997938464 995392222 998855450 996618564 997269378 994098584 997282689 996321979 998157925 997856050 994981106 997320160 996853188 996866936 996183612 998208891 998223969 998939023 999320051 997648374 ...
result:
ok 100000 numbers
Test #26:
score: 26
Accepted
time: 42ms
memory: 6020kb
input:
100000 100000 753109036 156835224 967321938 777535304 807053458 780800344 382420259 127734484 346645368 635643034 276286033 679789927 409348862 361774392 845020655 209575059 863835012 812734469 886698157 24490015 792490656 289996420 744458070 593711207 530849329 548126913 286395545 487518631 5154484...
output:
997510432 997127246 998145593 994864932 998819764 996001420 998730679 998167148 997362561 996222545 997311337 995780689 997669782 998319688 994352545 992819233 997638865 995869023 997921757 998983090 997283612 999314478 998055614 998944001 997582925 997809712 995540274 997260271 999683469 997163647 ...
result:
ok 100000 numbers
Test #27:
score: 26
Accepted
time: 42ms
memory: 6196kb
input:
100000 100000 219978028 570811659 776272471 596333616 720620602 663249474 230557811 692915734 304437311 517925572 814564421 431960975 632089530 356685168 325415765 900590714 562732953 891713115 585773558 424396815 239070137 292812291 729877763 888689709 419391041 32125435 759640639 981925380 6160947...
output:
996092970 996794005 994535799 998076476 999144354 998624861 996507013 997950865 997218626 999104152 997213343 997618535 997056629 993747768 998586974 997587661 996375771 995573561 996078224 995027238 998981929 999468677 998533590 998799256 996201319 999671821 998531968 999357591 998567145 995311668 ...
result:
ok 100000 numbers
Test #28:
score: 26
Accepted
time: 47ms
memory: 6132kb
input:
100000 100000 284456328 101062324 955233674 489804817 914646032 251630533 399040929 954231797 533564444 128290795 727233461 565039201 353573946 527541968 62850430 140793778 83096937 613817904 728026651 540268336 345843452 945733206 350784226 547318686 73808117 419391034 189186494 231651404 585589279...
output:
998284097 995405194 999064133 997185205 997284862 996447622 995358150 998032118 993964792 999404154 999044657 998576532 998652564 998532498 995944930 997496508 996611376 998698208 998321301 996574134 999265450 997986151 997481798 998985166 998350924 999034953 997407305 998344422 997448797 998596484 ...
result:
ok 100000 numbers
Test #29:
score: 26
Accepted
time: 42ms
memory: 6076kb
input:
100000 100000 760990404 181666597 822522539 565804187 969900535 824338734 85585099 285913082 665223447 889949445 631236336 73671624 565549550 920517713 722657107 690919570 556248888 263382735 196755191 314467633 886079731 289759718 160280528 935970055 145598577 404526021 804958696 141040389 39199737...
output:
996399135 998237267 999573878 998045365 998804830 996709919 996262702 998294773 997081847 997322813 999684686 994016754 998521581 995795867 996661407 997875853 997166084 997071736 996989471 997054542 997436503 998252656 996048084 996907903 997282967 996882021 997335866 996480880 996899752 999118340 ...
result:
ok 100000 numbers
Test #30:
score: 26
Accepted
time: 38ms
memory: 6192kb
input:
100000 100000 962558351 237323329 392243717 842114002 511924516 815632846 266792077 469352800 592052072 817597561 806030756 354302553 279641922 231921549 376451430 104562667 663708210 898157720 741493968 53605789 576914549 828333841 358620056 509411565 358474995 862572859 343918641 264057652 8634684...
output:
994906671 996465676 995270763 997402952 996320917 997911726 999386531 996263406 997325442 995777310 997116076 995220389 998615805 998414507 997137041 995730572 995360984 997800201 994749604 999110271 999273313 997888834 997738390 998451995 997955789 998978403 997650709 996524443 995212295 998224000 ...
result:
ok 100000 numbers
Test #31:
score: 26
Accepted
time: 42ms
memory: 6192kb
input:
100000 100000 12339373 540542086 290209259 241381812 801323627 295763962 316257973 463998430 969133190 479723434 994650791 186996477 956232727 361117517 648397722 29229035 239198479 567591896 697370274 459259523 551502992 577663964 366582175 901118181 988236857 731927359 988444147 24198256 101719057...
output:
998587866 997188364 998687914 995097794 994894476 997295807 997489031 997676355 997052395 997560934 997531280 999201423 996450657 998966174 995159627 998254081 996360837 996017772 996777760 995906322 996904684 994421525 997937308 996879842 997723356 996610501 996154534 995748003 997577032 998844412 ...
result:
ok 100000 numbers
Test #32:
score: 26
Accepted
time: 41ms
memory: 6192kb
input:
100000 100000 291252472 92860998 648746355 531599844 890655573 608586409 853515964 88176166 92849003 55246531 424274538 394593382 23559821 465028283 799175853 646124231 589153537 114134853 209828427 559786851 377807019 769935412 50346408 894808473 316584197 905222295 760768603 699732547 88690357 254...
output:
994691054 999441484 997413293 998385137 996748557 993241291 995869742 998504707 997913381 998587823 997708016 995691686 993943369 997187993 996563149 998427969 998484064 999504820 997272152 999543460 999269112 996436197 994744291 998852920 996870387 998137958 998526165 998414814 995893851 998014167 ...
result:
ok 100000 numbers
Extra Test:
score: 0
Extra Test Passed