Submission #1093018

# Submission time Handle Problem Language Result Execution time Memory
1093018 2024-09-25T17:43:10 Z ortsac Olympic Bus (JOI20_ho_t4) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

int brute(int n, int l, vector<int> x1, vector<int> t1) {
    vector<int> v, ti;
    for (int i = 0; i < n; i++) {
        v.push_back(x1[i] - l);
        ti.push_back(t1[i]);
    }
    v.push_back(0);
    ti.push_back(-1);
    for (int i = 0; i < n; i++) {
        v.push_back(x1[i]);
        ti.push_back(t1[i]);
    }
    int ans = 0;
    for (int mask = 0; mask < (1 << n); mask++) {
        int l = n, r = n, are = n, curr = 0, qtd = 0;
        for (int i = 0; i < n; i++) {
            bool k = (mask & (1LL << i));
            if (k) {
                // go to r + 1
                curr += (v[r + 1] - v[are]);
                if (ti[r + 1] >= curr) qtd++;
                are = r + 1;
                r++;
            } else {
                curr += (v[are] - v[l - 1]);
                if (ti[l - 1] >= curr) qtd++;
                are = l - 1;
                l--;
            }
        }
        ans = max(ans, qtd);
    }
    return ans;
}

int32_t main() {
    //freopen("in", "r", stdin);
    int n, l;
    cin >> n >> l;
    vector<int> x1(n), t1(n);
    for (int i = 0; i < n; i++) {
        cin >> x1[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> t1[i];
    }
    cout << brute(n, l, x1, t1) << "\n";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -