Submission #261186

# Submission time Handle Problem Language Result Execution time Memory
261186 2020-08-11T13:37:44 Z Black_Ghost Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define ss second
#define ff first
#define pb push_back
#define mp make_pair

vector<int> find_subset(int l,int u,vector<int> w){
    int n=w.size();
    vector<int> res,res2;
    vector<pair<ll,int> > v;
    vector<ll> v2;
    for(int i=0;i<n;i++)
        v.pb(mp(w[i],i+1));
    sort(v.begin(),v.end());
    //v2.pb(1e12);
    for(int i=0;i<n;i++)v2.pb(v[i].ff);
    v2.pb(1e12);
    vector<ll>::iterator it;
    ll sum=0;
    for(int i=0;i<n;i++){
        sum+=v[i].ff;
        res.pb(v[i].ss);
        if(sum>=l)break;
        it=upper_bound(v2.begin(),v2.end(),l-sum-1);
        int idx=(it-v2.begin());
        if(v2[idx]==1e12)continue;
        if(idx<=i)continue;
        sum+=v2[idx];
        res.pb(v[idx].ss);
        break;

    }
    if(sum<l)return res2;
    if(sum>u)return res2;
    return res;
}
/*
MMMM
*/


# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB OK (n = 1, answer = NO)
2 Correct 1 ms 256 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 256 KB Integer 1 violates the range [0, 0]
4 Halted 0 ms 0 KB -