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