QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212822#6829. It Takes Two of Twonameless_story#AC ✓13ms68456kbC++23997b2023-10-13 20:53:112023-10-13 20:53:12

Judging History

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

  • [2023-10-13 20:53:12]
  • 评测
  • 测评结果:AC
  • 用时:13ms
  • 内存:68456kb
  • [2023-10-13 20:53:11]
  • 提交

answer

#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef double db;
template<class T1,class T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; }return 0; }
#define all(x) (x).begin(),(x).end()
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cout<<fixed<<setprecision(15);
	int n,i,j,k;
	cin>>n;
	vector f(n+1,vector(n+1,vector<db>(n+1)));
	for (i=0; i<=n; i++) for (j=0; j*2+i<=n; j++) for (k=0; k*3+j*2+i<=n; k++) if (k||i+j>1)
	{
		db tot=n*n,tmp=1;
		db p11=i*(i-1),p22=j*(j-1)*4,p33=k*(k-1)*4+k*2,p23=j*k*8,p12=i*j*4,p13=i*k*4;
		p11/=tot; p22/=tot; p33/=tot; p23/=tot; p12/=tot; p13/=tot;
		if (i>=2) tmp+=f[i-2][j+1][k]*p11;
		if (j>=2) tmp+=f[i][j-2][k+1]*p22;
		if (k) tmp+=f[i][j][k-1]*p33;
		if (k&&j) tmp+=f[i][j-1][k]*p23;
		if (i&&j) tmp+=f[i-1][j-1][k+1]*p12;
		if (i&&k) tmp+=f[i-1][j][k]*p13;
		f[i][j][k]=tmp/(p11+p22+p33+p23+p12+p13);
		// cerr<<i<<' '<<j<<' '<<k<<' '<<f[i][j][k]<<endl;
	}
	cout<<f[n][0][0]<<endl;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3860kb

input:

1

output:

0.000000000000000

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #2:

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

input:

2

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #3:

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

input:

3

output:

8.250000000000000

result:

ok found '8.2500000', expected '8.2500000', error '0.0000000'

Test #4:

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

input:

4

output:

11.333333333333334

result:

ok found '11.3333333', expected '11.3333333', error '0.0000000'

Test #5:

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

input:

5

output:

17.048611111111111

result:

ok found '17.0486111', expected '17.0486111', error '0.0000000'

Test #6:

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

input:

6

output:

26.034065934065925

result:

ok found '26.0340659', expected '26.0340659', error '0.0000000'

Test #7:

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

input:

7

output:

35.497562603088909

result:

ok found '35.4975626', expected '35.4975626', error '0.0000000'

Test #8:

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

input:

8

output:

46.229305310906753

result:

ok found '46.2293053', expected '46.2293053', error '0.0000000'

Test #9:

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

input:

9

output:

58.614396352550237

result:

ok found '58.6143964', expected '58.6143964', error '0.0000000'

Test #10:

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

input:

10

output:

72.437768422330379

result:

ok found '72.4377684', expected '72.4377684', error '0.0000000'

Test #11:

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

input:

11

output:

87.678796658547867

result:

ok found '87.6787967', expected '87.6787967', error '0.0000000'

Test #12:

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

input:

12

output:

104.361318978592834

result:

ok found '104.3613190', expected '104.3613190', error '0.0000000'

Test #13:

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

input:

13

output:

122.481859320682929

result:

ok found '122.4818593', expected '122.4818593', error '0.0000000'

Test #14:

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

input:

14

output:

142.036524363616138

result:

ok found '142.0365244', expected '142.0365244', error '0.0000000'

Test #15:

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

input:

15

output:

163.023991777953171

result:

ok found '163.0239918', expected '163.0239918', error '0.0000000'

Test #16:

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

input:

16

output:

185.442941964829345

result:

ok found '185.4429420', expected '185.4429420', error '0.0000000'

Test #17:

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

input:

17

output:

209.292064565717510

result:

ok found '209.2920646', expected '209.2920646', error '0.0000000'

Test #18:

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

input:

18

output:

234.570195335850144

result:

ok found '234.5701953', expected '234.5701953', error '0.0000000'

Test #19:

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

input:

19

output:

261.276282114218418

result:

ok found '261.2762821', expected '261.2762821', error '0.0000000'

Test #20:

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

input:

20

output:

289.409362214572639

result:

ok found '289.4093622', expected '289.4093622', error '0.0000000'

Test #21:

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

input:

21

output:

318.968551413796206

result:

ok found '318.9685514', expected '318.9685514', error '0.0000000'

Test #22:

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

input:

22

output:

349.953034120224231

result:

ok found '349.9530341', expected '349.9530341', error '0.0000000'

Test #23:

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

input:

23

output:

382.362054918896035

result:

ok found '382.3620549', expected '382.3620549', error '0.0000000'

Test #24:

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

input:

24

output:

416.194911538833821

result:

ok found '416.1949115', expected '416.1949115', error '0.0000000'

Test #25:

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

input:

25

output:

451.450948920400208

result:

ok found '451.4509489', expected '451.4509489', error '0.0000000'

Test #26:

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

input:

26

output:

488.129554163017303

result:

ok found '488.1295542', expected '488.1295542', error '0.0000000'

Test #27:

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

input:

27

output:

526.230152194751781

result:

ok found '526.2301522', expected '526.2301522', error '0.0000000'

Test #28:

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

input:

28

output:

565.752202037190273

result:

ok found '565.7522020', expected '565.7522020', error '0.0000000'

Test #29:

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

input:

29

output:

606.695193564778151

result:

ok found '606.6951936', expected '606.6951936', error '0.0000000'

Test #30:

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

input:

30

output:

649.058644677851134

result:

ok found '649.0586447', expected '649.0586447', error '0.0000000'

Test #31:

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

input:

31

output:

692.842098824102891

result:

ok found '692.8420988', expected '692.8420988', error '0.0000000'

Test #32:

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

input:

32

output:

738.045122815354716

result:

ok found '738.0451228', expected '738.0451228', error '0.0000000'

Test #33:

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

input:

33

output:

784.667304896029464

result:

ok found '784.6673049', expected '784.6673049', error '0.0000000'

Test #34:

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

input:

34

output:

832.708253027309411

result:

ok found '832.7082530', expected '832.7082530', error '0.0000000'

Test #35:

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

input:

35

output:

882.167593357082637

result:

ok found '882.1675934', expected '882.1675934', error '0.0000000'

Test #36:

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

input:

36

output:

933.044968850664418

result:

ok found '933.0449689', expected '933.0449689', error '0.0000000'

Test #37:

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

input:

37

output:

985.340038061258838

result:

ok found '985.3400381', expected '985.3400381', error '0.0000000'

Test #38:

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

input:

38

output:

1039.052474022376146

result:

ok found '1039.0524740', expected '1039.0524740', error '0.0000000'

Test #39:

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

input:

39

output:

1094.181963247171097

result:

ok found '1094.1819632', expected '1094.1819632', error '0.0000000'

Test #40:

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

input:

40

output:

1150.728204821761210

result:

ok found '1150.7282048', expected '1150.7282048', error '0.0000000'

Test #41:

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

input:

41

output:

1208.690909581553342

result:

ok found '1208.6909096', expected '1208.6909096', error '0.0000000'

Test #42:

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

input:

42

output:

1268.069799361029482

result:

ok found '1268.0697994', expected '1268.0697994', error '0.0000000'

Test #43:

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

input:

43

output:

1328.864606308851535

result:

ok found '1328.8646063', expected '1328.8646063', error '0.0000000'

Test #44:

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

input:

44

output:

1391.075072261097830

result:

ok found '1391.0750723', expected '1391.0750723', error '0.0000000'

Test #45:

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

input:

45

output:

1454.700948166544777

result:

ok found '1454.7009482', expected '1454.7009482', error '0.0000000'

Test #46:

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

input:

46

output:

1519.741993558465083

result:

ok found '1519.7419936', expected '1519.7419936', error '0.0000000'

Test #47:

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

input:

47

output:

1586.197976068312073

result:

ok found '1586.1979761', expected '1586.1979761', error '0.0000000'

Test #48:

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

input:

48

output:

1654.068670977082547

result:

ok found '1654.0686710', expected '1654.0686710', error '0.0000000'

Test #49:

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

input:

49

output:

1723.353860800708162

result:

ok found '1723.3538608', expected '1723.3538608', error '0.0000000'

Test #50:

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

input:

50

output:

1794.053334906167720

result:

ok found '1794.0533349', expected '1794.0533349', error '0.0000000'

Test #51:

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

input:

51

output:

1866.166889155605531

result:

ok found '1866.1668892', expected '1866.1668892', error '0.0000000'

Test #52:

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

input:

52

output:

1939.694325575726452

result:

ok found '1939.6943256', expected '1939.6943256', error '0.0000000'

Test #53:

score: 0
Accepted
time: 3ms
memory: 33152kb

input:

153

output:

16628.002670533587661

result:

ok found '16628.0026705', expected '16628.0026705', error '0.0000000'

Test #54:

score: 0
Accepted
time: 4ms
memory: 33516kb

input:

154

output:

16845.200458596089447

result:

ok found '16845.2004586', expected '16845.2004586', error '0.0000000'

Test #55:

score: 0
Accepted
time: 5ms
memory: 34392kb

input:

155

output:

17063.803707668947027

result:

ok found '17063.8037077', expected '17063.8037077', error '0.0000000'

Test #56:

score: 0
Accepted
time: 4ms
memory: 34776kb

input:

156

output:

17283.812380396797380

result:

ok found '17283.8123804', expected '17283.8123804', error '0.0000000'

Test #57:

score: 0
Accepted
time: 4ms
memory: 35484kb

input:

157

output:

17505.226439772864978

result:

ok found '17505.2264398', expected '17505.2264398', error '0.0000000'

Test #58:

score: 0
Accepted
time: 4ms
memory: 35924kb

input:

158

output:

17728.045849134410673

result:

ok found '17728.0458491', expected '17728.0458491', error '0.0000000'

Test #59:

score: 0
Accepted
time: 8ms
memory: 36732kb

input:

159

output:

17952.270572154986439

result:

ok found '17952.2705722', expected '17952.2705722', error '0.0000000'

Test #60:

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

input:

160

output:

18177.900572840364475

result:

ok found '18177.9005728', expected '18177.9005728', error '0.0000000'

Test #61:

score: 0
Accepted
time: 4ms
memory: 37904kb

input:

161

output:

18404.935815524164354

result:

ok found '18404.9358155', expected '18404.9358155', error '0.0000000'

Test #62:

score: 0
Accepted
time: 3ms
memory: 38308kb

input:

162

output:

18633.376264861752134

result:

ok found '18633.3762649', expected '18633.3762649', error '0.0000000'

Test #63:

score: 0
Accepted
time: 5ms
memory: 39176kb

input:

163

output:

18863.221885824863421

result:

ok found '18863.2218858', expected '18863.2218858', error '0.0000000'

Test #64:

score: 0
Accepted
time: 3ms
memory: 39644kb

input:

164

output:

19094.472643698743923

result:

ok found '19094.4726437', expected '19094.4726437', error '0.0000000'

Test #65:

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

input:

165

output:

19327.128504074338707

result:

ok found '19327.1285041', expected '19327.1285041', error '0.0000000'

Test #66:

score: 0
Accepted
time: 7ms
memory: 40980kb

input:

166

output:

19561.189432846193085

result:

ok found '19561.1894328', expected '19561.1894328', error '0.0000000'

Test #67:

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

input:

167

output:

19796.655396207923332

result:

ok found '19796.6553962', expected '19796.6553962', error '0.0000000'

Test #68:

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

input:

168

output:

20033.526360645486420

result:

ok found '20033.5263606', expected '20033.5263606', error '0.0000000'

Test #69:

score: 0
Accepted
time: 5ms
memory: 43404kb

input:

169

output:

20271.802292934557045

result:

ok found '20271.8022929', expected '20271.8022929', error '0.0000000'

Test #70:

score: 0
Accepted
time: 7ms
memory: 43660kb

input:

170

output:

20511.483160136460356

result:

ok found '20511.4831601', expected '20511.4831601', error '0.0000000'

Test #71:

score: 0
Accepted
time: 6ms
memory: 44656kb

input:

171

output:

20752.568929592394852

result:

ok found '20752.5689296', expected '20752.5689296', error '0.0000000'

Test #72:

score: 0
Accepted
time: 4ms
memory: 45152kb

input:

172

output:

20995.059568922151811

result:

ok found '20995.0595689', expected '20995.0595689', error '0.0000000'

Test #73:

score: 0
Accepted
time: 4ms
memory: 46064kb

input:

173

output:

21238.955046015984408

result:

ok found '21238.9550460', expected '21238.9550460', error '0.0000000'

Test #74:

score: 0
Accepted
time: 3ms
memory: 46688kb

input:

174

output:

21484.255329035750037

result:

ok found '21484.2553290', expected '21484.2553290', error '0.0000000'

Test #75:

score: 0
Accepted
time: 11ms
memory: 47528kb

input:

175

output:

21730.960386405331519

result:

ok found '21730.9603864', expected '21730.9603864', error '0.0000000'

Test #76:

score: 0
Accepted
time: 4ms
memory: 48036kb

input:

176

output:

21979.070186813085456

result:

ok found '21979.0701868', expected '21979.0701868', error '0.0000000'

Test #77:

score: 0
Accepted
time: 3ms
memory: 49060kb

input:

177

output:

22228.584699201986950

result:

ok found '22228.5846992', expected '22228.5846992', error '0.0000000'

Test #78:

score: 0
Accepted
time: 3ms
memory: 49556kb

input:

