Submission #968168

# Submission time Handle Problem Language Result Execution time Memory
968168 2024-04-23T08:12:51 Z ReLice Detecting Molecules (IOI16_molecules) C++17
0 / 100
1 ms 348 KB
#include "molecules.h"
#include <bits/stdc++.h>
#define ll int
#define str string
#define ins insert
#define ld long double
#define pb push_back
#define pf push_front
#define pof pop_front()
#define pob pop_back()
#define lb lower_bound
#define ub upper_bound
#define endl "\n"
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define sz size()
#define vll vector<ll>
#define bc back()
#define arr array
#define pll vector<pair<ll,ll>>
using namespace std;/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>*/
template<class S,class T>
bool chmin(S &a,const T &b) {
	return a>b?(a=b)==b:false;
}
template<class S,class T>
bool chmax(S &a,const T &b) {
	return a<b?(a=b)==b:false;
}
vll find_subset(ll l, ll u, vll w) {
    ll i,j;
    ll n=w.sz;
    ll sum=0;
    vll v;
    sort(all(w));
    if(w[0]>u)return v;
    ll x=n;
    for(i=0;i<n;i++){
        if(sum+w[i]<l)sum+=w[i];
        else {
            if(sum+w[i]<=u){
                for(j=0;j<=i;j++){
                    v.pb(w[i]);
                }
                return v;
            }
            x=i;
            break;
        }
    }
    if(x==n)return v;
    for(i=0;i<x;i++){
        if(w[n-i-1]<x)return v;
        sum-=w[i];
        sum+=w[n-i-1];
        if(sum>=l && sum<=u){
            for(j=i+1;j<x;j++) v.pb(w[i]);
            for(j=0;j<=i;j++) v.pb(w[n-i-1]);
            return v;
        }
    }
    return {};
}

















# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (n = 1, answer = NO)
2 Correct 0 ms 344 KB OK (n = 1, answer = NO)
3 Incorrect 1 ms 348 KB Integer 10 violates the range [0, 0]
4 Halted 0 ms 0 KB -