# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1249992 | liamislazy | Triple Peaks (IOI25_triples) | C++20 | 0 ms | 0 KiB |
#include "triples.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
long long count_triples(std::vector<int> H) {
int n = H.size();
llo ans = 0;
for(int i = 0; i < n; i++)
for(int j = i+1; j < n; j++)
for(int k = j+1; k < n; k++) {
vector<int> h = {H[i], H[j], H[k]};
vector<int> d = {j - i, k - j, k - i};
sort(h.begin(), h.end());
sort(d.begin(), d.end());
if(h == d) ans++;
}
return ans;
}