답안 #315905

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315905 2020-10-24T11:25:04 Z TrungNotChung Jelly Flavours (IOI20_jelly) C++17
0 / 100
128 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;
const int maxn = 2001;
int n , x , y;
pii a[maxn];
int f[maxn][10001] , f1[maxn][10001];
int find_maximum_unique(int x , int y , vector<int>a1 , vector<int>b1)
{
    n = a1.size();
    for(int i=0 ; i<n ; ++i)
    {
        a[i+1].fi = a1[i];
        a[i+1].se = 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].se;
            if (j >= a[i].fi) f[i][j] = min(f[i - 1][j - a[i].fi] , f[i][j]);
        }
    }
    FORD(i , n , 1)
    {
        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 , 1 , n)
    {
        FORU(j , 1 , x)
        {
            int l = y - f[i][j];
            //cout << l << "\n";
            if (l >= 0) ans = max(ans , i + f1[i + 1][l]);
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 512 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 512 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 29184 KB 1st lines differ - on the 1st token, expected: '689', found: '644'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 115 ms 94456 KB 1st lines differ - on the 1st token, expected: '62', found: '4'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 128 ms 93308 KB 1st lines differ - on the 1st token, expected: '154', found: '61'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 1 ms 512 KB 1st lines differ - on the 1st token, expected: '7', found: '6'
3 Halted 0 ms 0 KB -