-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworms_evolution.cpp
More file actions
56 lines (40 loc) · 857 Bytes
/
Copy pathworms_evolution.cpp
File metadata and controls
56 lines (40 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
short n;
cin >> n;
vector<int> a;
for (int i = 0; i < n; i++)
{
int temp = 0;
cin >> temp;
a.push_back(temp);
}
int x, y, z = 0;
bool found = false;
for (int i = 0; i < n; i++)
{
for (int j = 1; j < n; j++)
{
auto it = find(a.begin(), a.end(), a[i]+a[j]);
if(it != a.end()){
x = i+1;
y = j+1;
z = it - a.begin() +1;
found = true;
break;
}
}
if(found) break;
}
if(found){
cout << z << " " << x << " " << y <<endl;
} else{
cout << -1 << endl;
}
return 0;
}