Submission #424181

# Submission time Handle Problem Language Result Execution time Memory
424181 2021-06-11T17:43:41 Z MOUF_MAHMALAT Detecting Molecules (IOI16_molecules) C++14
9 / 100
1 ms 204 KB
#include "molecules.h"
#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
using namespace std;
typedef int ll;
multiset<ll>s;
vector<ll>v;
pair<ll,ll>p[200009];
ll sum,id;
vector<int>find_subset(int l, int u, vector<int> w)
{
    for(ll i=0; i<w.size(); i++)
    {
        sum+=w[i];
        s.insert(w[i]);
        p[i]= {w[i],i};
    }
    while(sum>u)
    {
        auto z=s.lower_bound(sum-u);
        if(z==s.end())
            z--;
        sum-=*z;
        s.erase(z);
        //cout<<sum<<endl;
    }
    if(sum<l)
        return v;
    sort(p,p+w.size());
    for(auto x:s)
    {
        while(x!=p[id].first)
            id++;
        v.push_back(p[id].second);
        id++;
    }
    sort(all(v));
    return v;
}

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:12:18: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(ll i=0; i<w.size(); i++)
      |                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB OK (n = 1, answer = NO)
2 Correct 0 ms 204 KB OK (n = 1, answer = NO)
3 Correct 0 ms 204 KB OK (n = 1, answer = YES)
4 Correct 0 ms 204 KB OK (n = 2, answer = YES)
5 Correct 0 ms 204 KB OK (n = 2, answer = YES)
6 Correct 0 ms 204 KB OK (n = 3, answer = YES)
7 Correct 1 ms 204 KB OK (n = 3, answer = YES)
8 Correct 0 ms 204 KB OK (n = 3, answer = YES)
9 Correct 1 ms 204 KB OK (n = 3, answer = YES)
10 Correct 1 ms 204 KB OK (n = 3, answer = YES)
11 Correct 0 ms 204 KB OK (n = 3, answer = YES)
12 Correct 0 ms 204 KB OK (n = 3, answer = YES)
13 Correct 0 ms 204 KB OK (n = 3, answer = NO)
14 Correct 0 ms 204 KB OK (n = 3, answer = YES)
15 Correct 0 ms 204 KB OK (n = 3, answer = YES)
16 Correct 1 ms 204 KB OK (n = 3, answer = NO)
17 Correct 0 ms 204 KB OK (n = 3, answer = NO)
18 Correct 1 ms 204 KB OK (n = 100, answer = NO)
19 Correct 0 ms 204 KB OK (n = 100, answer = YES)
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB OK (n = 1, answer = NO)
2 Correct 0 ms 204 KB OK (n = 1, answer = NO)
3 Correct 0 ms 204 KB OK (n = 1, answer = YES)
4 Correct 0 ms 204 KB OK (n = 2, answer = YES)
5 Correct 0 ms 204 KB OK (n = 2, answer = YES)
6 Correct 0 ms 204 KB OK (n = 3, answer = YES)
7 Correct 1 ms 204 KB OK (n = 3, answer = YES)
8 Correct 0 ms 204 KB OK (n = 3, answer = YES)
9 Correct 1 ms 204 KB OK (n = 3, answer = YES)
10 Correct 1 ms 204 KB OK (n = 3, answer = YES)
11 Correct 0 ms 204 KB OK (n = 3, answer = YES)
12 Correct 0 ms 204 KB OK (n = 3, answer = YES)
13 Correct 0 ms 204 KB OK (n = 3, answer = NO)
14 Correct 0 ms 204 KB OK (n = 3, answer = YES)
15 Correct 0 ms 204 KB OK (n = 3, answer = YES)
16 Correct 1 ms 204 KB OK (n = 3, answer = NO)
17 Correct 0 ms 204 KB OK (n = 3, answer = NO)
18 Correct 1 ms 204 KB OK (n = 100, answer = NO)
19 Correct 0 ms 204 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 204 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB OK (n = 1, answer = NO)
2 Correct 0 ms 204 KB OK (n = 1, answer = NO)
3 Correct 0 ms 204 KB OK (n = 1, answer = YES)
4 Correct 0 ms 204 KB OK (n = 2, answer = YES)
5 Correct 0 ms 204 KB OK (n = 2, answer = YES)
6 Correct 0 ms 204 KB OK (n = 3, answer = YES)
7 Correct 1 ms 204 KB OK (n = 3, answer = YES)
8 Correct 0 ms 204 KB OK (n = 3, answer = YES)
9 Correct 1 ms 204 KB OK (n = 3, answer = YES)
10 Correct 1 ms 204 KB OK (n = 3, answer = YES)
11 Correct 0 ms 204 KB OK (n = 3, answer = YES)
12 Correct 0 ms 204 KB OK (n = 3, answer = YES)
13 Correct 0 ms 204 KB OK (n = 3, answer = NO)
14 Correct 0 ms 204 KB OK (n = 3, answer = YES)
15 Correct 0 ms 204 KB OK (n = 3, answer = YES)
16 Correct 1 ms 204 KB OK (n = 3, answer = NO)
17 Correct 0 ms 204 KB OK (n = 3, answer = NO)
18 Correct 1 ms 204 KB OK (n = 100, answer = NO)
19 Correct 0 ms 204 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 204 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB OK (n = 1, answer = NO)
2 Correct 0 ms 204 KB OK (n = 1, answer = NO)
3 Correct 0 ms 204 KB OK (n = 1, answer = YES)
4 Correct 0 ms 204 KB OK (n = 2, answer = YES)
5 Correct 0 ms 204 KB OK (n = 2, answer = YES)
6 Correct 0 ms 204 KB OK (n = 3, answer = YES)
7 Correct 1 ms 204 KB OK (n = 3, answer = YES)
8 Correct 0 ms 204 KB OK (n = 3, answer = YES)
9 Correct 1 ms 204 KB OK (n = 3, answer = YES)
10 Correct 1 ms 204 KB OK (n = 3, answer = YES)
11 Correct 0 ms 204 KB OK (n = 3, answer = YES)
12 Correct 0 ms 204 KB OK (n = 3, answer = YES)
13 Correct 0 ms 204 KB OK (n = 3, answer = NO)
14 Correct 0 ms 204 KB OK (n = 3, answer = YES)
15 Correct 0 ms 204 KB OK (n = 3, answer = YES)
16 Correct 1 ms 204 KB OK (n = 3, answer = NO)
17 Correct 0 ms 204 KB OK (n = 3, answer = NO)
18 Correct 1 ms 204 KB OK (n = 100, answer = NO)
19 Correct 0 ms 204 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 204 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB OK (n = 1, answer = NO)
2 Correct 0 ms 204 KB OK (n = 1, answer = NO)
3 Correct 0 ms 204 KB OK (n = 1, answer = YES)
4 Correct 0 ms 204 KB OK (n = 2, answer = YES)
5 Correct 0 ms 204 KB OK (n = 2, answer = YES)
6 Correct 0 ms 204 KB OK (n = 3, answer = YES)
7 Correct 1 ms 204 KB OK (n = 3, answer = YES)
8 Correct 0 ms 204 KB OK (n = 3, answer = YES)
9 Correct 1 ms 204 KB OK (n = 3, answer = YES)
10 Correct 1 ms 204 KB OK (n = 3, answer = YES)
11 Correct 0 ms 204 KB OK (n = 3, answer = YES)
12 Correct 0 ms 204 KB OK (n = 3, answer = YES)
13 Correct 0 ms 204 KB OK (n = 3, answer = NO)
14 Correct 0 ms 204 KB OK (n = 3, answer = YES)
15 Correct 0 ms 204 KB OK (n = 3, answer = YES)
16 Correct 1 ms 204 KB OK (n = 3, answer = NO)
17 Correct 0 ms 204 KB OK (n = 3, answer = NO)
18 Correct 1 ms 204 KB OK (n = 100, answer = NO)
19 Correct 0 ms 204 KB OK (n = 100, answer = YES)
20 Incorrect 0 ms 204 KB Contestant can not find answer, jury can
21 Halted 0 ms 0 KB -