Submission #1115319

# Submission time Handle Problem Language Result Execution time Memory
1115319 2024-11-20T10:29:17 Z komasan Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 336 KB
#include<bits/stdc++.h>

using namespace std;

using i64 = long long;
using u32 = unsigned;
using u64 = unsigned long long;

#define fi first
#define se second

template<class A, class B> inline bool maximize(A& x, B y) {
    if (x < y) {
        x = y;
        return true;
    } else
        return false;
};

template<class A, class B> inline bool minimize(A& x, B y) {
    if (x > y) {
        x = y;
        return true;
    } else
        return false;
};

vector<int> find_subset(int l, int r, vector<int> a) {
    vector<pair<int, int>> p;
    for (int i = 0; i < (int)a.size(); i++)
        p.push_back(make_pair(a[i], i + 1));

    sort(p.begin(), p.end());

    int sum = 0, j = 0;
    for (int i = 0; i < (int)p.size(); i++) {
        sum += p[i].fi;

        while (sum > r)
            sum -= p[j++].fi;
        
        if (sum >= l) {
            vector<int> ans;
            for (int k = j; k <= i; k++)
                ans.push_back(p[k].se);

            sort(ans.begin(), ans.end());

            return ans;
        }
    }

    return {};
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 12, answer = YES)
2 Correct 1 ms 336 KB OK (n = 12, answer = YES)
3 Correct 1 ms 336 KB OK (n = 12, answer = NO)
4 Correct 1 ms 336 KB OK (n = 12, answer = NO)
5 Incorrect 1 ms 336 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 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB OK (n = 1, answer = NO)
2 Correct 1 ms 336 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 336 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -