| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1363907 | edga1 | Triple Peaks (IOI25_triples) | C++20 | 2095 ms | 1960 KiB |
#include <bits/stdc++.h>
#include "triples.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=200005;
ll r=0,n;
long long count_triples(vector<int> h) {
n=h.size();
for(int i=0; i<n; i++){
if(h[i]==1) continue;
int d=h[i];
for(int j=max(0,i-d+1); j<i && j+d<n; j++){
vector<int> di={i-j,j+d-i,d};
vector<int> hi={h[i],h[j],h[j+d]};
sort(di.begin(),di.end());
sort(hi.begin(),hi.end());
if(di[0]==hi[0] && di[1]==hi[1] && di[2]==hi[2]) r++;
}
if(i-d>=0){
int d2=h[i-d];
if(h[i-d+d2]+d2==d) r++;
if(d2*2!=d){
if(h[i-d2]+d2==d) r++;
}
}
if(i+d<n){
int d2=h[i+d];
if(h[i+d-d2]+d2==d) r++;
if(d2*2!=d){
if(h[i+d2]+d2==d) r++;
}
}
}
return r;
}
vector<int> construct_range(int M, int K) {
srand(time(0));
vector<int> v;
for(int i=0; i<M; i++){
v.pb(rand()%5+1);
}
return v;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
