Submission #1099777

# Submission time Handle Problem Language Result Execution time Memory
1099777 2024-10-12T05:15:19 Z model_code Nile (IOI24_nile) C++17
0 / 100
171 ms 4312 KB
// incorrect/arshia_exponential.cpp

#include "nile.h"
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

vector<long long> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
    vector<long long> costs;
    int n = W.size(), m = E.size();
    vector<tuple<int, int, int>> helper;
    for (int i = 0; i < n; i++)
        helper.push_back({W[i], A[i], B[i]});
    sort(helper.begin(), helper.end());
    for (int i = 0; i < n; i++) {
        W[i] = get<0>(helper[i]);
        A[i] = get<1>(helper[i]);
        B[i] = get<2>(helper[i]);
    }

    for (int i = 0; i < m; i++) {
        long long best = LONG_LONG_MAX;
        for (int msk = 0; msk < 1 << n; msk++) {
            if (__builtin_popcount(msk) & 1)
                continue;

            bool ok = true;
            long long cost = 0;
            for (int j = 0, prev = -1; ok && j < n; j++)
                if (msk >> j & 1)
                    if (~prev) {
                        ok &= abs(W[prev] - W[j]) <= E[i];
                        cost += B[j] + B[prev];
                        prev = -1;
                    }
                    else
                        prev = j;
                else
                    cost += A[j];

            if (ok)
                best = min(best, cost);
        }
        costs.push_back(best);
    }
    return costs;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4312 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 171 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 4304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 171 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -