QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#507098 | #8727. Dvoboj | Physics212303 | 11 | 1313ms | 3976kb | C++17 | 675b | 2024-08-06 10:51:20 | 2024-08-06 10:51:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int n,q,l,k; cin>>n>>q,l=(k=__lg(n))>>1;
vector s(n,vector<int>(k+1));
for(int i=0;i<n;i++)
cin>>s[i][0];
auto bf=[&](){
for(int i=1;i<=l;i++)
for(int j=0;j+(1<<i)<=n;j++)
s[j][i]=abs(s[j][i-1]-s[j+(1<<i-1)][i-1]);
};
bf();
while(q--){
int op,x,y; cin>>op>>x>>y;
if(x--;op==1)s[x][0]=y,bf();
else if(y<=l)cout<<s[x][y]<<'\n';
else{
for(int i=l+1;i<=y;i++)
for(int j=x;j+(1<<i)<=x+(1<<y);j++)
s[j][i]=abs(s[j][i-1]-s[j+(1<<i-1)][i-1]);
cout<<s[x][y]<<'\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 11
Accepted
Test #1:
score: 11
Accepted
time: 0ms
memory: 3476kb
input:
10 10 1361914 207572678 628126347 376128984 883488318 186963880 762865354 326392578 98149107 158171745 2 2 3 1 2 570852623 2 1 3 1 10 841056888 2 1 3 1 10 496132858 2 1 1 2 3 3 1 3 99470035 1 7 296222622
output:
260852338 57441684 57441684 569490709 406038050
result:
ok 5 number(s): "260852338 57441684 57441684 569490709 406038050"
Test #2:
score: 11
Accepted
time: 1ms
memory: 3744kb
input:
16 1000 1361914 207572678 628126347 376128984 883488318 186963880 762865354 326392578 98149107 158171745 61370500 127856987 9580346 570852623 646119601 178503575 2 7 1 2 2 2 1 14 993939084 2 14 1 1 9 73368655 2 4 3 1 7 60357102 1 8 631246136 1 9 220513513 2 6 3 1 7 653851474 1 8 456503385 1 5 371026...
output:
436472776 86805665 347819483 87680538 262650449 984358738 235989872 272256206 29264121 185977251 194839926 251930935 42658454 11990820 42658454 66029961 440700537 577605510 425326019 466887594 813607132 362972407 48387898 63098914 627944703 66763262 232922824 133094310 197750495 217535675 147044123 ...
result:
ok 482 numbers
Test #3:
score: 11
Accepted
time: 1ms
memory: 3484kb
input:
65 1000 1361914 207572678 628126347 376128984 883488318 186963880 762865354 326392578 98149107 158171745 61370500 127856987 9580346 570852623 646119601 178503575 484012895 61261435 841056888 558195739 940535012 26358306 579095855 496132858 925772919 837126193 70268510 656565238 285836282 902043521 4...
output:
142337918 150548605 186695351 125217148 255203325 67291398 2648908 43043613 24226412 439183520 586296728 301501346 53682976 162406540 15657443 9885849 214706015 557305213 107800702 316326531 582297695 57541160 323146440 73732386 540396274 6958073 66486487 23042085 43666455 431577775 513356186 122913...
result:
ok 511 numbers
Test #4:
score: 11
Accepted
time: 1ms
memory: 3580kb
input:
65 1000 207511447 51272873 735603123 397076404 966916484 512320076 284382040 309429435 925716265 984330314 993127948 350498868 45242528 900122009 684637316 831057517 741828281 15030115 353216803 809527525 239951084 256630526 410747900 814013515 374895460 729376753 825213139 866764416 919429888 90646...
output:
22719394 273594757 184364296 45650570 227938036 348854302 216595057 69898465 123042137 547078655 353085422 31441046 163125351 150694751 254724553 125642109 474668 48784322 137746777 306679127 73236309 156188397 440590243 158822954 204074514 554177487 121598645 554177487 79359359 28590241 1539380 197...
result:
ok 523 numbers
Test #5:
score: 11
Accepted
time: 0ms
memory: 3812kb
input:
1000 1000 213378079 34508930 71287632 637752859 659977531 245762954 455483857 576582109 939803654 62528280 91772795 567245160 519776559 648525642 440759601 870753993 79121233 830364070 836922059 472097926 892749051 474527526 13096716 725009293 54135466 810116149 53609387 541454656 864260299 14827229...
output:
819243849 384496460 645939128 413892067 94704584 46680458 230543380 225168786 34308778 339710774 192803453 32592119 40448274 42815583 63939569 222218236 280995802 136044778 35905755 119728 46667819 6818746 320476902 292971525 272187426 243488937 154852879 318333429 298487803 156117205 352232549 2838...
result:
ok 524 numbers
Test #6:
score: 11
Accepted
time: 4ms
memory: 3676kb
input:
1000 1000 213596176 131514609 673536873 841721579 668353587 236064010 832632352 957205489 549880437 108760725 839907133 477543143 403049855 971248008 21939809 67431032 992061289 918570185 971654557 772163398 838389695 677675052 174311284 917009882 335321465 910674552 241976533 256318642 627949826 72...
output:
141553262 35087683 300166489 320091116 286621845 67645693 255636870 321861687 662594396 171132776 423848815 164112050 129034703 240963802 275224941 589646 194519241 103261333 5956571 156098709 244885556 335364865 181737317 273587357 43739830 146237615 238995140 51774342 363760436 53710912 239696030 ...
result:
ok 477 numbers
Test #7:
score: 11
Accepted
time: 4ms
memory: 3892kb
input:
1000 1000 213705226 716855592 11532404 943755091 135687088 231214538 484335687 610646267 354902444 168780627 140216095 969513894 881557414 595787431 349368057 92044113 374822261 425818714 39037190 922212518 811242785 779232431 791789479 12993791 12736224 424082842 909885545 113750635 509827356 47782...
output:
400459814 201418778 97817103 101202496 101232344 126369058 386988434 449061123 497907128 239411107 73562892 60291011 10853609 215848031 198911635 856136103 324760569 209857607 281170280 112506308 135756415 117330976 61224204 235579329 102640489 206365168 147494798 224911679 435403922 129389938 25091...
result:
ok 506 numbers
Test #8:
score: 11
Accepted
time: 4ms
memory: 3680kb
input:
1000 1000 213781507 228520287 275818880 45723066 676729644 226365066 136039024 264119813 159957219 228734993 514299648 387808358 286323150 220261319 676829073 190399016 831325058 6776299 32645233 72261637 784063107 880822578 335558619 35301414 616474697 11200187 504085501 44891683 391672120 22978818...
output:
160711136 324248029 205251300 24085371 284024914 231417855 844716399 141214150 202127290 14050109 341466449 157258185 109726110 66789769 71324859 296404158 282847563 8096429 63717687 241501586 194942018 196345301 338485818 34093662 128858414 279129154 443668432 478997435 51797012 246854082 131907601...
result:
ok 486 numbers
Test #9:
score: 11
Accepted
time: 4ms
memory: 3848kb
input:
1000 1000 214032373 325525965 951777177 175982732 685072933 216666122 513187518 644743194 843743058 348709261 188692163 298073574 169629214 542983685 257976513 387043289 670556058 21273359 167377731 298618054 729703751 10228281 496805954 227302003 897627928 38049535 766161701 759755670 155427181 807...
output:
277141918 235454347 365324681 202940860 20329203 210642204 46115467 48106060 573038529 221128330 140628685 205087339 64509805 146397506 6800712 253176214 31396794 411974102 11460523 89303493 25487492 256998462 479895476 294381914 119982133 138882109 139322432 268937129 85705093 439193820 118020357 8...
result:
ok 510 numbers
Test #10:
score: 11
Accepted
time: 4ms
memory: 3604kb
input:
1000 1000 339631232 358854319 465176920 725456574 224720478 969211987 710307753 744328097 656189083 982581416 178522774 239824216 373676202 9988302 284004938 941896061 795118324 264881243 868072678 358005529 37931724 73597773 656729204 182694053 590982265 4363286 72819444 882741771 46457647 57222133...
output:
174176325 225788486 75577805 102122893 54288788 186859227 77413498 279099073 119319777 311859316 32925563 128565968 14953978 199633402 147074367 159726214 74560293 82460793 223348007 124751594 71739589 205731243 20279323 110626855 159955434 207874198 283086711 248125642 37707497 120782314 322135930 ...
result:
ok 486 numbers
Subtask #2:
score: 0
Time Limit Exceeded
Test #11:
score: 13
Accepted
time: 52ms
memory: 3748kb
input:
2 200000 583392119 251603292 2 1 1 2 1 1 1 1 38574148 2 1 1 2 1 1 1 1 42719181 2 1 1 1 2 536876485 1 2 761201073 1 1 335510282 2 1 1 2 1 1 2 1 1 1 2 371383902 2 1 1 2 1 1 1 1 378794551 1 1 224150551 1 2 812716786 2 1 1 2 1 1 2 1 1 1 2 129793340 2 1 1 1 1 654577279 1 1 150709706 2 1 1 1 1 883829174 1...
output:
331788827 331788827 213029144 213029144 208884111 425690791 425690791 425690791 35873620 35873620 588566235 588566235 588566235 94357211 20916366 647936652 647936652 459423963 459423963 459423963 176008535 176008535 398886231 398886231 398886231 10658183 10658183 10658183 1477309 1477309 423872241 5...
result:
ok 99810 numbers
Test #12:
score: 13
Accepted
time: 61ms
memory: 3620kb
input:
8 200000 583937365 30955631 71369406 563916968 642881599 641904678 121445755 920580908 2 1 3 1 5 540256764 1 8 562659914 2 1 3 1 6 770926584 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 2 1 3 1 2 843982298 1 5 935286660 1 3 978153407 1 7 383158846 1 5 832692766 1 2 58984923 2 1 3 1 5 599293737 1 7 891437740 2 1 3 ...
output:
737724060 279132073 150110167 150110167 150110167 150110167 150110167 150110167 7018883 46428976 271079153 361390048 361390048 198270139 198270139 198270139 3058280 3058280 3058280 3058280 156874444 203315832 203315832 24294559 24294559 333451673 333451673 408021917 408021917 408021917 249116721 586...
result:
ok 99806 numbers
Test #13:
score: 13
Accepted
time: 123ms
memory: 3760kb
input:
128 200000 584667941 833604594 289821715 204082050 135277733 607958374 904627342 642215537 851862185 918490066 11161382 578052298 945488065 100848470 671298278 643164130 337474286 341210108 509998661 364095486 9419682 751509443 595566895 968206932 413460927 242350233 527753469 808018697 17026711 530...
output:
233794795 26950959 26950959 61031769 275489501 275489501 291739948 291739948 11887608 51682559 133293465 133293465 133293465 32136635 32136635 142223630 190940681 190940681 190940681 190940681 265354431 132261455 1340730 1340730 26308845 26308845 182270618 93242112 131028415 131028415 131028415 1310...
result:
ok 99805 numbers
Test #14:
score: 13
Accepted
time: 1118ms
memory: 3700kb
input:
1024 200000 585431285 636253556 508241256 917988956 701382924 574044838 614034338 363850167 560823596 264690948 408422480 800884232 106455 693522224 815976206 257775561 311702851 113142518 981513256 340664734 892903760 388767577 623012504 566450785 860691861 57400966 908214794 883751704 263780180 94...
output:
24063955 2839810 2839810 197237575 197237575 256174684 138891553 138891553 138891553 138891553 138891553 198403544 242681709 242681709 242681709 144917226 144917226 144917226 110713835 135466922 297518947 297518947 297518947 236494764 83202527 95353447 95353447 83305170 83305170 83305170 83305170 83...
result:
ok 99799 numbers
Test #15:
score: 0
Time Limit Exceeded
input:
131072 200000 585943763 341896840 50669734 354218084 185435770 549797478 20034663 778603240 659708224 564593850 131258296 39709127 245193374 963506379 305764871 749419008 446700414 870512334 244619063 17168510 757038139 896620008 489276314 46435872 26769562 845635119 26599918 170911669 746844122 775...
output:
18705461 19370893 19370893 7053709 7053709 7053709 7053709 10886574 10886574 19738165 19738165 19738165 3706242 3706242 1035356 6225471 22078108 22078108 22078108 7581975 8764092 8764092 245854 245854 245854 245854 245854 245854 245854 245854 245854 4610320 4610320 4610320 12043952 12043952 65659403...
result:
Subtask #3:
score: 0
Time Limit Exceeded
Test #21:
score: 16
Accepted
time: 70ms
memory: 3480kb
input:
10 200000 1 1 1 1 1 0 1 1 0 0 2 3 3 1 8 0 1 9 0 2 2 2 1 2 1 2 6 1 2 3 3 1 6 1 2 2 1 2 7 2 2 3 1 1 5 0 1 10 0 1 9 1 1 7 0 2 1 3 1 6 0 1 4 0 2 9 1 1 2 0 2 1 3 1 8 0 2 4 2 1 2 0 1 9 1 2 5 2 2 1 3 1 10 0 1 5 0 1 2 1 2 5 2 2 1 3 1 7 0 1 3 1 2 2 3 1 6 0 1 1 1 1 9 1 1 1 1 1 9 0 1 4 1 2 5 2 2 1 1 1 8 1 2 2 ...
output:
1 0 1 0 0 1 0 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1 0 0 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 1 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 ...
result:
ok 99564 numbers
Test #22:
score: 16
Accepted
time: 1313ms
memory: 3976kb
input:
1939 200000 1 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 1 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 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 1 0 0 1 0 0 0 0 1 1 0 0 1 ...
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #36:
score: 17
Accepted
time: 88ms
memory: 3740kb
input:
10 199991 37507664 194554609 209371390 279132948 336712965 55899332 339663138 116632087 630544272 741907097 2 9 1 2 1 2 2 8 1 2 5 2 2 7 2 2 3 2 2 1 1 2 2 2 2 3 2 2 8 1 2 5 2 2 1 2 2 7 2 2 3 3 2 3 3 2 2 3 2 3 3 2 8 1 2 5 2 2 5 1 2 1 3 2 1 3 2 6 2 2 2 3 2 6 2 2 3 2 2 9 1 2 1 3 2 4 1 2 5 2 2 1 3 2 7 1 ...
output:
111362825 87285387 513912185 57782582 111668226 211052075 157046945 42763236 211052075 513912185 57782582 87285387 111668226 99383849 99383849 187385143 99383849 513912185 57782582 280813633 29502805 29502805 230148379 187385143 230148379 211052075 111362825 29502805 57580017 57782582 29502805 22303...
result:
ok 199991 numbers
Test #37:
score: 17
Accepted
time: 164ms
memory: 3656kb
input:
1999 200000 205692769 142360920 151664892 907598214 795405922 175632467 244285343 27143079 276583249 298501268 10594969 264860871 214952974 216471286 246014885 813525591 366151081 791406855 51362983 564502909 189581922 488801024 260871099 259427596 33809830 12440012 89525027 18182534 403088409 93881...
output:
10520410 204683661 144721089 157181441 8767676 31099310 113863300 57257400 301671345 179722383 92608287 96776505 120405092 63649273 283985405 379036884 62468336 302138883 315150725 261999205 46435570 108353954 228065350 126017136 38656602 223207564 355228904 130380556 485499977 34426856 176542595 15...
result:
ok 200000 numbers
Test #38:
score: 17
Accepted
time: 108ms
memory: 3628kb
input:
1024 200000 171427368 578387740 923641319 332112159 660372227 184317484 276202482 214731222 677891681 628664517 833055149 570271392 241753161 234487558 32670259 674218357 54020716 531052607 520008019 191806075 297436717 788502768 352112004 27479049 102580897 740120776 653287924 182405802 907490954 7...
output:
222179270 264087568 607239683 161938730 541833994 33742387 330008592 524852243 31274322 261649596 147025256 60384021 164683325 95912771 59528864 76518957 71732881 426010432 296347460 8517321 51117678 791218739 296093606 473746837 258225768 197702322 61054072 62307227 438754389 76908556 291323598 145...
result:
ok 200000 numbers
Test #39:
score: 0
Time Limit Exceeded
input:
199999 199994 858673443 225964692 493295103 926194890 726822964 191538614 839676471 907887358 475466309 187972675 148234387 645774038 979838073 786366569 77592748 916010169 46589025 314047044 614039436 597031417 924219392 680302052 964935085 414872286 579200966 451774789 586257655 380628125 25411189...
output:
195151422 74045317 354109989 668325708 909574 130036022 48401780 378943645 252940094 45301279 229828868 357270630 20607800 278381743 71131999 333626235 59009713 20916013 23035881 362585098 96321131 21377714 18523649 95089918 163618210 139905062 397910821 27505980 794769294 201226982 248933 97549717 ...
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%