Submission #1252185

#TimeUsernameProblemLanguageResultExecution timeMemory
1252185bzzzzzzzzzzTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
long long count_triples(vector<int> H) { int n = (int)H.size(); ll ans = 0; for (int i = 0; i < n; i++) { for (int k = i + 2; k < n; k++) { cout << i << " " << k << '\n'; int x = k - i; if (x == H[i]) { if (H[k] < x) { if (H[i + H[k]] == k - (i + H[k])) { ans++; } if (i + H[k] + H[k] != k && H[k - H[k]] == (k - H[k]) - i) { ans++; } } } else if (x == H[k]) { if (H[i] < x) { if (H[i + H[i]] == k - (i + H[i])) { ans++; } if (i + H[i] + H[i] != k && H[k - H[i]] == (k - H[i]) - i) { ans++; } } } else { if (H[i] + H[k] == x) { if (H[i + H[i]] == x) { ans++; } if (i + H[i] + H[i] != k && H[i + H[k]] == x) { ans++; } } } } } return ans; }

Compilation message (stderr)

triples.cpp:1:25: error: 'vector' was not declared in this scope
    1 | long long count_triples(vector<int> H) {
      |                         ^~~~~~
triples.cpp:1:32: error: expected primary-expression before 'int'
    1 | long long count_triples(vector<int> H) {
      |                                ^~~