| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1361483 | jalol250 | 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++){
int a = H[i], b = H[j], c = H[k];
int x = j - i, y = k - j, z = k - i;
if( (a==x && b==y && c==z) ||
(a==x && b==z && c==y) ||
(a==y && b==x && c==z) ||
(a==y && b==z && c==x) ||
(a==z && b==x && c==y) ||
(a==z && b==y && c==x) ){
ans++;
}
}
}
}
return ans;
}