Submission #102045

# Submission time Handle Problem Language Result Execution time Memory
102045 2019-03-22T00:30:57 Z tim25871014 Detecting Molecules (IOI16_molecules) C++17
0 / 100
3 ms 384 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> find_subset(int l,int u,vector<int> w){

    vector<int> ans;

    int n=w.size();
    vector<pair<int,int>> wp;
    for(int i=0;i<n;i++)
        wp.push_back({w[i],i});
    sort(wp.begin(),wp.end());

    int sum=0,check=0;
    deque<pair<int,int>> sub;
    for(int i=0;i<n;i++){
        sum+=w[i],sub.push_back(wp[i]);
        while(sum>u) sum-=sub.front().second,sub.pop_front();
        if(sum<=u && sum>=l) {check=1;break;}
    }
    if(!check) return ans;
    for(auto i:sub) ans.push_back(i.second);
    return ans;

}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 384 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 Correct 3 ms 256 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB OK (n = 1, answer = NO)
2 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -