Submission #54332

# Submission time Handle Problem Language Result Execution time Memory
54332 2018-07-03T07:33:56 Z MoNsTeR_CuBe Detecting Molecules (IOI16_molecules) C++17
0 / 100
3 ms 632 KB
#include "molecules.h"
#include <bits/stdc++.h>
//#define int long long

using namespace std;

vector<int> find_subset(int l, int r, vector<int> w){
    int n = w.size();
    vector< pair<int, int> > v;
    for(int i = 0; i < n; i++){
        v[i] = {w[i], i};
    }
    sort(v.begin(), v.end());
    int sum = 0;
    int right = -1;
    for(int i = 0; i < n; i++){
        for(int j = right; j < n; j++){
            if(j != right) sum += v[j].first;
            //cout << sum << endl;
            if(sum >= l && sum <= r){
                vector<int> v1(0);
                for(int k = i; k <= j; k++){
                    v1.push_back(v[k].second);
                }
                return v1;
            }
            right = j;
            if(sum > r){
                sum -= v[i].first;
                break;
            }
        }
    }
    vector<int> v1(0);
    return v1;
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -