QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#412686 | #6558. Allergen Testing | grass8cow# | WA | 4ms | 4020kb | C++17 | 780b | 2024-05-16 17:33:33 | 2024-05-16 17:33:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int K=100;
const ll I=1e18;
ll dp[K+10][K+10],c[K+10][K+10];
ll mu(ll a,ll b){
if(a<=I/b)return a*b;
return I+1;
}
void ad(ll &x,ll y){x+=y,x=min(x,I+10);}
ll n,d;
void sol(){
scanf("%lld%lld",&n,&d);d=min(d,1ll*K);
for(int i=0;i<=K;i++)if(dp[d][i]>=n){
printf("%d\n",i);return;
}
}
int main(){
c[0][0]=1;
for(int i=1;i<=K;i++){
c[i][0]=1;
for(int j=1;j<=i;j++)c[i][j]=c[i-1][j-1],ad(c[i][j],c[i-1][j]);
}
for(int i=0;i<=K;i++)dp[0][i]=1;
for(int i=1;i<=K;i++)for(int j=0;j<=K;j++)
for(int k=0;k<=j;k++)
ad(dp[i][j],mu(dp[i-1][k],c[j][k]));
int T;scanf("%d",&T);while(T--)sol();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3904kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 4ms
memory: 4020kb
input:
10000 1 1 1000000000000000000 1 1 1000000000000000000 1000000000000000000 1000000000000000000 26615519354743225 163142634 26615519354743225 163142634 26615519354743224 163142634 26615519354743226 163142634 847997831064072529 920867976 847997831064072529 920867976 847997831064072528 920867976 8479978...
output:
0 60 0 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 8 8 8 8 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 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 7 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 8 8 8 8 9 9 9 9 9 9 9 9 9 9...
result:
wrong answer 4th lines differ - expected: '1', found: '9'