| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1316653 | ezzzay | 3개의 봉우리 (IOI25_triples) | C++17 | 0 ms | 0 KiB |
//#include "triples.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
long long count_triples(vector<int> H) {
int n=H.size();
ll cnt=0;
for(int i=0;i<n;i++){
for(int j=i+1;j<min(n,i+11);j++){
for(int k=j+1;k<min(n,i+11);k++){
multiset<int>st={H[i],H[j],H[k]};
if(st.find(j-i)!=st.end())st.erase(st.find(j-i));
if(st.find(k-i)!=st.end())st.erase(st.find(k-i));
if(st.find(k-j)!=st.end())st.erase(st.find(k-j));
if(st.empty()){
cnt++;
}
}
}
}
return cnt;
}
