aboutsummaryrefslogtreecommitdiff
path: root/recursionTest.cpp
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-05-06 23:23:53 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-05-06 23:23:53 +0200
commited4b0690e4ee35278bb656c703bd0a1ab102222f (patch)
treefc880ae4d999fbd54e6d370073eb18291da475cd /recursionTest.cpp
parent27b754215ceda985f0f8e3b64ab5c5f8e84ab826 (diff)
downloadcompetitive-programming-ed4b0690e4ee35278bb656c703bd0a1ab102222f.tar.xz
competitive-programming-ed4b0690e4ee35278bb656c703bd0a1ab102222f.zip
Added some problems + moved some folders to contests
Diffstat (limited to 'recursionTest.cpp')
-rw-r--r--recursionTest.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/recursionTest.cpp b/recursionTest.cpp
index ae3ab32..91e9db8 100644
--- a/recursionTest.cpp
+++ b/recursionTest.cpp
@@ -1,3 +1,4 @@
+#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
@@ -31,17 +32,20 @@ int main() {
for(int &x : v) {
cin >> x;
}
- if(solve(v, 0, target, v[0], opts)) {
- for(int i = 0; i < v.size(); i++) {
- if (i == v.size() - 1) {
- cout << v[i];
- }
- else {
- cout << v[i] << " " << ans[i] << " ";
+ sort(v.begin(), v.end());
+ do {
+ if(solve(v, 0, target, v[0], opts)) {
+ for(int i = 0; i < v.size(); i++) {
+ if (i == v.size() - 1) {
+ cout << v[i];
+ }
+ else {
+ cout << v[i] << " " << ans[i] << " ";
+ }
}
+ cout << '\n';
}
- cout << '\n';
- }
+ } while(next_permutation(v.begin(), v.end()));
return 0;
}