# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1250326 | guymmk | 선물 (IOI25_souvenirs) | C++20 | 0 ms | 0 KiB |
// Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
#include "triples.h"
using namespace std;
vector<int> v
int 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 (int)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>a,b;
vector<int>g={i,j,k};
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());
ans+= (int)a==b;
}
}
}return ans;
}
vector<int> construct_range(int M, int K) {
return {1, 1, 1};
}