We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- STL
- Vector-Sort
- Discussions
Vector-Sort
Vector-Sort
Sort by
recency
|
300 Discussions
|
Please Login in order to post a comment
Instead of using a for loop paired with
push_back()
(which can result in allocations that could otherwise be avoided), use the explicit constructor,std::vector<T>(int)
(requiring direct initialisation via a parenthesised list) which constructs astd::vector
of a given size:int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
vectorv;
}
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */
}