QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#95890 | #119. Worst Reporter 3 | tricyzhkx | 19 | 208ms | 7144kb | C++14 | 551b | 2023-04-12 12:48:35 | 2023-04-12 12:48:38 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
int D[500010],p[500010];
int main()
{
int n,q,T,l,r,cnt=0;
cin>>n>>q;
for(int i=1;i<=n;i++) scanf("%d",&D[i]);
for(int i=2;i<=n;i++) D[i]=(D[i]+D[i-1]-1)/D[i-1]*D[i-1];
for(int i=1,j;i<=n;i=j+1)
{
for(j=i;j<n && D[j+1]==D[i];j++);
p[++cnt]=j;
}
while(q--)
{
scanf("%d%d%d",&T,&l,&r);
int ans=(l<=T && T<=r);
for(int i=1;i<=cnt;i++)
{
int t=T-T%D[p[i]],x=max(p[i-1]+1,t-r),y=min(p[i],t-l);
if(x<=y) ans+=y-x+1;
}
printf("%d\n",ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 7
Accepted
Test #1:
score: 7
Accepted
time: 187ms
memory: 6928kb
input:
499999 499999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
91354 14781 458110 312259 476280 377661 0 80423 63661 103542 190089 33810 16591 47395 170529 0 167913 61627 120334 95728 180048 205266 23672 262516 158654 136520 406 28225 170791 122622 83443 12565 255851 10474 126809 141182 88558 0 361576 0 134028 500000 118905 500000 15429 33768 29172 258600 11258...
result:
ok 499999 lines
Test #2:
score: 0
Accepted
time: 206ms
memory: 6876kb
input:
499998 499998 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
29146 331652 442314 187644 235236 57188 5658 189016 219395 359485 130953 0 237886 226155 499999 106339 72659 209431 309393 177311 303481 21074 499999 139782 0 31928 71678 72069 171076 122455 139630 356318 499999 69417 0 160948 499999 0 50289 120840 251352 220033 281403 59885 82381 334188 56522 9229 ...
result:
ok 499998 lines
Test #3:
score: 0
Accepted
time: 203ms
memory: 6856kb
input:
500000 499997 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
163740 241282 289914 71709 161300 188844 133042 403939 52209 53946 33577 277174 58606 141172 288479 76792 285261 385536 0 0 270736 96745 70310 0 283020 500001 0 372500 172011 59612 0 12869 109703 163790 0 172431 144920 203007 48790 90807 17470 350224 123140 0 219779 409478 161651 200499 256423 65001...
result:
ok 499997 lines
Test #4:
score: 0
Accepted
time: 201ms
memory: 7144kb
input:
499999 500000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
0 0 416254 243227 61777 19997 38808 241764 339032 1714 129441 0 40332 177276 500000 472476 0 0 0 305382 143316 455066 259169 239495 282131 376533 145773 185641 261836 35630 311240 0 208642 429421 189412 98099 249799 279317 51938 231062 98063 0 443789 0 401479 210300 139721 4705 28667 113918 20090 28...
result:
ok 500000 lines
Test #5:
score: 0
Accepted
time: 193ms
memory: 6136kb
input:
499998 499999 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
271585 129551 253926 115160 286468 51605 32241 175464 0 47408 261563 468740 230964 178302 0 41487 0 162957 499999 206864 67211 29012 37487 101852 499999 0 255700 61002 499999 92948 349857 122650 499999 11182 193260 365247 251564 24601 499999 225101 31344 0 0 0 2420 114817 76948 385529 86453 61729 20...
result:
ok 499999 lines
Test #6:
score: 0
Accepted
time: 208ms
memory: 6920kb
input:
500000 499998 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
0 500001 0 0 106677 358048 120552 6456 58567 235519 0 264178 293864 206972 23308 227033 191932 0 11862 11083 396848 61012 0 500001 139741 380786 236553 70152 0 0 233317 209998 32891 51454 360927 0 223225 7754 177151 38527 158895 138335 500001 157446 185793 29451 209779 35129 79793 195733 0 0 239590 ...
result:
ok 499998 lines
Subtask #2:
score: 12
Accepted
Test #7:
score: 12
Accepted
time: 3ms
memory: 5624kb
input:
999 999 567 214 746 852 643 536 396 114 769 251 631 51 520 952 888 539 19 69 349 813 210 352 216 330 908 156 313 115 339 875 617 174 525 249 176 340 546 649 252 5 778 816 22 166 813 572 8 120 437 442 545 25 100 179 78 808 34 623 606 980 352 784 122 87 263 189 768 815 38 162 98 642 755 585 579 262 11...
output:
2 0 1 1 3 1 2 1 1 0 1 3 2 1 0 3 0 0 0 1 0 3 1 1 0 1 1 1 1 0 1 0 0 1 3 1 0 3 3 0 1 2 3 1 1 1 1 3 1 1 0 1 1 1 1 1 0 0 2 1 1 1 0 0 1 1 1 0 1 3 0 3 3 3 2 1 1 1 1 1 1 1 1 1 1 1 0 3 0 1 0 0 1 1 2 0 1 0 3 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 3 0 0 1 0 2 1 2 0 1 0 0 3 0 0 0 0 1 1 0 0 1 3 2 2 1 3 3 ...
result:
ok 999 lines
Test #8:
score: 0
Accepted
time: 2ms
memory: 5640kb
input:
998 998 556 324 129 29 660 950 57 357 473 979 123 726 466 946 120 339 612 255 1000 122 855 404 360 391 897 179 530 956 728 820 933 945 852 859 75 363 151 557 58 631 774 800 355 839 388 194 62 304 605 185 796 271 949 71 31 212 829 895 202 265 591 890 365 707 138 202 270 530 820 593 215 418 815 720 88...
output:
2 0 2 5 0 0 5 5 5 1 1 1 1 0 0 0 1 1 1 1 1 1 5 0 1 1 3 1 1 1 0 1 0 1 3 1 5 2 3 0 5 0 0 4 5 1 0 1 1 0 1 0 1 0 3 0 1 4 5 5 1 1 1 5 1 1 5 1 5 1 1 3 5 1 0 2 0 5 1 0 1 5 0 1 4 1 1 5 0 0 0 1 0 1 1 1 0 0 1 1 0 0 0 1 1 0 5 4 5 4 3 1 0 0 0 0 1 3 5 0 2 0 0 4 0 1 0 3 0 0 0 4 5 1 1 1 3 3 0 0 1 1 0 4 1 0 0 4 0 5 ...
result:
ok 998 lines
Test #9:
score: 0
Accepted
time: 2ms
memory: 5636kb
input:
1000 997 908 532 784 349 774 414 161 861 126 910 955 792 465 71 433 902 795 446 179 893 256 102 504 495 796 108 169 724 751 569 477 616 55 961 101 99 4 115 649 437 815 361 232 689 701 159 212 943 351 16 279 227 386 508 751 188 67 951 487 277 317 291 936 44 208 400 135 347 649 681 50 133 225 708 275 ...
output:
0 0 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 4 10 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 1 0 1 0 1 5 1 0 0 1 0 1 0 1 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 0 1 1 1 1...
result:
ok 997 lines
Test #10:
score: 0
Accepted
time: 2ms
memory: 5592kb
input:
999 1000 581 450 177 453 237 604 809 446 468 512 170 798 612 526 384 308 979 25 110 735 570 339 249 661 337 278 48 230 391 740 705 724 662 479 534 156 10 537 129 982 340 979 868 640 364 835 938 778 997 347 761 187 42 355 882 789 658 835 743 486 96 77 52 129 94 421 345 968 829 117 991 976 975 898 537...
output:
0 0 5 0 1 5 0 6 1 1 4 0 4 0 6 0 1 0 4 2 1 6 1 0 0 6 1 0 1 1 0 1 6 1 1 1 0 1 0 6 4 1 0 0 2 6 1 2 4 0 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 2 0 2 1 0 0 0 1 1 1 0 0 6 1 0 1 6 0 0 2 6 5 1 0 6 0 1 1 4 0 0 1 1 2 1 0 0 3 0 0 1 6 6 3 1 1 1 0 1 2 6 4 0 1 0 3 1 1 0 0 3 6 1 0 5 1 0 1 6 0 0 5 1 0 4 1 1 4 1 0 0 0 6 1 ...
result:
ok 1000 lines
Test #11:
score: 0
Accepted
time: 2ms
memory: 5708kb
input:
998 999 1 1 2 2 3 5 5 6 6 6 8 10 10 10 11 11 12 13 15 19 20 24 24 24 24 26 26 26 28 29 30 30 30 31 34 35 35 37 38 39 40 41 43 45 45 45 47 48 49 50 51 54 55 57 59 59 61 62 62 63 64 66 66 67 70 70 70 70 73 73 74 75 76 76 77 77 77 78 79 79 80 80 83 83 83 84 84 85 85 85 87 87 90 91 92 93 94 94 95 96 97 ...
output:
128 73 156 27 2 6 510 4 345 18 348 147 4 4 265 146 22 109 175 0 24 69 84 28 117 251 10 11 52 3 226 45 252 25 396 20 55 190 146 8 0 251 0 127 20 335 0 231 65 355 44 140 7 39 187 6 1 15 28 28 83 24 3 0 509 56 0 14 8 0 0 17 275 175 48 175 173 33 434 202 116 10 2 25 34 34 18 20 84 26 29 62 5 59 57 73 9 ...
result:
ok 999 lines
Test #12:
score: 0
Accepted
time: 2ms
memory: 5644kb
input:
1000 998 1 2 4 4 5 7 7 7 8 8 8 10 13 18 19 19 20 20 21 21 22 23 23 25 26 26 26 27 28 29 29 31 31 32 34 38 39 39 40 41 41 42 43 44 45 45 47 48 48 49 52 53 54 54 55 56 56 60 61 64 66 69 69 71 72 73 74 76 76 77 78 78 82 83 83 83 83 84 88 88 88 89 90 94 95 95 96 97 97 97 99 99 100 100 102 102 103 104 10...
output:
11 3 86 11 142 22 44 0 41 16 302 176 1 255 156 165 47 126 48 15 45 10 26 500 0 50 402 0 0 10 6 9 346 43 114 186 0 113 125 147 69 32 6 362 40 257 191 60 166 497 274 4 34 223 2 499 244 32 12 1 215 125 139 11 80 22 133 59 319 25 0 213 396 81 45 2 8 20 0 3 250 92 0 46 244 35 191 49 0 59 13 71 281 250 16...
result:
ok 998 lines
Subtask #3:
score: 0
Runtime Error
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #13:
score: 0
Runtime Error
input:
499999 499999 374010150 448818544 940477558 518470042 44258219 119334986 898272498 225521509 652704227 96903886 837953933 680492536 873282581 682882329 809016767 640121094 296175812 92420943 324382717 271995812 707337621 329026552 257708005 326152128 599485541 490765157 126998675 914235224 831720618...