Submission #243701

# Submission time Handle Problem Language Result Execution time Memory
243701 2020-07-01T15:10:41 Z Kubin Detecting Molecules (IOI16_molecules) C++17
0 / 100
4 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

vector<int> find_subset(int l, int u, vector<int> w)
{
    const size_t n = w.size();
    sort(w.begin(), w.end());
    int a = w[0];
    for(auto& x : w)
        x -= a;

    vector<int64_t> s(n + 1), z(n + 1);
    for(size_t i = 0; i < n; i++)
        s[i+1] = s[i] + w[i], z[i+1] = z[i] + w[n-i-1];

    vector<int> result;
    for(size_t k = 1; result.empty() and k <= n; k++)
    {
        for(size_t i = 0; result.empty() and i <= k; i++)
        {
            auto c = (int64_t)k * a + s[i] + z[k-i];
            if(l <= c and c <= u)
            {
                result.reserve(k);
                copy(w.begin(), w.begin() + i, back_inserter(result));
                copy(w.end() - (k-i), w.end(), back_inserter(result));
            }
        }
    }

    for(auto& x : result)
        x += a;
    return result;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 4 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 4 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 4 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 4 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB OK (n = 1, answer = NO)
2 Correct 4 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 4 ms 256 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -