| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1286347 | sampaio_kk | Triple Peaks (IOI25_triples) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
long long count_triples(vector<int> H) {
int N = H.size();
long long 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 - i, k - j};
sort(h.begin(), h.end());
sort(d.begin(), d.end());
if (h == d) ans++;
}
}
}
return ans;
}
