#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define endl "\n"
#define dbg(x) cout << #x << " = " << (x) << endl;
const long long INF = 1e18;
const int MAXN = 1e6 + 10;
const int MOD = 1e9 + 7;
bool match(vector<int> a, vector<int> b){
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for(int i = 0; i < 3; ++i) if(a[i] != b[i]) return false;
return true;
}
long long count_triples(vector<int> h) {
int n = h.size();
long long count = 0;
for(int j = 0; j < n; ++j){
for(int a = 0; a < j; ++a){
for(int b = 0; j + b < n; ++b){
int i = j - a;
int k = j + b;
vector<int> first = {a, b, a + b};
vector<int> second = {h[i], h[j], h[k]};
if(match(first, second)) count++;
}
}
}
return count;
}
vector<int> construct_range(int m, int k){
return {};
}
/*int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
//freopen("input.in", "r", stdin);
//freopen("input.out", "w", stdout);
cout<<count_triples({4, 1, 4, 3, 2, 6, 1});
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |