Submission #134321

# Submission time Handle Problem Language Result Execution time Memory
134321 2019-07-22T12:27:20 Z reda Detecting Molecules (IOI16_molecules) C++14
0 / 100
2 ms 256 KB
#include<bits/stdc++.h>
using namespace std ;
#define  pb  push_back
#define  ll long long
#define  ld  long  double
#define  mp make_pair
#define  MOD 1000000007
#define endl '\n'
#pragma GCC optimize ("O3")
#define fi  first
#define se  second
vector<int> ans;
vector<int> find_subset(int l, int u, vector<int> w)
{
    vector<pair<int,int>> v;
    for(int i=0;i<w.size();i++)
        v.pb(mp(w[i],i));
    sort(v.begin(),v.end());
    if(v[w.size()-1].fi<l || v[0].fi>u)return ans;
    ll sum =0;
    for(int i=0;i<w.size();i++)
    {
      sum+= v[i].fi;
      if(sum>u)break;
      if(sum>=l && sum<=u )
       ans.pb(i);
    }
    return ans;
}
/*int main ()
{

    return 0 ;
}
*/

Compilation message

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)
                 ~^~~~~~~~~
molecules.cpp:21:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<w.size();i++)
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB OK (n = 1, answer = NO)
2 Correct 2 ms 256 KB OK (n = 1, answer = NO)
3 Correct 2 ms 256 KB OK (n = 1, answer = YES)
4 Incorrect 2 ms 256 KB Contestant can not find answer, jury can
5 Halted 0 ms 0 KB -