QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94516 | #5836. Your Rank is Pure | eyiigjkn | 44 ✓ | 21ms | 5776kb | C++14 | 681b | 2023-04-06 15:15:50 | 2023-04-06 15:16:16 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr int N=500,mod=100003;
int C[510][510],f[510][510];
inline void add(int &x,const auto &y){x=(x+y)%mod;}
int main()
{
int T,n;
for(int i=0;i<=N;i++) C[i][0]=1;
for(int i=1;i<=N;i++)
for(int j=1;j<=i;j++)
C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
for(int i=2;i<=N;i++) f[1][i]=1;
for(int i=1;i<N;i++)
for(int j=i+1;j<N;j++)
if(f[i][j])
for(int k=2*j-i;k<=N;k++)
add(f[j][k],(ll)f[i][j]*C[k-j-1][j-i-1]);
cin>>T;
for(int _=1;_<=T;_++)
{
int ans=0;
scanf("%d",&n);
for(int i=1;i<n;i++) add(ans,f[i][n]);
printf("Case #%d: %d\n",_,ans);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 14
Accepted
Test #1:
score: 14
Accepted
time: 21ms
memory: 5572kb
input:
100 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 10 7 25 22 18 9 3 24 15 21 14 6 7 13 20 15 6 20 8 17 24 7 6 25 20 15 21 11 13 22 16 22 19 15 10 11 22 4 2 3 23 14 7 20 18 17 10 22 12 16 5 2 13 9 18 7 14 5 16 2 25 22 14 19 3 14 20 23 16 20 16 13 25 21 8 17
output:
Case #1: 1 Case #2: 2 Case #3: 3 Case #4: 5 Case #5: 8 Case #6: 14 Case #7: 24 Case #8: 43 Case #9: 77 Case #10: 140 Case #11: 256 Case #12: 472 Case #13: 874 Case #14: 1628 Case #15: 3045 Case #16: 5719 Case #17: 10780 Case #18: 20388 Case #19: 38674 Case #20: 73562 Case #21: 40265 Case #22: 68060 ...
result:
ok 100 lines
Subtask #2:
score: 30
Accepted
Test #2:
score: 30
Accepted
time: 21ms
memory: 5776kb
input:
100 2 3 500 499 256 94 277 31 202 360 279 195 12 207 315 440 156 271 241 182 369 288 314 488 401 72 73 162 373 231 87 59 205 190 262 298 385 291 418 245 70 34 176 347 116 349 38 276 449 406 64 264 394 383 254 45 48 194 53 442 398 124 127 333 452 290 484 464 16 331 363 368 275 313 257 495 88 140 169 ...
output:
Case #1: 1 Case #2: 2 Case #3: 40434 Case #4: 48697 Case #5: 90630 Case #6: 56453 Case #7: 13758 Case #8: 90460 Case #9: 60779 Case #10: 57245 Case #11: 4816 Case #12: 41272 Case #13: 256 Case #14: 9444 Case #15: 46173 Case #16: 50413 Case #17: 16498 Case #18: 27043 Case #19: 37985 Case #20: 12177 C...
result:
ok 100 lines
Extra Test:
score: 0
Extra Test Passed