commit 815e707dbcd6e7baf121ed5f782c67d4e624070c Author: Segcolt <9hmbzr275@mozmail.com> Date: Thu Sep 19 15:47:48 2024 -0300 X-burguer diff --git a/codeforces/round-105/e/.vscode/c_cpp_properties.json b/codeforces/round-105/e/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..c2098a2 --- /dev/null +++ b/codeforces/round-105/e/.vscode/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "linux-gcc-x64", + "includePath": [ + "${workspaceFolder}/**" + ], + "compilerPath": "/usr/bin/gcc", + "cStandard": "${default}", + "cppStandard": "${default}", + "intelliSenseMode": "linux-gcc-x64", + "compilerArgs": [ + "" + ] + } + ], + "version": 4 +} \ No newline at end of file diff --git a/codeforces/round-105/e/.vscode/launch.json b/codeforces/round-105/e/.vscode/launch.json new file mode 100644 index 0000000..a00b4e0 --- /dev/null +++ b/codeforces/round-105/e/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C/C++ Runner: Debug Session", + "type": "cppdbg", + "request": "launch", + "args": [], + "stopAtEntry": false, + "externalConsole": false, + "cwd": "/tmp/files/problem-solutions/codeforces/round-105/e", + "program": "/tmp/files/problem-solutions/codeforces/round-105/e/build/Debug/outDebug", + "MIMode": "gdb", + "miDebuggerPath": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/codeforces/round-105/e/.vscode/settings.json b/codeforces/round-105/e/.vscode/settings.json new file mode 100644 index 0000000..d6bc9cf --- /dev/null +++ b/codeforces/round-105/e/.vscode/settings.json @@ -0,0 +1,31 @@ +{ + "C_Cpp_Runner.cCompilerPath": "gcc", + "C_Cpp_Runner.cppCompilerPath": "g++", + "C_Cpp_Runner.debuggerPath": "gdb", + "C_Cpp_Runner.cStandard": "", + "C_Cpp_Runner.cppStandard": "", + "C_Cpp_Runner.msvcBatchPath": "", + "C_Cpp_Runner.useMsvc": false, + "C_Cpp_Runner.warnings": [ + "-Wall", + "-Wextra", + "-Wpedantic" + ], + "C_Cpp_Runner.enableWarnings": true, + "C_Cpp_Runner.warningsAsError": false, + "C_Cpp_Runner.compilerArgs": [], + "C_Cpp_Runner.linkerArgs": [], + "C_Cpp_Runner.includePaths": [], + "C_Cpp_Runner.includeSearch": [ + "*", + "**/*" + ], + "C_Cpp_Runner.excludeSearch": [ + "**/build", + "**/build/**", + "**/.*", + "**/.*/**", + "**/.vscode", + "**/.vscode/**" + ] +} \ No newline at end of file diff --git a/codeforces/round-105/e/E. Porcelain b/codeforces/round-105/e/E. Porcelain new file mode 100755 index 0000000..de7dc4a Binary files /dev/null and b/codeforces/round-105/e/E. Porcelain differ diff --git a/codeforces/round-105/e/E. Porcelain.cpp b/codeforces/round-105/e/E. Porcelain.cpp new file mode 100644 index 0000000..004e077 --- /dev/null +++ b/codeforces/round-105/e/E. Porcelain.cpp @@ -0,0 +1,99 @@ +#include + +using namespace std; + +#define V vector + +#define rmin(a, b) a = min(a, b) +#define rmax(a, b) a = max(a, b) + +#define rep(i, lim) for (size_t i = 0; i < (lim); i++) +#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++) + +#define repv(i, v) for (auto &i : (v)) +#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; } +#define sortv(v) sort(v.begin(), v.end()) +#define all(v) (v).begin(), (v).end() + +using vi = vector; +using vvi = vector; +using vvvi = vector; +using vvvvi = vector; + +using ll = long long; + +using vl = vector; +using vvl = vector; +using vvvl = vector; +using vvvvl = vector; + +template +auto operator<<(ostream &os, const vector &vec)->ostream& { + os << vec[0]; + for (size_t i = 1; i < vec.size(); i++) { + os << ' ' << vec[i]; + } + os << '\n'; + return os; +} + +template +auto operator>>(istream &is, vector &vec)->istream& { + for (auto &i : vec) { + is >> i; + } + return is; +} + +template +auto operator<<(ostream &os, const vector> &vec)->ostream& { + for (auto &i : vec) { + os << i[0]; + for (size_t j = 1; j < i.size(); j++) { + os << ' ' << i[j]; + } + os << '\n'; + } + return os; +} + +template +auto operator>>(istream &is, vector> &vec)->istream& { + for (auto &i : vec) { + for (auto &j : i) { + is >> j; + } + } + return is; +} + +int main() +{ + ios::sync_with_stdio(false); + cin.tie(nullptr); + + int n, m; + cin >> n >> m; + + vvl plates(n); + + rep(i, n) { + int n; + cin >> n; + plates[i].resize(n); + cin >> plates[i]; + } + + vvl dp(n, vl(100, 0)); + for (size_t i = 0; i < n; i++) { + vvl dp2(101, vl(101, 0)); + + for (int k = plates[i].size() - 1; k >= 0; k--) { + for (int j = 1; j <= k; j++) { + dp2[j][k] = max(dp2[j - 1][k] + plates[i][j - 1], dp2[j][k + 1] + plates[i][k]); + rmax(dp[i][plates[i].size()-(k-j)], dp2[j][k]); + } + } + } + cout << dp; +} diff --git a/codeforces/round-105/e/E. Porcelain_input0.txt b/codeforces/round-105/e/E. Porcelain_input0.txt new file mode 100644 index 0000000..8edc070 --- /dev/null +++ b/codeforces/round-105/e/E. Porcelain_input0.txt @@ -0,0 +1,3 @@ +2 3 +3 3 7 2 +3 4 1 5 diff --git a/codeforces/round-105/e/E. Porcelain_input1.txt b/codeforces/round-105/e/E. Porcelain_input1.txt new file mode 100644 index 0000000..c5dc452 --- /dev/null +++ b/codeforces/round-105/e/E. Porcelain_input1.txt @@ -0,0 +1,2 @@ +1 3 +4 4 3 1 2 diff --git a/codeforces/round-105/e/E. Porcelain_output0.txt b/codeforces/round-105/e/E. Porcelain_output0.txt new file mode 100644 index 0000000..60d3b2f --- /dev/null +++ b/codeforces/round-105/e/E. Porcelain_output0.txt @@ -0,0 +1 @@ +15 diff --git a/codeforces/round-105/e/E. Porcelain_output1.txt b/codeforces/round-105/e/E. Porcelain_output1.txt new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/codeforces/round-105/e/E. Porcelain_output1.txt @@ -0,0 +1 @@ +9