제출 #985143

#제출 시각아이디문제언어결과실행 시간메모리
985143CrazyBotBoy사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <vector> #include <unordered_map> #include <algorithm> #include <iostream> using namespace std; int solve(int N, vector<int> A) { int maxOccurrences = 0; for (int l = 0; l < N; ++l) { unordered_map<int, int> freq; vector<int> subarray; for (int r = l; r < N; ++r) { subarray.push_back(A[r]); freq[A[r]]++; vector<int> temp = subarray; sort(temp.begin(), temp.end()); int k = temp.size(); int median1 = temp[(k - 1) / 2]; int median2 = temp[k / 2]; maxOccurrences = max(maxOccurrences, freq[median1]); if (median1 != median2) { maxOccurrences = max(maxOccurrences, freq[median2]); } } } return maxOccurrences; }

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

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