Submission #50195

# Submission time Handle Problem Language Result Execution time Memory
50195 2018-06-08T08:30:27 Z hugo_pm Detecting Molecules (IOI16_molecules) C++14
0 / 100
3 ms 704 KB
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w)
{
    vector<pair<int, int>> rafin(w.size());
    for (int i = 0; i < (int)(w.size()); ++i) rafin[i] = {w[i], i+1};
    sort(rafin.begin(), rafin.end());
    sort(w.begin(), w.end());
    int somme = 0;
    int k = w.size() - 1;
    int i = k;
    while ((somme < l || somme > u) && (i >= 0 && k >= 0))
    {
        if (somme < l) { somme += w[i]; --i; }
        else { somme -= w[k]; --k; }
    }
    if (somme < l || somme > u) return {};
    ++i;
    vector<int> ans(k-i+1);
    for (int o = i; o <= k; ++o) ans[o-i] = rafin[o].second;
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 3 ms 604 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 704 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 704 KB sum of weights should be in [302..304] but it is 305
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 3 ms 604 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 704 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 3 ms 604 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 704 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 3 ms 604 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 704 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB OK (n = 1, answer = NO)
2 Correct 3 ms 604 KB OK (n = 1, answer = NO)
3 Incorrect 2 ms 704 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -