Submission #304734

# Submission time Handle Problem Language Result Execution time Memory
304734 2020-09-21T19:54:05 Z Gilgamesh Detecting Molecules (IOI16_molecules) C++17
0 / 100
0 ms 256 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l, int u, std::vector<int> w) {
    int n = w.size();
    vector<int> ans;
    vector<pair<int, int>> mlcs;
    for(int i = 0; i < n; ++i){
        mlcs.emplace_back(make_pair(w[i], i));
    }
    sort(mlcs.begin(), mlcs.end());
    int p1 = 0, p2 = 0;
    long long cursum = 0;
    while(p2 < n){
        cursum += mlcs[p2++].first;
        while(cursum > u){
            cursum -= mlcs[p1++].first;
        }
        if(cursum >= l && cursum <= u){
            break;
        }
    }
    for(int i = p1; i <= p2; ++i){
        ans.emplace_back(mlcs[i].second);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB sum of weights should be in [302..304] but it is 353
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -