Borderou de evaluare (job #2978515)

Utilizator MacraAlexandruMacra Alexandru MacraAlexandru Data 13 februarie 2023 20:45:20
Problema Problema rucsacului Status done
Runda Arhiva educationala Compilator cpp-64 | Vezi sursa
Scor 0

Raport evaluator

Eroare de compilare: main.cpp:6:30: error: conflicting declaration 'int g [10001]' 6 | int n, gmax, v[5001][10001], g[10001], s[5001]; | ^ main.cpp:5:10: note: previous declaration as 'std::ofstream g' 5 | ofstream g("rucsac.out"); | ^ main.cpp: In function 'int main()': main.cpp:10:32: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 10 | for(int i=1; i<=n; i++)f>>g[i]>>s[i]; | ^ main.cpp:14:19: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 14 | if(j<g[i])v[i][j]=v[i-1][j]; | ^ main.cpp:15:51: error: no match for 'operator[]' (operand types are 'std::ofstream' {aka 'std::basic_ofstream<char>'} and 'int') 15 | else v[i][j]=max(v[i-1][j], v[i-1][j-g[i]]+s[i]); | ^ Non zero exit status: 1

Ceva nu functioneaza?