Submission #379628

#TimeUsernameProblemLanguageResultExecution timeMemory
379628Pichon5Detecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms364 KiB
#include "molecules.h" #include <bits/stdc++.h> #define lcm(a,b) (a/__gcd(a,b))*b #define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define ll long long int #define vi vector<int> #define vll vector<ll> #define pb push_back #define F first #define S second #define mp make_pair //salida rapida "\n" //DECIMALES fixed<<sp(n)<<x<<endl; //gcd(a,b)= ax + by //lCB x&-x using namespace std; vector<int> find_subset(int l, int u,vector<int> w){ vi res; vector<pair<int,int> >v; for(int i=0;i<w.size();i++){ v.pb({w[i],i}); } sort(v.begin(),v.end()); ll sum=0; for(int i=0;i<v.size();i++){ sum+=v[i].F; res.pb(v[i].S); if(sum>u){ res.clear(); return res; } if(sum>=l && sum<=u){ return res; } } res.clear(); return res; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(int i=0;i<w.size();i++){
      |                 ~^~~~~~~~~
molecules.cpp:26:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...