QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#69629#2659. Armia klonówwiktorlewicki100 ✓2ms3560kbC++14681b2022-12-29 01:14:342022-12-29 01:14:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-29 01:14:35]
  • 评测
  • 测评结果:100
  • 用时:2ms
  • 内存:3560kb
  • [2022-12-29 01:14:34]
  • 提交

answer

#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;
ll ans=1e18, rozm=1, LG=1;
ll fpow(ll a, ll b){
	ll wyn=1;
	for(ll i=1;i<=b;i++){
		wyn*=a;
	}
	return wyn;
}
ll prw(ll a, ll b){
	return pow(a, 1.0/(long double)b);
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n, a, b;
	cin>>n>>a>>b;
	while(rozm<n){
		rozm*=2;
		LG++;
	}
	n++;
	for(ll i=1;i<=LG;i++){
		ll pom=(ll)prw(n, i);
		for(ll j=0;j<=i;j++){
			ll jeden=1;
			ll pom1 = max(jeden, fpow(pom, j)), pom2=max(jeden, fpow(pom+1, i-j));
			if(pom1*pom2>=n){
				ans=min(ans, a*i+(pom*j+(pom+1)*(i-j)-i)*b);
			}
		}
	}
	cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 3484kb

input:

8 2 1

output:

8

result:

ok single line: '8'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3344kb

input:

1 1 1

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

2 1 1

output:

3

result:

ok single line: '3'

Test #4:

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

input:

3 1 1

output:

4

result:

ok single line: '4'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

4 1 1

output:

5

result:

ok single line: '5'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3512kb

input:

5 1 1

output:

5

result:

ok single line: '5'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

6 1 1

output:

6

result:

ok single line: '6'

Test #8:

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

input:

7 1 1

output:

6

result:

ok single line: '6'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

8 1 1

output:

6

result:

ok single line: '6'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

9 1 1

output:

7

result:

ok single line: '7'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3492kb

input:

10 1 1

output:

7

result:

ok single line: '7'

Test #12:

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

input:

50 1 1

output:

11

result:

ok single line: '11'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

1000 1 1

output:

20

result:

ok single line: '20'

Test #14:

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

input:

1000000 1 1

output:

38

result:

ok single line: '38'

Test #15:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

1000000000 1 1

output:

57

result:

ok single line: '57'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3412kb

input:

1000000000000000000 1 1

output:

114

result:

ok single line: '114'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

100 1 1

output:

13

result:

ok single line: '13'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

900567811781994725 1 1

output:

113

result:

ok single line: '113'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3500kb

input:

900567811781994726 1 1

output:

114

result:

ok single line: '114'

Subtask #2:

score: 40
Accepted

Test #20:

score: 40
Accepted
time: 2ms
memory: 3412kb

input:

1000 1 1

output:

20

result:

ok single line: '20'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

1000 1000 1

output:

2000

result:

ok single line: '2000'

Test #22:

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

input:

1000 1 1000

output:

10010

result:

ok single line: '10010'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

1000 1 50

output:

510

result:

ok single line: '510'

Test #24:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

1000 40 50

output:

900

result:

ok single line: '900'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

1000 90 50

output:

1200

result:

ok single line: '1200'

Test #26:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

1000 200 50

output:

1750

result:

ok single line: '1750'

Test #27:

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

input:

1000 60 50

output:

1050

result:

ok single line: '1050'

Test #28:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

1000 450 50

output:

2750

result:

ok single line: '2750'

Test #29:

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

input:

1000 1699 50

output:

6497

result:

ok single line: '6497'

Test #30:

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

input:

1000 1700 50

output:

6500

result:

ok single line: '6500'

Test #31:

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

input:

1000 1701 50

output:

6502

result:

ok single line: '6502'

Test #32:

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

input:

1000 20 21

output:

410

result:

ok single line: '410'

Test #33:

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

input:

1000 20 20

output:

400

result:

ok single line: '400'

Test #34:

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

input:

1000 20 5

output:

175

result:

ok single line: '175'

Test #35:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

1000000 100 1

output:

523

result:

ok single line: '523'

Test #36:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

1000 20 4

output:

156

result:

ok single line: '156'

Test #37:

score: 0
Accepted
time: 2ms
memory: 3500kb

input:

1000 20 3

output:

137

result:

ok single line: '137'

Test #38:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

1000 20 2

output:

116

result:

ok single line: '116'

Test #39:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

1000 20 1

output:

88

result:

ok single line: '88'

Test #40:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

900 20 6

output:

190

result:

ok single line: '190'

Test #41:

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

input:

800 20 6

output:

188

result:

ok single line: '188'

Test #42:

score: 0
Accepted
time: 2ms
memory: 3368kb

input:

700 20 6

output:

182

result:

ok single line: '182'

Test #43:

score: 0
Accepted
time: 2ms
memory: 3496kb

input:

600 20 6

output:

176

result:

ok single line: '176'

Test #44:

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

input:

1000 1000000 1

output:

1001000

result:

ok single line: '1001000'

Test #45:

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

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: 2ms
memory: 3488kb

input:

100000 1 1

output:

32

result:

ok single line: '32'

Test #47:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

100000 1 2

output:

51

result:

ok single line: '51'

Test #48:

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

input:

100000 1 3

output:

68

result:

ok single line: '68'

Test #49:

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

input:

100000 2 1

output:

42

result:

ok single line: '42'

Test #50:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

100000 2 3

output:

84

result:

ok single line: '84'

Test #51:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

100000 2 5

output:

119

result:

ok single line: '119'

Test #52:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

100000 3 1

output:

50

result:

ok single line: '50'

Test #53:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

100000 3 2

output:

74

result:

ok single line: '74'

Test #54:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

100000 3 4

output:

116

result:

ok single line: '116'

Test #55:

score: 0
Accepted
time: 2ms
memory: 3512kb

input:

100000 3 5

output:

135

result:

ok single line: '135'

Test #56:

score: 0
Accepted
time: 2ms
memory: 3492kb

input:

100000 3 7

output:

170

result:

ok single line: '170'

Test #57:

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

input:

100000 99 100

output:

3188

result:

ok single line: '3188'

Test #58:

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

input:

100000 100 51

output:

2122

result:

ok single line: '2122'

Test #59:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

100000 100 50

output:

2100

result:

ok single line: '2100'

Test #60:

score: 0
Accepted
time: 2ms
memory: 3508kb

input:

100000 100 49

output:

2074

result:

ok single line: '2074'

Test #61:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

999999999999999999 7654321 1234567

output:

320493722

result:

ok single line: '320493722'

Test #62:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

100000 100 21

output:

1330

result:

ok single line: '1330'

Test #63:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

100000 100 20

output:

1300

result:

ok single line: '1300'

Test #64:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

100000 100 19

output:

1265

result:

ok single line: '1265'

Test #65:

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

input:

100000 100 5

output:

730

result:

ok single line: '730'

Test #66:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

100000 100 3

output:

604

result:

ok single line: '604'

Test #67:

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

input:

100000 100 1

output:

437

result:

ok single line: '437'

Test #68:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

100000 1000 1

output:

2631

result:

ok single line: '2631'

Test #69:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

100000 99367 1

output:

199365

result:

ok single line: '199365'

Test #70:

score: 0
Accepted
time: 2ms
memory: 3396kb

input:

100000 99368 1

output:

199367

result:

ok single line: '199367'

Test #71:

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

input:

100000 99369 1

output:

199369

result:

ok single line: '199369'

Test #72:

score: 0
Accepted
time: 2ms
memory: 3508kb

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: 2ms
memory: 3492kb

input:

774840977 1 1

output:

56

result:

ok single line: '56'

Test #74:

score: 0
Accepted
time: 2ms
memory: 3504kb

input:

774840978 1 1

output:

57

result:

ok single line: '57'

Test #75:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

800000000 2 1

output:

74

result:

ok single line: '74'

Test #76:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

900000000 2 1

output:

75

result:

ok single line: '75'

Test #77:

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

input:

100000000 1 2

output:

80

result:

ok single line: '80'

Test #78:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

1000000000 1 2

output:

90

result:

ok single line: '90'

Test #79:

score: 0
Accepted
time: 2ms
memory: 3360kb

input:

1000000000 2 3

output:

150

result:

ok single line: '150'

Test #80:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

500000000 1 3

output:

116

result:

ok single line: '116'

Test #81:

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

input:

600000000 1 3

output:

118

result:

ok single line: '118'

Test #82:

score: 0
Accepted
time: 2ms
memory: 3492kb

input:

700000000 1 3

output:

119

result:

ok single line: '119'

Test #83:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

1000000000 100 1

output:

784

result:

ok single line: '784'

Test #84:

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

input:

1000000000 1000 1

output:

4708

result:

ok single line: '4708'

Test #85:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

1000000000 31267 1

output:

96799

result:

ok single line: '96799'

Test #86:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

1000000000 31268 1

output:

96802

result:

ok single line: '96802'

Test #87:

score: 0
Accepted
time: 2ms
memory: 3400kb

input:

1000000000 31269 1

output:

96805

result:

ok single line: '96805'

Test #88:

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

input:

1000000000000000000 300000000 100000000

output:

18000000000

result:

ok single line: '18000000000'

Test #89:

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

input:

1000000000 1000000000 1

output:

2000000000

result:

ok single line: '2000000000'

Test #90:

score: 0
Accepted
time: 2ms
memory: 3464kb

input:

1000000000 900000000 1

output:

1800063244

result:

ok single line: '1800063244'

Test #91:

score: 0
Accepted
time: 2ms
memory: 3348kb

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: 2ms
memory: 3556kb

input:

1000000000000000000 1 1

output:

114

result:

ok single line: '114'

Test #93:

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

input:

1000000000000000000 2 1

output:

150

result:

ok single line: '150'

Test #94:

score: 0
Accepted
time: 2ms
memory: 3476kb

input:

1000000000000000000 1 2

output:

180

result:

ok single line: '180'

Test #95:

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

input:

999999999999999999 3 4

output:

416

result:

ok single line: '416'

Test #96:

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

input:

879609302220800000 5 2

output:

330

result:

ok single line: '330'

Test #97:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

879609302220799999 5 2

output:

329

result:

ok single line: '329'

Test #98:

score: 0
Accepted
time: 2ms
memory: 3500kb

input:

999999999999999999 523 1

output:

5598

result:

ok single line: '5598'

Test #99:

score: 0
Accepted
time: 2ms
memory: 3480kb

input:

999999999999999999 524 1

output:

5607

result:

ok single line: '5607'

Test #100:

score: 0
Accepted
time: 2ms
memory: 3488kb

input:

999999999999999999 525 1

output:

5615

result:

ok single line: '5615'

Test #101:

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

input:

999999999999999999 999999999 1

output:

3002999994

result:

ok single line: '3002999994'

Test #102:

score: 0
Accepted
time: 2ms
memory: 3560kb

input:

1000000000000000000 1000 1

output:

9415

result:

ok single line: '9415'

Test #103:

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

input:

1000000000000000000 999996741 71906

output:

6430985011

result:

ok single line: '6430985011'

Test #104:

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

input:

1000000000000000000 999996742 71906

output:

6430985016

result:

ok single line: '6430985016'

Test #105:

score: 0
Accepted
time: 2ms
memory: 3432kb

input:

1000000000000000000 999996743 71906

output:

6430985021

result:

ok single line: '6430985021'

Test #106:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

1000000000000000000 1 1000000000

output:

60000000060

result:

ok single line: '60000000060'

Test #107:

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

input:

1000000000000000000 10 10

output:

1140

result:

ok single line: '1140'

Test #108:

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

input:

1000000000000000000 10 4

output:

660

result:

ok single line: '660'

Test #109:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

1000000000000000000 10 3

output:

568

result:

ok single line: '568'

Extra Test:

score: 0
Extra Test Passed