Submission #1250336

#TimeUsernameProblemLanguageResultExecution timeMemory
1250336guymmkTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
#include "triples.h"
using namespace std;
vector<int> v;
int is_triple(vector<int>g){
  vector<int>a,b;
  a={g[1]-g[0],g[2]-g[0],g[2]-g[1]};
  b={v[g[0]],v[g[1]],v[g[2]]};
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  return (int)(a==b)
}
long long count_triples(vector<int> hsh) {
    v=hsh;
    int ans=0;
    int n=v.size();
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                vector<int>g={i,j,k};
                ans+=is_triple(g);
            }
        }
    }return ans;
}

vector<int> construct_range(int M, int K) {
  return {1, 1, 1};
}

Compilation message (stderr)

triples.cpp: In function 'int is_triple(std::vector<int>)':
triples.cpp:13:21: error: expected ';' before '}' token
   13 |   return (int)(a==b)
      |                     ^
      |                     ;
   14 | }
      | ~