Submission #1012342

# Submission time Handle Problem Language Result Execution time Memory
1012342 2024-07-02T02:36:46 Z adrielcp Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 436 KB
#include <bits/stdc++.h>
#include "molecules.h"
using namespace std;

vector<int> find_subset(int l, int u, vector<int> w) {
    int n = w.size();
    int sum = w[0];
    int r = 0;
    sort(w.begin(), w.end());
    for (int i = 0; i < n; i++) {
        r = max(r, i);
        while (r+1 < n && sum + w[r+1] <= u) {
            r++;
            sum += w[r];
        }
        if (sum >= l && sum <= u) {
            vector<int> a(r-i+1);
            iota(a.begin(), a.end(), i+1);
            return a;
        }
        sum -= w[i];
    }

    return vector<int>();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 436 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB OK (n = 12, answer = YES)
2 Correct 0 ms 348 KB OK (n = 12, answer = YES)
3 Correct 0 ms 348 KB OK (n = 12, answer = NO)
4 Correct 0 ms 348 KB OK (n = 12, answer = NO)
5 Incorrect 0 ms 348 KB sum of weights should be in [290..300] but it is 301
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 436 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 436 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 436 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB OK (n = 1, answer = NO)
2 Correct 0 ms 348 KB OK (n = 1, answer = NO)
3 Incorrect 0 ms 436 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -