제출 #1251091

#제출 시각아이디문제언어결과실행 시간메모리
1251091discontinuous3개의 봉우리 (IOI25_triples)C++20
컴파일 에러
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; i++) {
        for(int j = i+1; j<n; j++) {
            for(int k = j+1; k<n; k++) {
                vector<int> heights;
                vector<int> dists;

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

                dists.pb(H[j]-H[i]);
                dists.pb(H[k]-H[i]);
                dists.pb(H[k]-H[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;
}

컴파일 시 표준 에러 (stderr) 메시지

triples.cpp: In function 'll count_triples(std::vector<int>)':
triples.cpp:19:28: error: 'arr' was not declared in this scope
   19 |                 heights.pb(arr[i]);
      |                            ^~~