Submission #1250317

#TimeUsernameProblemLanguageResultExecution timeMemory
1250317guymmkTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "triples.h" using namespace std; vector<int> v bool 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 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>h={i,j,k}; ans+=(int)is_triple(h); } } }return ans; } vector<int> construct_range(int M, int K) { return {1, 1, 1}; }

Compilation message (stderr)

triples.cpp:6:1: error: expected initializer before 'bool'
    6 | bool is_triple(vector<int>g){
      | ^~~~
triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:15:5: error: 'v' was not declared in this scope
   15 |     v=hsh;
      |     ^
triples.cpp:21:27: error: 'is_triple' was not declared in this scope
   21 |                 ans+=(int)is_triple(h);
      |                           ^~~~~~~~~