Problem lengthsort
User andikawahyudi
Submission Time 2026-02-08 21:17:57
Score 0
Max Time N/A
Max Memory N/A

Compile Error

lengthsort.cpp: In function ‘int main()’:
lengthsort.cpp:14:16: error: request for member ‘second’ in ‘p’, which is of non-class type ‘std::pair<long long int, std::__cxx11::basic_string<char> > [n]’
14 | p[i] = {0, p.second};
| ^~~~~~
lengthsort.cpp:14:22: error: no match for ‘operator=’ (operand types are ‘std::pair<long long int, std::__cxx11::basic_string<char> >’ and ‘<brace-enclosed initializer list>’)
14 | p[i] = {0, p.second};
| ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
from /usr/include/c++/9/bits/specfun.h:45,
from /usr/include/c++/9/cmath:1927,
from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
from lengthsort.cpp:1:
/usr/include/c++/9/bits/stl_pair.h:378:7: note: candidate: ‘std::pair<_T1, _T2>& std::pair<_T1, _T2>::operator=(typename std::c