Submission #40036

#TimeUsernameProblemLanguageResultExecution timeMemory
40036igziDetecting Molecules (IOI16_molecules)C++14
100 / 100
71 ms6868 KiB
#include <bits/stdc++.h> #include "molecules.h" #define maxN 200002 using namespace std; struct molekul{ long long x,p; }; bool poredi(molekul a,molekul b){ return a.x<b.x; } vector <int> find_subset(int l,int u,vector <int> w){ long long i,a,b,k; molekul m[maxN]; vector <int> v; for(i=0;i<w.size();i++){ m[i].x=w[i]; m[i].p=i; } a=b=k=0; sort(m,m+w.size(),poredi); while(k<w.size() && b<l){ a+=m[k].x; b+=m[w.size()-1-k].x; k++; } if(b>=l && a<=u){ int x=k; while(a<l){ a+=m[x].x-m[x-k].x; x++; } for(i=x-k;i<x;i++){ v.push_back(m[i].p); } } return v; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:19:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(i=0;i<w.size();i++){
              ^
molecules.cpp:25:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(k<w.size() && b<l){
            ^
#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...