QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#259636#2659. Armia klonówmikefeng100 ✓1ms3812kbC++141.7kb2023-11-21 08:39:012023-11-21 08:39:02

Judging History

你现在查看的是最新测评结果

  • [2023-11-21 08:39:02]
  • 评测
  • 测评结果:100
  • 用时:1ms
  • 内存:3812kb
  • [2023-11-21 08:39:01]
  • 提交

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: 10
Accepted

Test #1:

score: 10
Accepted
time: 1ms
memory: 3628kb

input:

8 2 1

output:

8

result:

ok single line: '8'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

1 1 1

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

2 1 1

output:

3

result:

ok single line: '3'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

3 1 1

output:

4

result:

ok single line: '4'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

4 1 1

output:

5

result:

ok single line: '5'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

5 1 1

output:

5

result:

ok single line: '5'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

6 1 1

output:

6

result:

ok single line: '6'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

7 1 1

output:

6

result:

ok single line: '6'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

8 1 1

output:

6

result:

ok single line: '6'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

9 1 1

output:

7

result:

ok single line: '7'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

10 1 1

output:

7

result:

ok single line: '7'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

50 1 1

output:

11

result:

ok single line: '11'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

1000 1 1

output:

20

result:

ok single line: '20'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

1000000 1 1

output:

38

result:

ok single line: '38'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

1000000000 1 1

output:

57

result:

ok single line: '57'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

1000000000000000000 1 1

output:

114

result:

ok single line: '114'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

100 1 1

output:

13

result:

ok single line: '13'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

900567811781994725 1 1

output:

113

result:

ok single line: '113'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

900567811781994726 1 1

output:

114

result:

ok single line: '114'

Subtask #2:

score: 40
Accepted

Test #20:

score: 40
Accepted
time: 1ms
memory: 3804kb

input:

1000 1 1

output:

20

result:

ok single line: '20'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

1000 1000 1

output:

2000

result:

ok single line: '2000'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

1000 1 1000

output:

10010

result:

ok single line: '10010'

Test #23:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

1000 1 50

output:

510

result:

ok single line: '510'

Test #24:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1000 40 50

output:

900

result:

ok single line: '900'

Test #25:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

1000 90 50

output:

1200

result:

ok single line: '1200'

Test #26:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

1000 200 50

output:

1750

result:

ok single line: '1750'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

1000 60 50

output:

1050

result:

ok single line: '1050'

Test #28:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1000 450 50

output:

2750

result:

ok single line: '2750'

Test #29:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

1000 1699 50

output:

6497

result:

ok single line: '6497'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3672kb

input:

1000 1700 50

output:

6500

result:

ok single line: '6500'

Test #31:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

1000 1701 50

output:

6502

result:

ok single line: '6502'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1000 20 21

output:

410

result:

ok single line: '410'

Test #33:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1000 20 20

output:

400

result:

ok single line: '400'

Test #34:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1000 20 5

output:

175

result:

ok single line: '175'

Test #35:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

1000000 100 1

output:

523

result:

ok single line: '523'

Test #36:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

1000 20 4

output:

156

result:

ok single line: '156'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

1000 20 3

output:

137

result:

ok single line: '137'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1000 20 2

output:

116

result:

ok single line: '116'

Test #39:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

1000 20 1

output:

88

result:

ok single line: '88'

Test #40:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

900 20 6

output:

190

result:

ok single line: '190'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

800 20 6

output:

188

result:

ok single line: '188'

Test #42:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

700 20 6

output:

182

result:

ok single line: '182'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

600 20 6

output:

176

result:

ok single line: '176'

Test #44:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

1000 1000000 1

output:

1001000

result:

ok single line: '1001000'

Test #45:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

1000 1 1000000

output:

10000010

result:

ok single line: '10000010'

Subtask #3:

score: 15
Accepted

Dependency #2:

100%
Accepted

Test #46:

score: 15
Accepted
time: 1ms
memory: 3628kb

input:

100000 1 1

output:

32

result:

ok single line: '32'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

100000 1 2

output:

51

result:

ok single line: '51'

Test #48:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

100000 1 3

output:

68

result:

ok single line: '68'

Test #49:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100000 2 1

output:

42

result:

ok single line: '42'

Test #50:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

100000 2 3

output:

84

result:

ok single line: '84'

Test #51:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100000 2 5

output:

119

result:

ok single line: '119'

Test #52:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

100000 3 1

output:

50

result:

ok single line: '50'

Test #53:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

100000 3 2

output:

74

result:

ok single line: '74'

Test #54:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

100000 3 4

output:

116

result:

ok single line: '116'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

100000 3 5

output:

135

result:

ok single line: '135'

Test #56:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

100000 3 7

output:

170

result:

ok single line: '170'

Test #57:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

100000 99 100

output:

3188

result:

ok single line: '3188'

Test #58:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

100000 100 51

output:

2122

result:

ok single line: '2122'

Test #59:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

100000 100 50

output:

2100

result:

ok single line: '2100'

Test #60:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

100000 100 49

output:

2074

