Submission #1253413

#TimeUsernameProblemLanguageResultExecution timeMemory
1253413abcdxyz123Triple Peaks (IOI25_triples)C++17
Compilation error
0 ms0 KiB
#include "triples.h"
#include<bits/stdc++.h>
using namespace std;

#define maxn 200005
#define all(x) x.begin(),x.end()
int n;
int h[maxn];
bool isValid(int i,int j,int k)
{
    if(1<=i&&i<j&&j<k&&k<=n)
    {
        vector<int>A={h[i],h[j],h[k]};
        vector<int>B={j-i,k-j,k-i};
        sort(all(A));
        sort(all(B));
        if(A==B)return 1;
    }
    return 0;
}
int count_triples(vector<int> H)
{
    n=H.size();
    for(int i=0;i<n;i++)h[i+1]=H[i];

    int res=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            for(int k=j+1;k<=n;k++)
            {
                res+=isValid(i,j,k);
            }
        }
    }
    return res;
}

Compilation message (stderr)

triples.cpp:21:5: error: ambiguating new declaration of 'int count_triples(std::vector<int>)'
   21 | int 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);
      |           ^~~~~~~~~~~~~