#include <bits/stdc++.h>
using namespace std;
int main(void) {
int n;
cin >> n;
vector <int> Q(n);
function <int(vector <int>)> check=[&](vector <int> a) {
vector <int> ex = {3, 2, 4, 1};
vector <int> res;
for(int i = 0; i < n; i ++) {
int cnt = 0;
for(int mask = 0; mask < (1 << (i+1)); mask ++) {
vector <int> ans;
for(int j = 0; j < n; j ++) {
if((mask & (1 << j))!=0) {
ans.push_back(a[j]);
}
}
if(is_sorted(ans.begin(), ans.end())) {
cnt ++;
}
}
cnt --;
if(cnt != Q[i]){
return 0;
}
}
return 1;
};
for(int i =0; i < n; i ++) cin >> Q[i];
vector <int> permutation(n);
iota(permutation.begin(), permutation.end(), 1);
do{
if(check(permutation)) {
for(auto i : permutation) cout << i << " ";
return false;
}
}while(next_permutation(permutation.begin(), permutation.end()));
return false;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
146 ms |
272 KB |
Output is correct |
2 |
Execution timed out |
4054 ms |
292 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |