QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88114 | #4560. 定向越野 | DaiRuiChen007 | 0 | 480ms | 3776kb | C++14 | 918b | 2023-03-15 10:51:29 | 2023-03-15 10:51:32 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int MOD=1e9+7;
int N[64],M[64],P;
int dp[64][2][2][2][2];
bool vis[64][2][2][2][2];
inline int dfs(int dig,bool ok,bool kn,bool km,bool kc) {
if(!dig) return ok?1:0;
if(vis[dig][ok][kn][km][kc]) return dp[dig][ok][kn][km][kc];
int ret=0;
for(int n=0;n<=(kn?N[dig]:P-1);++n) {
for(int m=0;m<=(km?M[dig]:P-1);++m) {
if(kc&&m>n) continue;
ret=(ret+dfs(dig-1,ok||(n<m),kn&&(n==N[dig]),km&&(m==M[dig]),kc&&(n==m)))%MOD;
}
}
vis[dig][ok][kn][km][kc]=true;
return dp[dig][ok][kn][km][kc]=ret;
}
inline void solve() {
int n,m; scanf("%lld%lld",&n,&m);
N[0]=0; while(n) N[++N[0]]=n%P,n/=P;
M[0]=0; while(m) M[++M[0]]=m%P,m/=P;
memset(vis,false,sizeof(vis)),memset(dp,0,sizeof(dp));
printf("%lld\n",dfs(63,0,1,1,1));
}
signed main() {
int T; scanf("%lld%lld",&T,&P);
while(T--) solve();
return 0;
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
-100 27 98 2 0
output:
9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...
result:
Test #2:
score: 0
Time Limit Exceeded
input:
-136 25 171 -3 1 0 0 100
output:
0 0 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4388 4...
result:
Test #3:
score: 0
Runtime Error
input:
-100 0 100 0 1 10 0 10
output:
result:
Test #4:
score: 0
Time Limit Exceeded
input:
-136 25 174 -4 2 -50 50 60 70 -20 61
output:
0 0 348 888 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 744 ...
result:
Test #5:
score: 0
Time Limit Exceeded
input:
-136 25 171 -3 2 -50 50 60 80 50 60
output:
0 0 348 1158 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718 718...
result:
Test #6:
score: 0
Time Limit Exceeded
input:
-136 25 171 -3 3 -50 50 60 10 -20 20 80 50 60
output:
0 0 348 718 888 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 348 ...
result:
Test #7:
score: 0
Time Limit Exceeded
input:
-50 90 249 103 4 0 0 100 200 0 100 0 200 100 200 200 100
output:
7911 4495 4480 5719 924 5719 7323 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 924 92...
result:
Test #8:
score: 0
Wrong Answer
time: 3ms
memory: 3772kb
input:
872 -756 -352 288 5 826 775 313 914 429 44 975 357 50 12 920 513 260 -234 667
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '2203.4', found: '0'
Test #9:
score: 0
Time Limit Exceeded
input:
-936 602 -345 -983 8 604 180 341 -496 117 166 424 -650 366 531 863 345 -831 133 169 -800 503 167 -127 6 219 -641 -191 174
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
Test #10:
score: 0
Time Limit Exceeded
input:
-173 -249 -171 -221 16 -225 -309 18 -225 -273 18 -225 -237 18 -225 -201 18 -189 -309 18 -189 -273 18 -189 -237 18 -189 -201 18 -153 -309 18 -153 -273 18 -153 -237 18 -153 -201 18 -117 -309 18 -117 -273 18 -117 -237 18 -117 -201 18
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
Test #11:
score: 0
Wrong Answer
time: 4ms
memory: 3540kb
input:
985 552 -332 -758 20 329 229 213 926 318 203 -891 -472 129 -41 687 287 -646 692 286 -327 -993 78 -476 -985 71 151 -548 167 -864 -729 129 -406 -59 192 269 -725 27 306 -676 34 -428 -423 37 -32 -835 53 675 -1 202 -61 -961 76 -321 308 184 -350 -438 42 363 -288 89 326 -103 99
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '1898.6', found: '0'
Test #12:
score: 0
Time Limit Exceeded
input:
-499 -717 239 -53 50 -817 341 21 21 637 21 398 979 21 -29 -169 21 353 602 21 -758 -744 21 -391 -668 21 217 74 21 -511 54 21 33 15 21 -252 -837 21 -822 863 21 -818 -576 21 978 814 21 934 864 21 -968 -526 21 -998 -79 21 -745 -379 21 491 -161 21 -874 -618 21 -693 -680 21 800 629 21 -140 249 21 223 463 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
Test #13:
score: 0
Time Limit Exceeded
input:
-161 -739 -162 -587 100 -251 -761 18 -251 -725 18 -251 -689 18 -251 -653 18 -251 -617 18 -251 -581 18 -251 -545 18 -251 -509 18 -251 -473 18 -251 -437 18 -215 -761 18 -215 -725 18 -215 -689 18 -215 -653 18 -215 -617 18 -215 -581 18 -215 -545 18 -215 -509 18 -215 -473 18 -215 -437 18 -179 -761 18 -17...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 532 0 0 532 0 0 532 0 0 532 0 0 532 0 0 1216 0 0 1216 0 0 ...
result:
Test #14:
score: 0
Wrong Answer
time: 480ms
memory: 3756kb
input:
826 450 -306 925 200 108 673 32 506 283 36 -764 -151 10 830 678 45 -918 -16 98 -25 479 19 299 -70 10 33 787 24 -808 181 35 -446 -32 21 -574 -690 12 835 -921 96 -555 -510 14 -14 515 18 52 -362 7 567 -424 2 -364 -55 48 357 112 84 461 -134 14 340 -717 104 63 -59 7 525 -298 37 289 2 38 -587 167 37 640 -...
output:
0 0 75600 23997 0 0 98679 0 0 0 8790 0 14705 0 0 0 0 0 0 0 0 0 0 0 46079 1344 0 96839 34595 0 0 0 0 0 0 0 0 0 0 0 0 0 123840 105909 180957 0 0 0 0 0 0 75147 21225 0 0 0 100749 0 0 0 0 0 0 0 0 114944 0 0 0 44745 0 0 0 0 0 0 4884 65247 0 22419 101004 79497 20825 97622 73295 0 0 0 0 0 88779 18810 71864...
result:
wrong answer 1st lines differ - expected: '1232.9', found: '0'
Test #15:
score: 0
Time Limit Exceeded
input:
-38 -199 -39 -284 400 -271 -515 18 -271 -479 18 -271 -443 18 -271 -407 18 -271 -371 18 -271 -335 18 -271 -299 18 -271 -263 18 -271 -227 18 -271 -191 18 -271 -155 18 -271 -119 18 -271 -83 18 -271 -47 18 -271 -11 18 -271 25 18 -271 61 18 -271 97 18 -271 133 18 -271 169 18 -235 -515 18 -235 -479 18 -23...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
Test #16:
score: 0
Wrong Answer
time: 64ms
memory: 3588kb
input:
166 281 -195 642 400 -281 8 18 -281 44 18 -281 80 18 -281 116 18 -281 152 18 -281 188 18 -281 224 18 -281 260 18 -281 296 18 -281 332 18 -281 368 18 -281 404 18 -281 440 18 -281 476 18 -281 512 18 -281 548 18 -281 584 18 -281 620 18 -281 656 18 -281 692 18 -245 8 18 -245 44 18 -245 80 18 -245 116 18...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4360 0 5149 20812 0 5149 32080 0 5149 38164 0 5149 45698 39340 49638 83610 39340 49638 44308 39340 49638 78220 39340 49638 101764 39340 49638 114940 39340 49638 4360 0 5149 20812 0 5149 32080 0 5149 38164 0 5149 ...
result:
wrong answer 1st lines differ - expected: '574.9', found: '0'
Test #17:
score: 0
Wrong Answer
time: 3ms
memory: 3776kb
input:
776 -462 -166 326 500 -584 400 1 -312 68 1 -235 -138 1 522 100 1 76 701 1 -763 674 1 -873 -149 1 -82 -480 1 560 -945 1 -727 -607 1 -174 619 1 -680 752 1 831 693 1 595 131 1 161 271 1 -984 592 1 70 821 1 -667 -786 1 423 -185 1 148 -769 1 -760 7 1 -872 -388 1 806 -139 1 934 -590 1 668 521 1 22 411 1 1...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '1228.1', found: '0'
Test #18:
score: 0
Wrong Answer
time: 1ms
memory: 3612kb
input:
933 -324 -919 985 500 -357 -466 1 454 150 1 877 -436 1 704 -838 1 -68 -533 1 743 -733 1 466 613 1 -492 -570 1 -675 -456 1 -316 171 1 -558 64 1 -504 517 1 -725 79 1 777 538 1 -622 -808 1 893 6 1 280 225 1 39 -493 1 217 421 1 -405 71 1 -209 888 1 -304 -97 1 -772 740 1 -309 -822 1 487 -558 1 988 214 1 ...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '2267.9', found: '0'
Test #19:
score: 0
Wrong Answer
time: 1ms
memory: 3536kb
input:
498 -626 -706 659 500 750 -390 84 -680 797 22 224 -477 45 -276 157 12 825 -215 35 889 365 23 -331 141 41 50 -395 28 710 952 14 857 -605 17 -639 -599 4 645 844 15 -133 963 49 423 434 17 147 631 5 782 359 7 881 782 12 -682 -622 35 -290 347 7 936 -943 5 -986 127 11 301 -17 13 140 957 29 -635 662 42 236...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
wrong answer 1st lines differ - expected: '1785.5', found: '0'
Test #20:
score: 0
Wrong Answer
time: 4ms
memory: 3616kb
input:
622 -445 -234 14 500 618 -568 22 -186 -295 48 777 -658 10 -747 50 20 -731 -783 32 -858 372 10 -395 -690 2 -292 243 7 -590 570 18 -682 550 20 -636 -741 44 901 -668 24 143 196 64 -67 -541 74 607 -986 5 609 -467 24 -670 -684 22 202 -363 28 -827 870 19 440 202 12 -79 209 11 -308 -967 69 374 -42 15 661 4...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1573 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
wrong answer 1st lines differ - expected: '974.0', found: '0'