ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214390 | #2386. 回忆 | KXG | 20 | 16ms | 2392kb | C++11 | 1.4kb | 2024-11-18 19:40:37 | 2024-11-19 08:29:31 |
answer
#include <cstdio>
#include <algorithm>
using namespace std;
int n, m, tot;
long long a[100010], sum[310][310], all[310], totalsum;
pair<int, int> id[100010];
int main() {
scanf("%d", &n);
m = n * (n - 1) / 2;
for (int i = 1; i <= m; i++) {
scanf("%lld", &a[i]);
}
if (n == 1) {
printf("0\n");
return 0;
}
if (n == 2) {
printf("0 %lld\n", a[1]);
return 0;
}
sort(a + 1, a + m + 1);
for (int i = 2; i <= 2 * n; i++) {
for (int j = 1; j < i; j++) {
int k = i - j;
if (j <= n && k <= n && j < k) {
id[++tot] = {j, k};
}
}
}
for (int i = 1; i <= m; i++) {
sum[id[i].first][id[i].second] = a[i];
}
// for (int i = 1; i <= n; i++) {
// for (int j = i + 1; j <= n; j++) {
// printf("a[%d] + a[%d] = %lld\n", i, j, sum[i][j]);
// }
// }
totalsum = sum[1][n];
for (int i = 1; i < n; i++) {
totalsum += sum[i][i + 1];
}
totalsum /= 2;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (j < i) {
all[i] += sum[j][i];
} else {
all[i] += sum[i][j];
}
}
all[i] -= totalsum;
all[i] /= n - 2;
printf("%lld ", all[i]);
}
printf("\n");
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1312kb
input:
5 4 5 9 9 10 13 14 14 15 19
output:
0 4 5 9 10
result:
ok Your answer is correct.
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1308kb
input:
5 5 9 9 10 12 12 13 16 17 17
output:
1 3 7 8 9
result:
wrong answer Your answer is incorrect.
Test #3:
score: 10
Accepted
time: 0ms
memory: 1312kb
input:
5 10 11 12 13 13 14 15 15 16 17
output:
4 6 7 8 9
result:
ok Your answer is correct.
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1440kb
input:
50 9 13 15 20 20 20 21 22 22 26 26 26 27 27 27 28 29 31 31 32 32 33 33 33 33 33 34 34 34 35 35 36 37...
output:
6 8 10 12 14 16 18 20 22 24 26 28 29 31 33 35 37 39 40 42 44 46 47 49 51 53 54 56 58 60 61 63 65 67 ...
result:
wrong answer Your answer is incorrect.
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1440kb
input:
50 9 11 14 14 16 16 16 18 19 19 21 21 21 21 22 22 23 23 23 23 24 25 25 26 26 26 26 26 26 26 27 27 27...
output:
1 3 4 6 8 9 11 13 15 16 18 19 21 23 24 26 28 29 31 33 34 36 38 39 41 43 45 46 48 50 51 53 55 57 59 6...
result:
wrong answer Your answer is incorrect.
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1440kb
input:
50 7 9 12 16 19 21 26 27 29 29 31 33 33 33 34 35 36 36 36 36 37 38 38 38 38 39 39 40 40 40 41 41 42 ...
output:
10 13 16 18 20 23 25 27 29 31 33 35 37 39 41 43 45 47 49 51 53 55 57 58 60 62 64 66 68 70 72 73 75 7...
result:
wrong answer Your answer is incorrect.
Test #7:
score: 0
Wrong Answer
time: 5ms
memory: 2388kb
input:
300 660422 717145 1052261 1191442 1526558 1583281 1636913 1972029 2028752 2207583 2247577 2427928 25...
output:
-863629 -516760 -172194 171403 514874 853596 1192478 1531755 1869753 2208922 2547404 2883471 3221280...
result:
wrong answer Your answer is incorrect.
Test #8:
score: 0
Wrong Answer
time: 3ms
memory: 2392kb
input:
300 1719032 1728175 1968715 2265775 2506315 2515458 2534303 2752316 3002166 3035709 3071903 3081046 ...
output:
-129785 199246 525621 853383 1180929 1506913 1834514 2160159 2484754 2812489 3138176 3464396 3789604...
result:
wrong answer Your answer is incorrect.
Test #9:
score: 0
Wrong Answer
time: 3ms
memory: 2388kb
input:
300 725653 809390 819383 974701 984694 1058923 1068431 1068916 1152653 1317964 1422171 1432164 15159...
output:
-723785 -370685 -18084 334176 682897 1032063 1382557 1732827 2084162 2433056 2781470 3129714 3477551...
result:
wrong answer Your answer is incorrect.
Test #10:
score: 0
Wrong Answer
time: 5ms
memory: 2388kb
input:
300 2355315 3132486 3240117 3325566 3662015 3854305 3961936 4047385 4053636 4142315 4383834 4725290 ...
output:
-1495864 -1179912 -862363 -547712 -234242 79126 389881 700042 1011371 1323385 1634733 1945774 225691...
result:
wrong answer Your answer is incorrect.