| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1345365 | Jer | Triple Peaks (IOI25_triples) | C++20 | 2094 ms | 1960 KiB |
#include "triples.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll count_triples(std::vector<int> h)
{
int n = h.size(), h1, h2, x3;
ll res = 0;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{
h1 = h[i], h2 = h[j];
// 1.1
x3 = h2 + i;
res += (x3 < n and x3 == h1 + j and h[x3] == j - i);
// 1.2
x3 = h1 + i;
res += (x3 < n and x3 == h2 + j and h[x3] == j - i);
// 2.1
x3 = h1 + i;
res += (x3 < n and x3 == h[x3] + j and h2 == j - i);
// 2.2
x3 = h1 + j;
res += (x3 < n and x3 == h[x3] + i and h2 == j - i);
// 3.1
x3 = h2 + i;
res += (x3 < n and x3 == h[x3] + j and h1 == j - i);
// 3.2
x3 = h2 + j;
res += (x3 < n and x3 == h[x3] + i and h1 == j - i);
}
return res;
/*
int n = h.size();
ll res = 0;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
for (int x = j + 1; x < n; x++)
{
if (i == j or j == x or x == i)
continue;
vector<int> he = {h[i], h[j], h[x]};
vector<int> dist = {j - i, x - i, x - j};
sort(he.begin(), he.end()), sort(dist.begin(), dist.end());
res += (he == dist);
}
return res;
*/
}
std::vector<int> construct_range(int M, int K)
{
return {1, 1, 1};
}
| # | 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... | ||||
