QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244821 | #2686. Exam Redistribution | Fyind# | AC ✓ | 1ms | 3512kb | C++17 | 672b | 2023-11-09 16:17:44 | 2023-11-09 16:17:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define _ <<" "<<
#define sz(x) ((int) (x).size())
typedef pair<int, int> pii;
typedef long long ll;
const int maxn = 5e5 + 5;
int n, m;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
vector<pii> A(n+1);
int sum = 0;
for (int i = 1;i <= n; ++i) {
cin >> A[i].first;
sum += A[i].first;
A[i].second = i;
}
sort(A.begin()+1,A.end());
if (A[n].first > sum-A[n].first) {
cout << "impossible\n";
return 0;
}
for (int i = n;i >= 1; --i) cout << A[i].second << " ";
cout << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3360kb
input:
2 23 23
output:
2 1
result:
ok correct solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3404kb
input:
3 10 20 31
output:
impossible
result:
ok impossible
Test #3:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
3 10 20 30
output:
3 2 1
result:
ok correct solution
Test #4:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
28 95 90 9 60 43 54 14 20 45 23 46 3 9 72 43 52 74 36 6 79 59 66 63 98 37 76 37 58
output:
24 1 2 20 26 17 14 22 23 4 21 28 6 16 11 9 15 5 27 25 18 10 8 7 13 3 19 12
result:
ok correct solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3428kb
input:
21 32 9 48 72 60 45 65 19 18 33 82 20 12 10 4 28 58 83 34 37 29
output:
18 11 4 7 5 17 3 6 20 19 10 1 21 16 12 8 9 13 14 2 15
result:
ok correct solution
Test #6:
score: 0
Accepted
time: 1ms
memory: 3392kb
input:
11 78 55 26 11 79 71 83 24 55 92 60
output:
10 7 5 1 6 11 9 2 3 8 4
result:
ok correct solution
Test #7:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
29 17 98 6 42 3 81 69 98 81 95 54 99 75 35 98 38 20 8 47 20 94 96 22 11 53 17 55 82 26
output:
12 15 8 2 22 10 21 28 9 6 13 7 27 11 25 19 4 16 14 29 23 20 17 26 1 24 18 3 5
result:
ok correct solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3460kb
input:
14 91 45 35 90 82 90 69 42 70 83 64 24 30 41
output:
1 6 4 10 5 9 7 11 2 8 14 3 13 12
result:
ok correct solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
24 56 55 83 11 64 34 56 84 25 96 8 57 55 24 57 48 45 72 1 38 79 15 87 21
output:
10 23 8 3 21 18 5 15 12 7 1 13 2 16 17 20 6 9 14 24 22 4 11 19
result:
ok correct solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
22 18 45 43 9 70 49 69 54 56 53 30 90 9 88 87 50 78 68 61 30 32 35
output:
12 14 15 17 5 7 18 19 9 8 10 16 6 2 3 22 21 20 11 1 13 4
result:
ok correct solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
11 96 35 39 42 82 48 56 26 28 9 22
output:
1 5 7 6 4 3 2 9 8 11 10
result:
ok correct solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
10 86 51 12 47 13 57 45 86 26 86
output:
10 8 1 6 2 4 7 9 5 3
result:
ok correct solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
9 99 64 5 81 28 37 15 84 10
output:
1 8 4 2 6 5 7 9 3
result:
ok correct solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
23 40 68 30 8 92 66 17 98 92 19 2 62 14 74 47 71 57 78 83 61 60 33 14
output:
8 9 5 19 18 14 16 2 6 12 20 21 17 15 1 22 3 10 7 23 13 4 11
result:
ok correct solution
Test #15:
score: 0
Accepted
time: 1ms
memory: 3472kb
input:
5 86 21 43 32 62
output:
1 5 3 4 2
result:
ok correct solution
Test #16:
score: 0
Accepted
time: 1ms
memory: 3460kb
input:
17 86 44 37 66 75 93 32 89 99 99 13 39 78 84 4 40 73
output:
10 9 6 8 1 14 13 5 17 4 2 16 12 3 7 11 15
result:
ok correct solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 3392kb
input:
24 54 22 41 6 32 43 83 59 42 25 32 68 45 18 83 58 97 54 63 43 61 92 99 67
output:
23 17 22 15 7 12 24 19 21 8 16 18 1 13 20 6 9 3 11 5 10 2 14 4
result:
ok correct solution
Test #18:
score: 0
Accepted
time: 1ms
memory: 3456kb
input:
15 7 85 40 39 6 4 40 98 75 71 67 28 17 61 7
output:
8 2 9 10 11 14 7 3 4 12 13 15 1 5 6
result:
ok correct solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3460kb
input:
19 52 55 13 7 48 15 65 31 63 76 61 54 20 35 98 27 29 50 55
output:
15 10 7 9 11 19 2 12 1 18 5 14 8 17 16 13 6 3 4
result:
ok correct solution
Test #20:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
25 30 97 3 80 57 91 16 69 95 67 12 93 97 12 83 8 9 80 72 96 64 52 28 58 100
output:
25 13 2 20 9 12 6 15 18 4 19 8 10 21 24 5 22 1 23 7 14 11 17 16 3
result:
ok correct solution
Test #21:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
21 88 20 74 74 8 83 18 22 7 67 15 98 1 81 76 57 58 80 64 14 80
output:
12 1 6 14 21 18 15 4 3 10 19 17 16 8 2 7 11 20 5 9 13
result:
ok correct solution
Test #22:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
12 59 52 91 42 86 9 33 68 62 84 21 81
output:
3 5 10 12 8 9 1 2 4 7 11 6
result:
ok correct solution
Test #23:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
25 15 14 59 98 62 43 51 81 53 54 60 94 81 84 27 61 83 72 96 92 13 51 36 21 51
output:
4 19 12 20 14 17 13 8 18 5 16 11 3 10 9 25 22 7 6 23 15 24 1 2 21
result:
ok correct solution
Test #24:
score: 0
Accepted
time: 0ms
memory: 3420kb
input:
30 99 77 10 25 37 89 46 16 56 25 4 60 100 78 74 16 57 64 76 45 6 93 27 74 47 78 34 10 43 49
output:
13 1 22 6 26 14 2 19 24 15 18 12 17 9 30 25 7 20 29 5 27 23 10 4 16 8 28 3 21 11
result:
ok correct solution
Test #25:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
30 80 41 67 38 74 18 89 95 3 86 78 70 11 74 78 63 97 95 64 93 15 30 53 53 96 64 63 63 95 41
output:
17 25 29 18 8 20 7 10 1 15 11 14 5 12 3 26 19 28 27 16 24 23 30 2 4 22 6 21 13 9
result:
ok correct solution
Test #26:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
30 4 9 2 5 2 2 5 100 3 4 3 2 4 4 1 6 3 2 5 2 3 1 4 2 6 5 3 3 2 2
output:
impossible
result:
ok impossible
Test #27:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
30 5 9 2 5 2 2 5 100 3 4 3 2 4 4 1 6 3 2 5 2 3 1 4 2 6 5 3 3 2 2
output:
8 2 25 16 26 19 7 4 1 23 14 13 10 28 27 21 17 11 9 30 29 24 20 18 12 6 5 3 22 15
result:
ok correct solution
Test #28:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
30 1 2 1 1 1 1 1 1 20 2 1 1 1 1 1 1 1 100 1 1 1 50 1 1 1 1 1 1 1 1
output:
impossible
result:
ok impossible
Test #29:
score: 0
Accepted
time: 0ms
memory: 3476kb
input:
30 1 2 2 1 1 1 1 1 20 2 1 1 1 1 1 1 1 100 1 1 1 50 1 1 1 1 1 1 1 1
output:
18 22 9 10 3 2 30 29 28 27 26 25 24 23 21 20 19 17 16 15 14 13 12 11 8 7 6 5 4 1
result:
ok correct solution
Test #30:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
30 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
output:
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
result:
ok correct solution
Test #31:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
30 15 29 40 28 18 30 39 42 24 38 20 41 19 35 32 23 22 33 26 34 14 31 37 25 27 36 43 17 21 16
output:
27 8 12 3 7 10 23 26 14 20 18 15 22 6 2 4 25 19 24 9 16 17 29 11 13 5 28 30 1 21
result:
ok correct solution
Test #32:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
30 9 9 9 9 9 9 10 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9
output:
7 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 6 5 4 3 2 1
result:
ok correct solution
Test #33:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
30 3 3 87 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
output:
3 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 2 1
result:
ok correct solution
Test #34:
score: 0
Accepted
time: 0ms
memory: 3464kb
input:
30 1 1 1 1 1 100 1 1 1 1 1 1 1 1 1 1 1 72 1 1 1 1 1 1 1 1 1 1 1 1
output:
6 18 30 29 28 27 26 25 24 23 22 21 20 19 17 16 15 14 13 12 11 10 9 8 7 5 4 3 2 1
result:
ok correct solution