From 3e8c8f13e971451faee1054ad95afd8f30831024 Mon Sep 17 00:00:00 2001 From: Rajat Garg Date: Thu, 6 Oct 2022 20:27:16 +0530 Subject: [PATCH] Restoring the permutation --- Codeforces/Restoring the Permutation.cpp | 92 ++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Codeforces/Restoring the Permutation.cpp diff --git a/Codeforces/Restoring the Permutation.cpp b/Codeforces/Restoring the Permutation.cpp new file mode 100644 index 0000000..637d875 --- /dev/null +++ b/Codeforces/Restoring the Permutation.cpp @@ -0,0 +1,92 @@ +/* + Link to the problem statement - https://codeforces.com/contest/1506/problem/E +*/ + + +#include +using namespace std; + +#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) +#define fr(i,n) for(int i=0;i>n; + + vectora(n); + fr(i,n) + cin>>a[i]; + + vectorvis(n+1, false), vis2(n+1, false); + vectorsmall(n),big(n); + + small[0] = a[0]; + big[0] = a[0]; + int largeind = a[0]-1; + int smallind=1; + vis[a[0]] = true; + vis2[a[0]] = true; + + for(int i=1;i>t; + + while(t--){ + solve(); + } +} \ No newline at end of file