QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#259635 | #2659. Armia klonów | mikefeng | 0 | 1ms | 3796kb | C++14 | 1.7kb | 2023-11-21 08:37:36 | 2023-11-21 08:37:36 |
answer
bool M1;
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<iomanip>
#include<cassert>
#include<random>
#include<cstdio>
#include<vector>
#include<bitset>
#include<stack>
#include<queue>
#include<deque>
#include<cmath>
#include<ctime>
#include<map>
#include<set>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
//#include<ext/pb_ds/priority_queue.hpp>
#define fi first
#define se second
#define LD double
#define ll long long
#define Vector Point
#define I128 __int128
#define ull unsigned ll
#define pii pair<int,int>
#define pb(x) push_back(x)
#define syt cerr<<"sytakioi\n"
#define F(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)
#define look_memory cerr<<abs(&M2-&M1)/1024.0/1024<<'\n'
#define rd_i(l,r) uniform_int_distribution<int>(l,r)(rd)
#define rd_r(l,r) uniform_real_distribution<double>(l,r)(rd)
#define look_time cerr<<(clock()-Time)*1.0/CLOCKS_PER_SEC<<'\n'
using namespace std;
//using namespace __gnu_cxx;
mt19937 rd(time(0));
const int N=105;
ll n,a,b;
I128 ans;
inline void solve(int x){
I128 res=a*x;
I128 l=1,r=n,val=1;
while(l<=r){
I128 mid=(l+r)>>1,sum=1;
bool f=0;
F(i,1,x){
sum*=mid;
if(sum>=n) f=1;
}
if(!f) l=mid+1,val=mid;
else r=mid-1;
}
I128 sum=1,num=(val-1)*x;
F(i,1,x) sum*=val;
while(sum<n) sum=sum/val*(val+1),++num;
// cout<<x<<' '<<(ll)res<<' '<<(ll)(res+num*b)<<'\n';
if(x==1) ans=res+num*b;
else ans=min(ans,res+num*b);
}
bool M2;
int main(){
int Time=clock();
look_memory;
cin.tie(nullptr)->sync_with_stdio(false);
cin>>n>>a>>b;
F(i,1,64) solve(i);
cout<<(ll)ans<<'\n';
look_time;
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 10
Accepted
time: 1ms
memory: 3796kb
input:
8 2 1
output:
8
result:
ok single line: '8'
Test #2:
score: -10
Wrong Answer
time: 1ms
memory: 3700kb
input:
1 1 1
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'
Subtask #2:
score: 0
Wrong Answer
Test #20:
score: 40
Accepted
time: 1ms
memory: 3544kb
input:
1000 1 1
output:
20
result:
ok single line: '20'
Test #21:
score: -40
Wrong Answer
time: 1ms
memory: 3660kb
input:
1000 1000 1
output:
1999
result:
wrong answer 1st lines differ - expected: '2000', found: '1999'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%