#include <bits/stdc++.h>
using namespace std;
#define EMT ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const double EPS = 1e-9;
signed main() {
int n;
cin >> n;
vector<int> arr(n), q(n);
for(int i = 1; i <= n; i++)
arr[i - 1] = i;
for(int i = 0; i < n; i++)
cin >> q[i];
for(int i = n - 1; i; i--)
q[i] -= q[i - 1];
do {
vector<int> tmp(n);
for(int i = 0; i < n; i++) {
tmp[i] = 1;
for(int j = 0; j < i; j++)
if(arr[j] < arr[i])
tmp[i] += tmp[j];
}
if(tmp == q)
break;
} while(next_permutation(arr.begin(), arr.end()));
for(int a : arr)
cout << a << ' ';
cout << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
204 KB |
Output is correct |
2 |
Execution timed out |
4059 ms |
204 KB |
Time limit exceeded |