Submission #1250163

#TimeUsernameProblemLanguageResultExecution timeMemory
1250163liamislazyTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include "triples.h" #include <bits/stdc++.h> #define el '\n' typedef long long llo; #define fn(i,a,b) for (int i = a; i <= b; i++) #define rn(i,a,b) for (int i = a; i >= b; i--) using namespace std; long long count_triples(std::vector<int> H) { int n = H.size(); llo ans = 0; fn(j,0,n-1) { fn(i,0,j-1) { int d1 = j - i; int x = H[i]; int y = H[j]; int k; if (H[i] == d1) { int d2 = H[j]; k = j + d2; if (k < N && H[k] == d1 + d2) ans++; } if (H[j] == d1) { int d2 = H[i]; k = j + d2; if (k < N && H[k] == d1 + d2) ans++; } if (H[i] == d1 && H[j] > d1) { int d2 = H[j] - d1; k = j + d2; if (k < N && H[k] == H[j]) ans++; } if (H[j] == d1 && H[i] > d1) { int d2 = H[i] - d1; k = j + d2; if (k < N && H[k] == H[i]) ans++; } if (H[j] == d1 + H[i]) { int d2 = H[i]; k = j + d2; if (k < N && H[k] == d1) ans++; } if (H[i] == d1 + H[j]) { int d2 = H[j]; k = j + d2; if (k < N && H[k] == d1) ans++; } } } return ans; } std::vector<int> construct_range(int M, int K) { return{}; }

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:21:25: error: 'N' was not declared in this scope
   21 |                 if (k < N && H[k] == d1 + d2) ans++;
      |                         ^
triples.cpp:26:25: error: 'N' was not declared in this scope
   26 |                 if (k < N && H[k] == d1 + d2) ans++;
      |                         ^
triples.cpp:32:25: error: 'N' was not declared in this scope
   32 |                 if (k < N && H[k] == H[j]) ans++;
      |                         ^
triples.cpp:38:25: error: 'N' was not declared in this scope
   38 |                 if (k < N && H[k] == H[i]) ans++;
      |                         ^
triples.cpp:44:25: error: 'N' was not declared in this scope
   44 |                 if (k < N && H[k] == d1) ans++;
      |                         ^
triples.cpp:50:25: error: 'N' was not declared in this scope
   50 |                 if (k < N && H[k] == d1) ans++;
      |                         ^