Submission #624289

# Submission time Handle Problem Language Result Execution time Memory
624289 2022-08-07T16:31:41 Z Vovamatrix Detecting Molecules (IOI16_molecules) C++14
0 / 100
1 ms 304 KB
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define MAXN 200007
ll w[MAXN];
ll prefsum[MAXN];
vector<int> find_subset(int l, int u, vector<int> w)
{
    ll n=w.size();
    sort(w.begin(),w.end());
    prefsum[0]=0;
    for(int i=1;i<=n;i++) prefsum[i]=prefsum[i-1]+w[i-1];
    ll itr1=0,itr2=1;
    vector<int> v;
    while(itr2<=n)
    {
        if(prefsum[itr2]-prefsum[itr1]>u) itr1++;
        else if(prefsum[itr2]-prefsum[itr1]<l) itr2++;
        else
        {
            for(int i=itr1+1;i<=itr2;i++) v.pb(w[i]);
            break;
        }
    }
    return v;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB OK (n = 1, answer = NO)
2 Correct 1 ms 304 KB OK (n = 1, answer = NO)
3 Correct 1 ms 212 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 212 KB Integer 50 violates the range [0, 1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer 50 violates the range [0, 11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB OK (n = 1, answer = NO)
2 Correct 1 ms 304 KB OK (n = 1, answer = NO)
3 Correct 1 ms 212 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 212 KB Integer 50 violates the range [0, 1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB OK (n = 1, answer = NO)
2 Correct 1 ms 304 KB OK (n = 1, answer = NO)
3 Correct 1 ms 212 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 212 KB Integer 50 violates the range [0, 1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB OK (n = 1, answer = NO)
2 Correct 1 ms 304 KB OK (n = 1, answer = NO)
3 Correct 1 ms 212 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 212 KB Integer 50 violates the range [0, 1]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB OK (n = 1, answer = NO)
2 Correct 1 ms 304 KB OK (n = 1, answer = NO)
3 Correct 1 ms 212 KB OK (n = 1, answer = YES)
4 Incorrect 0 ms 212 KB Integer 50 violates the range [0, 1]
5 Halted 0 ms 0 KB -