QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#706498 | #6558. Allergen Testing | ucup-team902# | WA | 6ms | 3996kb | C++17 | 618b | 2024-11-03 11:45:09 | 2024-11-03 11:45:10 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll n,d;
void solve(){
scanf("%lld %lld",&n,&d);
if(n==1){
puts("0");
return;
}
ll r=(ll)log2(n-1)+1;
for(int i=1;i<=(r+d-1)/d;i++){
ll tmp=n,m=1ll<<i;
int cnt=0;
while(tmp>1){
tmp=(tmp+m-1)/m;
cnt++;
}
if(cnt<=d){
printf("%d\n",i);
return;
}
}
// n=(ll)log2(n-1)+1;
// printf("%lld\n",(n+d-1)/d);
}
int main(){
int t; scanf("%d",&t);
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3932kb
input:
1 4 1
output:
2
result:
ok single line: '2'
Test #2:
score: -100
Wrong Answer
time: 6ms
memory: 3996kb
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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
result:
wrong answer 5th lines differ - expected: '2', found: '1'