Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
68312 张智博 选择排序 C++ Compile Error 0 MS 0 KB 227 2024-03-22 23:26:48

Tests(0/0):


Code:

void selection_sort(int* a, int n) { for (int i = 1; i < n; ++i) { int ith = i; for (int j = i + 1; j <= n; ++j) { if (a[j] < a[ith]) { ith = j; } } std::swap(a[i], a[ith]); } }


Run Info:

Main.cc: In function 'void selection_sort(int*, int)':
Main.cc:9:5: error: 'swap' is not a member of 'std'
     std::swap(a[i], a[ith]);
     ^