Submission #935798

# Submission time Handle Problem Language Result Execution time Memory
935798 2024-02-29T14:23:03 Z SpyrosAliv Detecting Molecules (IOI16_molecules) C++17
9 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll, ll>

vector<int> getans(int l, int r, vector<pll> w) {
    vector<int> a;
    for (int i = l; i < r; i++) {
        a.push_back(w[i].second);
    }
    return a;
}

vector<int> find_subset(int l, int u, vector<int> w) {
    int n = w.size();
    vector<pll> arr;
    for (int i = 0; i < n; i++) {
        arr.push_back({w[i], i});
    }
    sort(arr.begin(), arr.end());
    int le = 0, r = 0;
    ll currSum = 0;
    while (r < n) {
        while (currSum < l && r < n) {
            currSum += arr[r++].first;
        }
        while (currSum > u && le < r) {
            currSum -= arr[le++].first;
        }
        if (currSum >= l && currSum <= u) {
            return getans(le, r, arr);
        }
        if (r < n) currSum += arr[r++].first;
    }
    return {};
}
# 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 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 0 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 1 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 1 ms 348 KB OK (n = 3, answer = YES)
11 Correct 1 ms 344 KB OK (n = 3, answer = YES)
12 Correct 1 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 348 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 344 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 348 KB OK (n = 100, answer = NO)
19 Correct 0 ms 348 KB OK (n = 100, answer = YES)
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 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 Correct 1 ms 348 KB OK (n = 12, answer = YES)
6 Incorrect 1 ms 348 KB Contestant can not find answer, jury can
7 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 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 0 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 1 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 1 ms 348 KB OK (n = 3, answer = YES)
11 Correct 1 ms 344 KB OK (n = 3, answer = YES)
12 Correct 1 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 348 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 344 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 348 KB OK (n = 100, answer = NO)
19 Correct 0 ms 348 KB OK (n = 100, answer = YES)
20 Correct 1 ms 348 KB OK (n = 12, answer = YES)
21 Correct 0 ms 348 KB OK (n = 12, answer = YES)
22 Correct 0 ms 348 KB OK (n = 12, answer = NO)
23 Correct 0 ms 348 KB OK (n = 12, answer = NO)
24 Correct 1 ms 348 KB OK (n = 12, answer = YES)
25 Incorrect 1 ms 348 KB Contestant can not find answer, jury can
26 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 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 0 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 1 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 1 ms 348 KB OK (n = 3, answer = YES)
11 Correct 1 ms 344 KB OK (n = 3, answer = YES)
12 Correct 1 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 348 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 344 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 348 KB OK (n = 100, answer = NO)
19 Correct 0 ms 348 KB OK (n = 100, answer = YES)
20 Correct 1 ms 348 KB OK (n = 12, answer = YES)
21 Correct 0 ms 348 KB OK (n = 12, answer = YES)
22 Correct 0 ms 348 KB OK (n = 12, answer = NO)
23 Correct 0 ms 348 KB OK (n = 12, answer = NO)
24 Correct 1 ms 348 KB OK (n = 12, answer = YES)
25 Incorrect 1 ms 348 KB Contestant can not find answer, jury can
26 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 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 0 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 1 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 1 ms 348 KB OK (n = 3, answer = YES)
11 Correct 1 ms 344 KB OK (n = 3, answer = YES)
12 Correct 1 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 348 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 344 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 348 KB OK (n = 100, answer = NO)
19 Correct 0 ms 348 KB OK (n = 100, answer = YES)
20 Correct 1 ms 348 KB OK (n = 12, answer = YES)
21 Correct 0 ms 348 KB OK (n = 12, answer = YES)
22 Correct 0 ms 348 KB OK (n = 12, answer = NO)
23 Correct 0 ms 348 KB OK (n = 12, answer = NO)
24 Correct 1 ms 348 KB OK (n = 12, answer = YES)
25 Incorrect 1 ms 348 KB Contestant can not find answer, jury can
26 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 Correct 0 ms 348 KB OK (n = 1, answer = YES)
4 Correct 0 ms 348 KB OK (n = 2, answer = YES)
5 Correct 0 ms 344 KB OK (n = 2, answer = YES)
6 Correct 0 ms 344 KB OK (n = 3, answer = YES)
7 Correct 0 ms 348 KB OK (n = 3, answer = YES)
8 Correct 1 ms 348 KB OK (n = 3, answer = YES)
9 Correct 0 ms 348 KB OK (n = 3, answer = YES)
10 Correct 1 ms 348 KB OK (n = 3, answer = YES)
11 Correct 1 ms 344 KB OK (n = 3, answer = YES)
12 Correct 1 ms 348 KB OK (n = 3, answer = YES)
13 Correct 0 ms 348 KB OK (n = 3, answer = NO)
14 Correct 0 ms 348 KB OK (n = 3, answer = YES)
15 Correct 0 ms 348 KB OK (n = 3, answer = YES)
16 Correct 0 ms 344 KB OK (n = 3, answer = NO)
17 Correct 0 ms 348 KB OK (n = 3, answer = NO)
18 Correct 0 ms 348 KB OK (n = 100, answer = NO)
19 Correct 0 ms 348 KB OK (n = 100, answer = YES)
20 Correct 1 ms 348 KB OK (n = 12, answer = YES)
21 Correct 0 ms 348 KB OK (n = 12, answer = YES)
22 Correct 0 ms 348 KB OK (n = 12, answer = NO)
23 Correct 0 ms 348 KB OK (n = 12, answer = NO)
24 Correct 1 ms 348 KB OK (n = 12, answer = YES)
25 Incorrect 1 ms 348 KB Contestant can not find answer, jury can
26 Halted 0 ms 0 KB -