178

output:

22479.503892770226230

result:

ok found '22479.5038928', expected '22479.5038928', error '0.0000000'

Test #79:

score: 0
Accepted
time: 3ms
memory: 50692kb

input:

179

output:

22731.827736967366945

result:

ok found '22731.8277370', expected '22731.8277370', error '0.0000000'

Test #80:

score: 0
Accepted
time: 3ms
memory: 51012kb

input:

180

output:

22985.556201487946964

result:

ok found '22985.5562015', expected '22985.5562015', error '0.0000000'

Test #81:

score: 0
Accepted
time: 8ms
memory: 52112kb

input:

181

output:

23240.689256270637998

result:

ok found '23240.6892563', expected '23240.6892563', error '0.0000000'

Test #82:

score: 0
Accepted
time: 4ms
memory: 52648kb

input:

182

output:

23497.226871495604428

result:

ok found '23497.2268715', expected '23497.2268715', error '0.0000000'

Test #83:

score: 0
Accepted
time: 3ms
memory: 53712kb

input:

183

output:

23755.169017578111379

result:

ok found '23755.1690176', expected '23755.1690176', error '0.0000000'

Test #84:

score: 0
Accepted
time: 4ms
memory: 54220kb

input:

184

output:

24014.515665167389670

result:

ok found '24014.5156652', expected '24014.5156652', error '0.0000000'

Test #85:

score: 0
Accepted
time: 3ms
memory: 55372kb

input:

185

output:

24275.266785143383458

result:

ok found '24275.2667851', expected '24275.2667851', error '0.0000000'

Test #86:

score: 0
Accepted
time: 7ms
memory: 55924kb

input:

186

output:

24537.422348613803479

result:

ok found '24537.4223486', expected '24537.4223486', error '0.0000000'

Test #87:

score: 0
Accepted
time: 7ms
memory: 57032kb

input:

187

output:

24800.982326910187112

result:

ok found '24800.9823269', expected '24800.9823269', error '0.0000000'

Test #88:

score: 0
Accepted
time: 3ms
memory: 57544kb

input:

188

output:

25065.946691585693770

result:

ok found '25065.9466916', expected '25065.9466916', error '0.0000000'

Test #89:

score: 0
Accepted
time: 4ms
memory: 58696kb

input:

189

output:

25332.315414411557867

result:

ok found '25332.3154144', expected '25332.3154144', error '0.0000000'

Test #90:

score: 0
Accepted
time: 8ms
memory: 59284kb

input:

190

output:

25600.088467373796448

result:

ok found '25600.0884674', expected '25600.0884674', error '0.0000000'

Test #91:

score: 0
Accepted
time: 4ms
memory: 60432kb

input:

191

output:

25869.265822673703951

result:

ok found '25869.2658227', expected '25869.2658227', error '0.0000000'

Test #92:

score: 0
Accepted
time: 8ms
memory: 61000kb

input:

192

output:

26139.847452719051944

result:

ok found '26139.8474527', expected '26139.8474527', error '0.0000000'

Test #93:

score: 0
Accepted
time: 4ms
memory: 62208kb

input:

193

output:

26411.833330128323723

result:

ok found '26411.8333301', expected '26411.8333301', error '0.0000000'

Test #94:

score: 0
Accepted
time: 7ms
memory: 62984kb

input:

194

output:

26685.223427721975895

result:

ok found '26685.2234277', expected '26685.2234277', error '0.0000000'

Test #95:

score: 0
Accepted
time: 4ms
memory: 64040kb

input:

195

output:

26960.017718522987707

result:

ok found '26960.0177185', expected '26960.0177185', error '0.0000000'

Test #96:

score: 0
Accepted
time: 13ms
memory: 64808kb

input:

196

output:

27236.216175754681899

result:

ok found '27236.2161758', expected '27236.2161758', error '0.0000000'

Test #97:

score: 0
Accepted
time: 3ms
memory: 65928kb

input:

197

output:

27513.818772835908021

result:

ok found '27513.8187728', expected '27513.8187728', error '0.0000000'

Test #98:

score: 0
Accepted
time: 8ms
memory: 66576kb

input:

198

output:

27792.825483381122467

result:

ok found '27792.8254834', expected '27792.8254834', error '0.0000000'

Test #99:

score: 0
Accepted
time: 8ms
memory: 67928kb

input:

199

output:

28073.236281195695483

result:

ok found '28073.2362812', expected '28073.2362812', error '0.0000000'

Test #100:

score: 0
Accepted
time: 8ms
memory: 68456kb

input:

200

output:

28355.051140275543730

result:

ok found '28355.0511403', expected '28355.0511403', error '0.0000000'