[Offer收割]编程练习赛1 register

Ended

Participants:955

Verdict:Time Limit Exceeded
Score:70 / 100
Submitted:2016-03-06 16:54:27

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdint>
#include <unordered_set>
using namespace std;
typedef long long ll;
ll q,
n, m, k, t,
arr[200], brr[200], res, dp[20000];
int main() {
    ios::sync_with_stdio(false);
    cin >> q;
    while (q--) {
        cin >> n >> m >> k >> t;
        for (int i = 1; i <= m; ++i) cin >> arr[i]; //  
        for (int i = 1; i <= m; ++i) cin >> brr[i]; //  k
        res = 0;
        
        for (int i = 1; i <= n; ++i) {
            //dp
            memset(dp, -1, sizeof(dp));
            dp[0] = 0;
            for (int x = 0; x <= k + 1; ++x) if(dp[x] >= 0){
                for (int y = 1, z; y <= m; ++y) {
                    if (brr[y] == 0) continue;
                    for (z = 1; x + z * brr[y] <= k + 1; ++z) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX