from itertools import combinations
n = int(input())
l = [*([i,int(x)] for i,x in enumerate(input().split(),1))]
a = [*combinations(l,3)]
cnt = 1
for x in a:
if(x[0][1]==x[1][1]+x[2][1]):cnt = 0;print(x[0][0],x[1][0],x[2][0]);break
elif(x[1][1]==x[0][1]+x[2][1]):cnt = 0;print(x[1][0],x[0][0],x[2][0]);break
elif(x[2][1]==x[1][1]+x[0][1]):cnt = 0;print(x[2][0],x[1][0],x[0][0]);break
if(cnt):print(-1)
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main() {
int t=1;//cin>>t;
while(t--) {
int n;
cin >> n;
int a[n];
multimap<int, int> mp;
int ctr = 0;
for (int &i: a) {
cin >> i;
mp.emplace(i, ctr++);
}
sort(a, a + n);
auto aa = mp.begin(), b = mp.begin(), c = mp.begin();
bool ok = false;
for (int i = n - 1; i > -1; i--) {
for (int j = i - 1; j > -1; j--) {
for (int k = j - 1; k > -1; k--) {
if (a[j] + a[k] == a[i]) {
aa = mp.find(a[i]);
b = mp.find(a[j]);
c = mp.find(a[k]);
ok = true;
break;
}
if (ok)break;
}
if (ok)break;
}
}
if (!ok){
printf("-1\n");
return 0;
}
if(b == c)b++;
printf("%d %d %d\n",aa->second+1,b->second+1,c->second+1);
}
return 0;
}
118B - Present from Lena | 27A - Next Test |
785. Is Graph Bipartite | 90. Subsets II |
1560A - Dislike of Threes | 36. Valid Sudoku |
557. Reverse Words in a String III | 566. Reshape the Matrix |
167. Two Sum II - Input array is sorted | 387. First Unique Character in a String |
383. Ransom Note | 242. Valid Anagram |
141. Linked List Cycle | 21. Merge Two Sorted Lists |
203. Remove Linked List Elements | 733. Flood Fill |
206. Reverse Linked List | 83. Remove Duplicates from Sorted List |
116. Populating Next Right Pointers in Each Node | 145. Binary Tree Postorder Traversal |
94. Binary Tree Inorder Traversal | 101. Symmetric Tree |
77. Combinations | 46. Permutations |
226. Invert Binary Tree | 112. Path Sum |
1556A - A Variety of Operations | 136. Single Number |
169. Majority Element | 119. Pascal's Triangle II |