이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
typedef long long ll;
using pii = pair<int, int>;
const ll MOD = 1000000007;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<ll> q(n);
for(int i = 0; i < n; i++){
cin >> q[i];
}
vector<int> p(n);
for(int i = 0; i < n; i++) p[i] = i + 1;
do{
vector<int> dp(n + 1);
ll ans = 0;
bool ok = true;
for(int i = 0; i < n; i++){
dp[p[i]] = 1;
for(int j = 1; j < p[i]; j++){
dp[p[i]] += dp[j];
}
ans += dp[p[i]];
if(ans != q[i]) ok = false;
}
if(ok) break;
}
while(next_permutation(p.begin(), p.end()));
printv(p, cout);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |