Submission #1093025

# Submission time Handle Problem Language Result Execution time Memory
1093025 2024-09-25T17:51:30 Z ortsac Olympic Bus (JOI20_ho_t4) C++17
0 / 100
0 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 tl = n, tr = n, are = n, curr = 0, qtd = 0;
        for (int i = 0; i < n; i++) {
            bool k = (mask & (1 << i));
            if (k) {
                // go to r + 1
                curr += (v[tr + 1] - v[are]);
                if (ti[tr + 1] >= curr) qtd++;
                are = tr + 1;
                tr++;
            } else {
                curr += (v[are] - v[tl - 1]);
                if (ti[tl - 1] >= curr) qtd++;
                are = tl - 1;
                tl--;
            }
        }
        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 0 ms 348 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 0 ms 348 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 -