# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1261342 | robijoy | Triple Peaks (IOI25_triples) | C++20 | 0 ms | 0 KiB |
/*
* Starting with the name of almighty ALLAH
*/
#include <bits/stdc++.h>
#include "triples.h"
using namespace std;
#define int long long
long long count_triples(vector<int> H) {
int N = H.size(),cnt = 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> ro = {(j-i),(k-i),(k-j)};
vector<int> to = {H[i],H[j],H[k]};
sort(ro.begin(), ro.end());
sort(to.begin(), to.end());
if(ro == to) {
cnt++;
}
}
return cnt;
}
// int32_t main() {
// int n;
// cin>>n;
// vector<int> arr(n);
// for(auto &it:arr) cin>>it;
// cout<<count_triples(arr)<<endl;
// }