Submission #1249978

#TimeUsernameProblemLanguageResultExecution timeMemory
1249978liamislazyTriple 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) { llo ans = 0; fn(i,0,n-1) fn(j,i+1,n-1) fn(k,j+1,n-1){ vector<int> heights = {h[i], h[j], h[k]}; vector<int> dists = {j - i, k - j, k - i}; sort(heights.begin(), heights.end()); sort(dists.begin(), dists.end()); if(heights == dists) ans++; } cout << ans; }

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:11:12: error: 'n' was not declared in this scope
   11 |     fn(i,0,n-1) fn(j,i+1,n-1) fn(k,j+1,n-1){
      |            ^
triples.cpp:5:40: note: in definition of macro 'fn'
    5 | #define fn(i,a,b) for (int i = a; i <= b; i++)
      |                                        ^
triples.cpp:12:32: error: 'h' was not declared in this scope
   12 |         vector<int> heights = {h[i], h[j], h[k]};
      |                                ^
triples.cpp:12:48: error: could not convert '{<expression error>, <expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   12 |         vector<int> heights = {h[i], h[j], h[k]};
      |                                                ^
      |                                                |
      |                                                <brace-enclosed initializer list>
triples.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^