QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#59087#100. TetrahedronshhblwAC ✓566ms66108kbC++981005b2022-10-27 22:15:552022-10-27 22:15:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-27 22:15:59]
  • 评测
  • 测评结果:AC
  • 用时:566ms
  • 内存:66108kb
  • [2022-10-27 22:15:55]
  • 提交

answer

#include <cstdio>
#include <iostream>
#include <algorithm>

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define fore(i, a, n) for(int i = (int)(a); i <= (int)(n); ++i)
#define x first
#define y second
#define mp make_pair

using namespace std;

const int maxn = 4000;

double x[maxn*maxn/2];
int k;

int main()
{
    int n;
    cin >> n;
    long long n12 = (n-1)*(n-1);
    long long n14 = n12*n12;
    long long cn12 = (n-1)*(n-2)/2;
    long long ans = 0, ind = 1;
    ans += 12*n14;
    ans += 3*cn12*cn12;
    ans += 24*n12*cn12;
    ans += 24*n12*cn12;
    long long ans1a = n14 - n12;
	fore(a, 1, n-1)
		fore(b, 1, n-1)
			if(a+b>n)
				x[k++] = a*b / (double)((n-a)*(n-b));
	sort(x, x + k);
    for (int i = 1; i < k; i++)
        if (x[i] == x[i-1])
            ind++;
        else {
            ans1a -= 2*ind*ind;
            ind = 1;
        }
    if(k>0) ans1a -= 2*ind*ind;
    ans += 3*ans1a;
    cout << ans << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3620kb

input:

2

output:

12

result:

ok 1 number(s): "12"

Test #2:

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

input:

37

output:

65561472

result:

ok 1 number(s): "65561472"

Test #3:

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

input:

3

output:

417

result:

ok 1 number(s): "417"

Test #4:

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

input:

4

output:

2481

result:

ok 1 number(s): "2481"

Test #5:

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

input:

5

output:

8448

result:

ok 1 number(s): "8448"

Test #6:

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

input:

6

output:

21492

result:

ok 1 number(s): "21492"

Test #7:

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

input:

7

output:

45765

result:

ok 1 number(s): "45765"

Test #8:

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

input:

8

output:

86349

result:

ok 1 number(s): "86349"

Test #9:

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

input:

9

output:

149280

result:

ok 1 number(s): "149280"

Test #10:

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

input:

10

output:

241548

result:

ok 1 number(s): "241548"

Test #11:

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

input:

11

output:

371121

result:

ok 1 number(s): "371121"

Test #12:

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

input:

12

output:

547137

result:

ok 1 number(s): "547137"

Test #13:

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

input:

13

output:

778968

result:

ok 1 number(s): "778968"

Test #14:

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

input:

14

output:

1077852

result:

ok 1 number(s): "1077852"

Test #15:

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

input:

15

output:

1455501

result:

ok 1 number(s): "1455501"

Test #16:

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

input:

16

output:

1924269

result:

ok 1 number(s): "1924269"

Test #17:

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

input:

17

output:

2498208

result:

ok 1 number(s): "2498208"

Test #18:

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

input:

18

output:

3192204

result:

ok 1 number(s): "3192204"

Test #19:

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

input:

19

output:

4021137

result:

ok 1 number(s): "4021137"

Test #20:

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

input:

20

output:

5002401

result:

ok 1 number(s): "5002401"

Test #21:

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

input:

21

output:

6152520

result:

ok 1 number(s): "6152520"

Test #22:

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

input:

22

output:

7490148

result:

ok 1 number(s): "7490148"

Test #23:

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

input:

23

output:

9035637

result:

ok 1 number(s): "9035637"

Test #24:

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

input:

24

output:

10808829

result:

ok 1 number(s): "10808829"

Test #25:

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

input:

25

output:

12830472

result:

ok 1 number(s): "12830472"

Test #26:

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

input:

26

output:

15122892

result:

ok 1 number(s): "15122892"

Test #27:

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

input:

27

output:

17710593

result:

ok 1 number(s): "17710593"

Test #28:

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

input:

28

output:

20615985

result:

ok 1 number(s): "20615985"

Test #29:

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

input:

29

output:

23865144

result:

ok 1 number(s): "23865144"

Test #30:

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

input:

30

output:

27485172

result:

ok 1 number(s): "27485172"

Test #31:

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

input:

31

output:

31500117

result:

ok 1 number(s): "31500117"

Test #32:

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

input:

32

output:

35941269

result:

ok 1 number(s): "35941269"

Test #33:

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

input:

33

output:

40835784

result:

ok 1 number(s): "40835784"

Test #34:

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

input:

34

output:

46213188

result:

ok 1 number(s): "46213188"

Test #35:

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

input:

35

output:

52106697

result:

ok 1 number(s): "52106697"

Test #36:

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

input:

36

output:

58545057

result:

ok 1 number(s): "58545057"

Test #37:

score: 0
Accepted
time: 566ms
memory: 66108kb

input:

4000

output:

10164196900132989

result:

ok 1 number(s): "10164196900132989"

Test #38:

score: 0
Accepted
time: 325ms
memory: 42824kb

input:

3172

output:

4018224734920449

result:

ok 1 number(s): "4018224734920449"

Test #39:

score: 0
Accepted
time: 36ms
memory: 9116kb

input:

1194

output:

80475788752884

result:

ok 1 number(s): "80475788752884"

Test #40:

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

input:

479

output:

2072359159125

result:

ok 1 number(s): "2072359159125"

Test #41:

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

input:

126

output:

9654636228

result:

ok 1 number(s): "9654636228"

Test #42:

score: 0
Accepted
time: 22ms
memory: 6188kb

input:

822

output:

18045550290852

result:

ok 1 number(s): "18045550290852"

Test #43:

score: 0
Accepted
time: 270ms
memory: 37012kb

input:

2928

output:

2916975738011877

result:

ok 1 number(s): "2916975738011877"

Test #44:

score: 0
Accepted
time: 47ms
memory: 10036kb

input:

1274

output:

104335421693580

result:

ok 1 number(s): "104335421693580"

Test #45:

score: 0
Accepted
time: 114ms
memory: 17828kb

input:

1921

output:

540003893401944

result:

ok 1 number(s): "540003893401944"

Test #46:

score: 0
Accepted
time: 299ms
memory: 41392kb

input:

3110

output:

3713046514992948

result:

ok 1 number(s): "3713046514992948"

Test #47:

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

input:

691

output:

9001799196273

result:

ok 1 number(s): "9001799196273"

Test #48:

score: 0
Accepted
time: 32ms
memory: 7956kb

input:

1066

output:

51106224390756

result:

ok 1 number(s): "51106224390756"

Test #49:

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

input:

268

output:

201528266361

result:

ok 1 number(s): "201528266361"

Test #50:

score: 0
Accepted
time: 227ms
memory: 31148kb

input:

2659

output:

1983591305458065

result:

ok 1 number(s): "1983591305458065"

Test #51:

score: 0
Accepted
time: 26ms
memory: 6372kb

input:

860

output:

21626448033225

result:

ok 1 number(s): "21626448033225"

Test #52:

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

input:

314

output:

380734623660

result:

ok 1 number(s): "380734623660"

Test #53:

score: 0
Accepted
time: 132ms
memory: 18048kb

input:

1921

output:

540003893401944

result:

ok 1 number(s): "540003893401944"

Test #54:

score: 0
Accepted
time: 325ms
memory: 42796kb

input:

3172

output:

4018224734920449

result:

ok 1 number(s): "4018224734920449"

Test #55:

score: 0
Accepted
time: 79ms
memory: 13112kb

input:

1560

output:

234716061994797

result:

ok 1 number(s): "234716061994797"

Test #56:

score: 0
Accepted
time: 37ms
memory: 6644kb

input:

888

output:

24587664242733

result:

ok 1 number(s): "24587664242733"

Test #57:

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

input:

75

output:

1181582409

result:

ok 1 number(s): "1181582409"

Test #58:

score: 0
Accepted
time: 454ms
memory: 56640kb

input:

3685

output:

7320487107861408

result:

ok 1 number(s): "7320487107861408"

Test #59:

score: 0
Accepted
time: 246ms
memory: 33296kb

input:

2762

output:

2309414180449836

result:

ok 1 number(s): "2309414180449836"

Test #60:

score: 0
Accepted
time: 119ms
memory: 19068kb

input:

1994

output:

626940735928284

result:

ok 1 number(s): "626940735928284"

Test #61:

score: 0
Accepted
time: 98ms
memory: 15640kb

input:

1764

output:

383873642612793

result:

ok 1 number(s): "383873642612793"

Test #62:

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

input:

247

output:

145191715389

result:

ok 1 number(s): "145191715389"