Submission #1249469

#TimeUsernameProblemLanguageResultExecution timeMemory
1249469lunarechoTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include "triples.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

bool is(int i, int j, int k, int hi, int hj, int hk) {
    int d1 = j - i, d2 = k - i, d3 = k - j;
    bool cond1 = (d1 == hi && d2 == hj && d3 == hk);
    bool cond2 = (d1 == hi && d2 == hk && d3 == hj);
    bool cond3 = (d1 == hj && d2 == hi && d3 == hk);
    bool cond4 = (d1 == hj && d2 == hk && d3 == hi);
    bool cond5 = (d1 == hk && d2 == hi && d3 == hj);
    bool cond6 = (d1 == hk && d2 == hj && d3 == hi);
    return cond1 && cond2 && cond3 && cond4 && cond5 && cond6;
}

long long count_triples(std::vector<int> h) {
  int n = H.size();
  ll cnt = 0;
  for(int i=0;i<n;++i)
  {
    for(int j=i+1;j<n;++j)
    {
      for(int k=j+1;k<n;++k)
      {
        if(is(i,j,k,h[i],h[j],h[k]))
          ++cnt;
      }
    }
  }
  return cnt;
}

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:18:11: error: 'H' was not declared in this scope
   18 |   int n = H.size();
      |           ^