Problem deforestation
User pIaceholder
Submission Time 2023-11-27 13:40:43
Score 0
Max Time N/A
Max Memory N/A

Compile Error

deforestation.cpp: In lambda function:
deforestation.cpp:17:32: error: ‘n’ is not captured
17 | return a.first + a.second * (n - 1) < b.first + b.second * (n - 1);
| ^
deforestation.cpp:16:41: note: the lambda has no capture-default
16 | std::sort(trees.begin(), trees.end(), [](auto a, auto b) {
| ^
deforestation.cpp:8:6: note: ‘long long int n’ declared here
8 | int n;
| ^
deforestation.cpp:17:63: error: ‘n’ is not captured
17 | return a.first + a.second * (n - 1) < b.first + b.second * (n - 1);
| ^
deforestation.cpp:16:41: note: the lambda has no capture-default
16 | std::sort(trees.begin(), trees.end(), [](auto a, auto b) {
| ^
deforestation.cpp:8:6: note: ‘long long int n’ declared here
8 | int