| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364292 | mannshah1211 | Triple Peaks (IOI25_triples) | C++20 | 2095 ms | 1948 KiB |
#include "triples.h"
using namespace std;
long long count_triples(vector<int> h) {
int n = h.size();
auto In = [&](int i) {
return (0 <= i) && (i < n);
};
long long ans = 0;
for (int i = 0; i < n; i++) {
int k = h[i] + i;
if (In(k)) {
int case1j = h[k] + i, case2j = k - h[k];
if (In(case1j) && h[case1j] == k - case1j) {
ans++;
}
if (In(case2j) && h[case2j] == case2j - i && case1j != case2j) {
ans++;
}
}
}
for (int k = n - 1; k >= 0; k--) {
int i = h[k] - k;
if (In(i)) {
int case1j = h[i] + i, case2j = k - h[i];
if (In(case1j) && h[case1j] == k - case1j) {
ans++;
}
if (In(case2j) && h[case2j] == case2j - i && case1j != case2j) {
ans++;
}
}
}
for (int j = 0; j < n; j++) {
for (int k = j + 1; k < n; k++) {
int i = h[j] - k;
if (h[k] + k == h[j] + j && In(i)) {
if (h[i] == k - j) {
ans++;
}
} else if (In(i)) {
if (h[i] == j - i && h[k] == k - j) {
ans++;
}
}
}
}
return ans;
}
vector<int> construct_range(int m, int k) {
}Compilation message (stderr)
| # | 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... | ||||
