Submission #315918

# Submission time Handle Problem Language Result Execution time Memory
315918 2020-10-24T12:25:23 Z ddmazter Jelly Flavours (IOI20_jelly) C++14
0 / 100
103 ms 94456 KB
#include <iostream>
#include <bits/stdc++.h>
#define pii pair <int , int>
#define fi first
#define se second
#define FORU(i , a , b) for(int i = a ; i <= b ; i++)
#define FORD(i , a , b) for(int i = a ; i >= b ; i--)
#define getbit(i , x) ((x >> i) & 1)
#define oo (int)(1e9)
#define task "JELLY"
using namespace std;
int n;
int f[2009][10009] , f1[2009][10009];
pii a[2009];
int find_maximum_unique(int x, int y, vector<int> a1, vector<int> b1)
{
    n = a1.size();
    FORU(i , 0 , n)
    {
        a[i] = {a1[i] , b1[i]};
    }
    FORU(i , 0 , n) FORU(j , 0 , x) f[i][j] = oo;
    f[0][0] = 0;
    FORU(i , 1 , n)
    {
        FORU(j , 0 , x)
        {
            f[i][j] = f[i - 1][j] + a[i - 1].se;
            if (j >= a[i - 1].fi) f[i][j] = min(f[i - 1][j - a[i - 1].fi] , f[i][j]);
        }
    }
    FORD(i , n - 1 , 0)
    {
        FORU(j , 0 , y)
        {
            f1[i][j] = f1[i + 1][j];
            if (j >= a[i].se) f1[i][j] = max(f1[i][j] , f1[i + 1][j - a[i].se] + 1);
        }
    }
    int ans = 0;
    FORU(i , 0 , n)
    {
        int l = y - f[i][x];
        if (l >= 0) ans = max(ans , i + f1[i][l]);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 29184 KB 1st lines differ - on the 1st token, expected: '689', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 103 ms 94456 KB 1st lines differ - on the 1st token, expected: '62', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 98 ms 93376 KB 1st lines differ - on the 1st token, expected: '154', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB 1st lines differ - on the 1st token, expected: '8', found: '0'
2 Halted 0 ms 0 KB -