Submission #389266

#TimeUsernameProblemLanguageResultExecution timeMemory
389266rk42745417Permutation Recovery (info1cup17_permutation)C++17
10 / 100
4059 ms204 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...