Submission #70974

#TimeUsernameProblemLanguageResultExecution timeMemory
70974RezwanArefin01Detecting Molecules (IOI16_molecules)C++17
0 / 100
3 ms356 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int L, int u, vector<int> w) { vector<int> v; for(int i = 0; i < w.size(); i++) v.push_back(i); sort(v.begin(), v.end(), [&](int i, int j) { return w[i] < w[j]; }); int l = 0, r = 0; int sum = 0; while(l < w.size()) { while(r < w.size() && sum < L) { sum += w[v[r++]]; } if(sum >= L) { vector<int> ans; for(int i = l; i < r; i++) ans.push_back(v[i]); return ans; } sum -= w[v[l++]]; } return {}; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:6:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < w.size(); i++) 
                    ~~^~~~~~~~~~
molecules.cpp:13:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(l < w.size()) {
           ~~^~~~~~~~~~
molecules.cpp:14:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(r < w.size() && sum < 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...