Problem lengthsort
User godex
Submission Time 2025-03-27 08:51:31
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lengthsort.cpp: In function ‘int main()’:
lengthsort.cpp:11:7: error: ‘arr’ was not declared in this scope
11 | sort(arr, arr + n, [](const string &a, const string &b) {
| ^~~
lengthsort.cpp:11:18: error: ‘n’ was not declared in this scope
11 | sort(arr, arr + n, [](const string &a, const string &b) {
| ^
lengthsort.cpp:15:8: error: no match for ‘operator>>’ (operand types are ‘std::ostream’ {aka ‘std::basic_ostream<char>’} and ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’})
15 | cout >> a[i]
| ~~~~ ^~ ~~~~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:45,
from lengthsort.cpp:1:
/usr/include/c++/9/cstddef:140:5: note: candidate: ‘template<class _Intege