// This file is generated by mkfile.py
// Date: 2025-10-18

#include <solution/3397.h>
#include <gtest/gtest.h>

class MaxDistinctElementsTest : public ::testing::Test {
protected:
    void AssertMaxDistinctElements(std::vector<int> nums, int k, int expected) {
        int* arr = new int[nums.size()];
        std::copy(nums.begin(), nums.end(), arr);

        int result = maxDistinctElements(arr, nums.size(), k);
        ASSERT_EQ(result, expected);

        delete[] arr;
    }
};

// 示例 1
TEST_F(MaxDistinctElementsTest, Example1) {
    // 输入：nums = [1,2,2,3,3,4], k = 2
    // 输出：6
    AssertMaxDistinctElements({1, 2, 2, 3, 3, 4}, 2, 6);
}

// 示例 2
TEST_F(MaxDistinctElementsTest, Example2) {
    // 输入：nums = [4,4,4,4], k = 1
    // 输出：3
    AssertMaxDistinctElements({4, 4, 4, 4}, 1, 3);
}