Submission #790515

#TimeUsernameProblemLanguageResultExecution timeMemory
790515AndreyDetecting Molecules (IOI16_molecules)C++14
100 / 100
41 ms9024 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { queue<pair<long long,long long>> idk; vector<pair<long long,long long>> haha(0); for(long long i = 0; i < w.size(); i++) { haha.push_back({w[i],i}); } sort(haha.begin(),haha.end()); long long sb = 0,a; for(long long i = 0; i < w.size(); i++) { a = haha[i].first; sb+=a; idk.push(haha[i]); while(sb > u) { sb-=idk.front().first; idk.pop(); } if(sb <= u && sb >= l) { break; } } if(sb > u || sb < l) { return vector<int> (0); } vector<int> ans(0); while(!idk.empty()) { ans.push_back(idk.front().second); idk.pop(); } return ans; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:8:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(long long i = 0; i < w.size(); i++) {
      |                          ~~^~~~~~~~~~
molecules.cpp:13:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(long long i = 0; i < w.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...