# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1250318 | guymmk | 3개의 봉우리 (IOI25_triples) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#include "triples.h"
using namespace std;
vector<int> v
bool is_triple(vector<int>g){
vector<int>a,b;
a={g[1]-g[0],g[2]-g[0],g[2]-g[1]};
b={v[g[0]],v[g[1]],v[g[2]]};
sort(a.begin(),a.end());
sort(b.begin(),b.end());
return a==b;
}
long long count_triples(vector<int> hsh) {
v=hsh;
int ans=0;
int n=v.size();
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={i,j,k};
ans+=(int)is_triple(h);
}
}
}return ans;
}