QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136607#235. Maximum Multiplesalvator_noster#0 167ms11476kbC++17567b2023-08-09 09:19:272023-08-09 09:19:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-09 09:19:28]
  • 评测
  • 测评结果:0
  • 用时:167ms
  • 内存:11476kb
  • [2023-08-09 09:19:27]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int MAX_N = 1000000 + 5;

ll f[MAX_N];

void init() {
    const int n = 1000000;
    memset(f, -1, sizeof(f));
    for (int i = 1; i <= n; i ++) {
        for (int j = i + i, k = 2; i + j <= n; j += i, k ++) {
            f[i + j] = max(f[i + j], 1ll * i * i * i * k / 2 * (k - k / 2));
        }
    }
}

int main() {
    init();
    int N, T;
    scanf("%d", &T);
    while (T --) {
        scanf("%d", &N);
        printf("%lld\n", f[N]);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 167ms
memory: 11476kb

input:

1000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...

output:

-1
-1
1
2
4
8
9
24
27
32
25
80
36
72
125
192
64
216
81
374
343
200
121
648
500
288
729
1028
196
1000
225
1536
1331
512
1372
2186
324
648
2197
3000
400
2744
441
3992
3375
968
529
5184
3087
4000
4913
6590
676
5832
5324
8232
6859
1568
841
10124
900
1800
9261
12288
8788
10648
1089
14738
12167
10976
1225...

result:

wrong answer 5th lines differ - expected: '-1', found: '4'