답안 #316273

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
316273 2020-10-25T18:51:21 Z lauran Jelly Flavours (IOI20_jelly) C++14
0 / 100
111 ms 131576 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;

int find_maximum_unique(int x, int y, vector <int> a, vector <int> b) {
    int n = a.size();
    if (x <= 500 && y <= 500 && n <= 200) {
        // subtask 1, 2
        int dp[n + 10][x + 10][y + 10] = {0};
        for (int i = 0; i < n; i++) {
            for (int xx = 0; xx <= x; xx++)
                for (int yy = 0; yy <= y; yy++) {
                    if (i > 0)
                        dp[i][xx][yy] = dp[i - 1][xx][yy];
                    if (xx >= a[i] && i > 0)
                        dp[i][xx][yy] = max(dp[i][xx][yy], dp[i - 1][xx - a[i]][yy] + 1);
                    if (yy >= b[i] && i > 0)
                        dp[i][xx][yy] = max(dp[i][xx][yy], dp[i - 1][xx][yy - b[i]] + 1);
                }
        }
        int ans = dp[n - 1][0][0];
        for (int xx = 0; xx <= x; xx++)
            for (int yy = 0; yy <= y; yy++)
                ans = max(ans, dp[n - 1][xx][yy]);
        return ans;
    }
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 3456 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 3456 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 111 ms 131576 KB 1st lines differ - on the 1st token, expected: '689', found: '688'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 3456 KB 1st lines differ - on the 1st token, expected: '8', found: '7'
2 Halted 0 ms 0 KB -