Submission #920415

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9204152024-02-02 14:20:46vjudge1Growing Vegetable is Fun 3 (JOI19_ho_t3)C++17
100 / 100
268 ms134992 KiB
#include <bits/stdc++.h>
using i64 = long long;
#define all(x) (x).begin(), (x).end()
const int N = 400 + 5;
const int INF = 1E9;
int n, pre[3][N][3];
std::vector<int> idxs[3];
std::vector<std::vector<std::vector<std::vector<int>>>> dp;
std::vector<int>::iterator it;
int f(int a, int b, int c, int last) {
if(dp[a][b][c][last] != -1) {
return dp[a][b][c][last];
} else if(a + b + c == n) {
return 0;
}
int res = INF;
if(a != idxs[0].size() && last != 0) {
int cost = 0;
cost += std::max(0, pre[0][a][1] - b);
cost += std::max(0, pre[0][a][2] - c);
res = std::min(res, f(a + 1, b, c, 0) + cost);
}
if(b != idxs[1].size() && last != 1) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

joi2019_ho_t3.cpp: In function 'int f(int, int, int, int)':
joi2019_ho_t3.cpp:22:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  if(a != idxs[0].size() && last != 0) {
      |     ~~^~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:30:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  if(b != idxs[1].size() && last != 1) {
      |     ~~^~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:38:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  if(c != idxs[2].size() && last != 2) {
      |     ~~^~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp: In function 'void solve()':
joi2019_ho_t3.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for(int i = 0; i < idxs[0].size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:70:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |  for(int i = 0; i < idxs[1].size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:75:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |  for(int i = 0; i < idxs[2].size(); i++) {
      |                 ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...