aboutsummaryrefslogtreecommitdiff
path: root/SequenceEquation.cpp
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-04-30 01:13:40 +0200
commita0d7b8320a8996eee0ed957b79c3a882f8b47146 (patch)
tree76242ae2b19bad00796ed6d0104da8a0e4a99abe /SequenceEquation.cpp
downloadcompetitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.tar.xz
competitive-programming-a0d7b8320a8996eee0ed957b79c3a882f8b47146.zip
Added all current problems
Diffstat (limited to 'SequenceEquation.cpp')
-rw-r--r--SequenceEquation.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/SequenceEquation.cpp b/SequenceEquation.cpp
new file mode 100644
index 0000000..1714728
--- /dev/null
+++ b/SequenceEquation.cpp
@@ -0,0 +1,25 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main(){
+ int n, count = 1;
+ cin >> n;
+ vector<int> v(n);
+ map<int, int> mp;
+ for(auto &x : v){
+ cin >> x;
+ mp[x] = count;
+ count++;
+ }
+ for(auto x : mp){
+ auto it = find(v.begin(), v.end(), x.second);
+ cout << "value: " << x.first << " Index: " << x.second << endl;
+ cout << it - v.begin() + 1<< endl;
+ }
+
+
+
+
+ return 0;
+}