Submission #995611

#TimeUsernameProblemLanguageResultExecution timeMemory
995611MarszpaceDetecting Molecules (IOI16_molecules)C++14
0 / 100
0 ms348 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<pair<int,int>> p; for(int i=0;i<w.size();i++){ p.push_back({w[i],i+1}); } sort(p.begin(),p.end(),greater<pair<int,int>>()); vector<int> subs; int sum=0; for(auto [wi,pos]:p){ if(sum+wi<=u){ sum+=wi; subs.push_back(pos); if(sum>=l){return subs;} } } return vector<int>(0); }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:7:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |   for(int i=0;i<w.size();i++){
      |               ~^~~~~~~~~
molecules.cpp:14:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   14 |   for(auto [wi,pos]:p){
      |            ^
#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...