제출 #1290827

#제출 시각아이디문제언어결과실행 시간메모리
1290827ecen303개의 봉우리 (IOI25_triples)C++20
컴파일 에러
0 ms0 KiB
//testing AI Code #include <vector> #include <algorithm> using namespace std; // Counts mythical triples in given heights vector H long long count_triples(const vector<int>& H) { int N = (int)H.size(); long long result = 0; // Iterate over all possible gaps a, b where a + b < N for (int a = 1; a < N - 1; ++a) { for (int b = 1; a + b < N; ++b) { int c = a + b; // For each valid starting index i where i+a+b < N for (int i = 0; i + c < N; ++i) { int j = i + a; int k = i + c; // Check if heights match distances ignoring order vector<int> dist = {a, b, c}; vector<int> heights = {H[i], H[j], H[k]}; sort(dist.begin(), dist.end()); sort(heights.begin(), heights.end()); if (dist == heights) { ++result; } } } } return result; } // Constructs a mountain range with a valid pattern (naive stub) vector<int> construct_range(int M, int K) { int N = min(M, 10); vector<int> H(N); for (int i = 0; i < N; ++i) { H[i] = (i % (N - 1)) + 1; // Ensure heights within [1, N-1] } return H; }

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

/usr/bin/ld: /tmp/ccVRQ2va.o: in function `main':
grader.cpp:(.text.startup+0x367): undefined reference to `count_triples(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status