Submission #1251102

#TimeUsernameProblemLanguageResultExecution timeMemory
1251102discontinuousTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
// Author: Anikait Prasar

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define pb push_back


ll count_triples(vector<int> H) {
    int n = H.size();
    ll m = 0;
    for(int i = 0; i<n-2; i++) {
        for(int j = i+1; j<n-1; j++) {
            for(int k = j+1; k<n; k++) {
                vector<int> heights;
                vector<int> dists;

                heights.pb(H[i]);
                heights.pb(H[j]);
                heights.pb(H[k]);

                dists.pb(j-i);
                dists.pb(k-i);
                dists.pb(k-j);

                sort(heights.begin(), heights.end());
                sort(dists.begin(), dists.end());
        
                bool nope = false;
                for(int g = 0; g<3; g++) {
                    if(heights[g] != dists[g]) {
                        nope = true;
                    }
                }

                if(!nope) {
                    m++;
                }
            }
        }
    }

    return m;
}

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

int main() {
    cout << count_triples({4, 1, 4, 3, 2, 6, 1});
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc4bNU3O.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccOUvquH.o:triples.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status