result:

ok single line: '2074'

Test #61:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

999999999999999999 7654321 1234567

output:

320493722

result:

ok single line: '320493722'

Test #62:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

100000 100 21

output:

1330

result:

ok single line: '1330'

Test #63:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100000 100 20

output:

1300

result:

ok single line: '1300'

Test #64:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

100000 100 19

output:

1265

result:

ok single line: '1265'

Test #65:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

100000 100 5

output:

730

result:

ok single line: '730'

Test #66:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

100000 100 3

output:

604

result:

ok single line: '604'

Test #67:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

100000 100 1

output:

437

result:

ok single line: '437'

Test #68:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

100000 1000 1

output:

2631

result:

ok single line: '2631'

Test #69:

score: 0
Accepted
time: 1ms
memory: 3752kb

input:

100000 99367 1

output:

199365

result:

ok single line: '199365'

Test #70:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

100000 99368 1

output:

199367

result:

ok single line: '199367'

Test #71:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

100000 99369 1

output:

199369

result:

ok single line: '199369'

Test #72:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

100000 99370 1

output:

199370

result:

ok single line: '199370'

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #73:

score: 15
Accepted
time: 1ms
memory: 3664kb

input:

774840977 1 1

output:

56

result:

ok single line: '56'

Test #74:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

774840978 1 1

output:

57

result:

ok single line: '57'

Test #75:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

800000000 2 1

output:

74

result:

ok single line: '74'

Test #76:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

900000000 2 1

output:

75

result:

ok single line: '75'

Test #77:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

100000000 1 2

output:

80

result:

ok single line: '80'

Test #78:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

1000000000 1 2

output:

90

result:

ok single line: '90'

Test #79:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1000000000 2 3

output:

150

result:

ok single line: '150'

Test #80:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

500000000 1 3

output:

116

result:

ok single line: '116'

Test #81:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

600000000 1 3

output:

118

result:

ok single line: '118'

Test #82:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

700000000 1 3

output:

119

result:

ok single line: '119'

Test #83:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

1000000000 100 1

output:

784

result:

ok single line: '784'

Test #84:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

1000000000 1000 1

output:

4708

result:

ok single line: '4708'

Test #85:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

1000000000 31267 1

output:

96799

result:

ok single line: '96799'

Test #86:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

1000000000 31268 1

output:

96802

result:

ok single line: '96802'

Test #87:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

1000000000 31269 1

output:

96805

result:

ok single line: '96805'

Test #88:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

1000000000000000000 300000000 100000000

output:

18000000000

result:

ok single line: '18000000000'

Test #89:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1000000000 1000000000 1

output:

2000000000

result:

ok single line: '2000000000'

Test #90:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

1000000000 900000000 1

output:

1800063244

result:

ok single line: '1800063244'

Test #91:

score: 0
Accepted
time: 1ms
memory: 3756kb

input:

1000000000 1 1000000000

output:

30000000030

result:

ok single line: '30000000030'

Subtask #5:

score: 20
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #92:

score: 20
Accepted
time: 1ms
memory: 3756kb

input:

1000000000000000000 1 1

output:

114

result:

ok single line: '114'

Test #93:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

1000000000000000000 2 1

output:

150

result:

ok single line: '150'

Test #94:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

1000000000000000000 1 2

output:

180

result:

ok single line: '180'

Test #95:

score: 0
Accepted
time: 0ms
memory: 3796kb

input:

999999999999999999 3 4

output:

416

result:

ok single line: '416'

Test #96:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

879609302220800000 5 2

output:

330

result:

ok single line: '330'

Test #97:

score: 0
Accepted
time: 1ms
memory: 3696kb

input:

879609302220799999 5 2

output:

329

result:

ok single line: '329'

Test #98:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

999999999999999999 523 1

output:

5598

result:

ok single line: '5598'

Test #99:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

999999999999999999 524 1

output:

5607

result:

ok single line: '5607'

Test #100:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

999999999999999999 525 1

output:

5615

result:

ok single line: '5615'

Test #101:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

999999999999999999 999999999 1

output:

3002999994

result:

ok single line: '3002999994'

Test #102:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

1000000000000000000 1000 1

output:

9415

result:

ok single line: '9415'

Test #103:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

1000000000000000000 999996741 71906

output:

6430985011

result:

ok single line: '6430985011'

Test #104:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

1000000000000000000 999996742 71906

output:

6430985016

result:

ok single line: '6430985016'

Test #105:

score: 0
Accepted
time: 1ms
memory: 3700kb

input:

1000000000000000000 999996743 71906

output:

6430985021

result:

ok single line: '6430985021'

Test #106:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

1000000000000000000 1 1000000000

output:

60000000060

result:

ok single line: '60000000060'

Test #107:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

1000000000000000000 10 10

output:

1140

result:

ok single line: '1140'

Test #108:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

1000000000000000000 10 4

output:

660

result:

ok single line: '660'

Test #109:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

1000000000000000000 10 3

output:

568

result:

ok single line: '568'

Extra Test:

score: 0
Extra Test Passed