Submission #1254204

#TimeUsernameProblemLanguageResultExecution timeMemory
1254204TrendBattlesTriple Peaks (IOI25_triples)C++17
Compilation error
0 ms0 KiB
#include "triples.h" #include <bits/stdc++.h> using namespace std; using lli = int64_t; lli count_triples(vector <int> H) { int N = (int) H.size(); lli ans = 0; for (int iter = 1; iter <= 2; ++iter) { for (int i = 0; i < N; ++i) { if (i < H[i]) continue; int p = i - H[i]; if (H[p] >= H[i]) continue; ans += H[p + H[p]] == H[i] - H[p]; if (H[i] != H[p] * 2) ans += H[i - H[p]] == H[i] - H[p]; } reverse(H.begin(), H.end()); } for (int i = 0; i < N; ++i) { if (i + H[i] >= N) continue; int j = i + H[i]; if (H[j] > H[i]) ans += H[j + H[j] - H[i]] == H[j] - H[i]; } for (int i = 0; i < N; ++i) { for (int j = i + 1; j < N; ++j) { if (j - i == H[i] + H[j]) { ans += H[i + H[j]] == H[i] + H[j]; } } } for (int i = 0; i < N; ++i) { if (H[i] % 2) continue; int half_len = H[i] / 2; ans -= i >= half_len and H[i - half_len] == half_len and i + half_len < N and H[i + half_len] == half_len; } return ans; } vector<int> construct_range(int M, int K) { return {1, 1, 2}; }

Compilation message (stderr)

triples.cpp:6:5: error: ambiguating new declaration of 'lli count_triples(std::vector<int>)'
    6 | lli count_triples(vector <int> H) {
      |     ^~~~~~~~~~~~~
In file included from triples.cpp:1:
triples.h:3:11: note: old declaration 'long long int count_triples(std::vector<int>)'
    3 | long long count_triples(std::vector<int> H);
      |           ^~~~~~~~~~~~~