Problem fractional_knapsack
User Tyx2019
Submission Time 2023-02-08 14:08:32
Score 0
Max Time N/A
Max Memory N/A

Compile Error

fractional_knapsack.cpp: In function ‘int main()’:
fractional_knapsack.cpp:6:34: error: conversion from ‘long double’ to ‘long unsigned int’ in a converted constant expression
6 | pair<long double,long double> A[N];
| ^
fractional_knapsack.cpp:6:34: error: could not convert ‘N’ from ‘long double’ to ‘long unsigned int’
fractional_knapsack.cpp:6:34: error: size of array ‘A’ has non-integral type ‘long double’
fractional_knapsack.cpp:15:10: error: invalid operands of types ‘std::pair<long double, long double> [1]’ and ‘long double’ to binary ‘operator+’
15 | sort(A,A+N,greater<pair<long double,int>>());
| ~^~
| | |
| | long double
| std::pair<long double, long double> [1]
fractional_knapsack.cpp:18:12: error: invalid types ‘std::pair<long double, long double> [1][long double]’ for array subscript
18 | if(W&