Submission #1278

# Submission time Handle Problem Language Result Execution time Memory
1278 2013-07-01T07:08:50 Z tncks0121 앱 (KOI13_app) C++
21 / 21
0 ms 1168 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>

using namespace std;
typedef long long ll;
typedef long double llf;
typedef unsigned long long llu;
const int INF = 987654321;
const ll LINF = (ll)1e15;

const int N_ = 105;
const int K_ = 10000005;
const int C_ = 100 * N_;

int N, K, M[N_], C[N_];
ll Table[C_];

int main() {
    int i, j;

    scanf("%d%d", &N, &K);
    for(i = 1; i <= N; i++) scanf("%d", M+i);
    for(i = 1; i <= N; i++) scanf("%d", C+i);

    for(i = 1; i <= N; i++) {
        for(j = 10000; j >= C[i]; j--)
            Table[j] = max(Table[j], Table[j - C[i]] + M[i]);
    }

    for(j = 0; j <= 10000; j++) {
        if(Table[j] >= K) return 0 & printf("%d\n", j);
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
6 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
6 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
6 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
6 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct
5 Correct 0 ms 1168 KB Output is correct
6 Correct 0 ms 1168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1168 KB Output is correct
2 Correct 0 ms 1168 KB Output is correct
3 Correct 0 ms 1168 KB Output is correct
4 Correct 0 ms 1168 KB Output is correct