Submission #1015602

#TimeUsernameProblemLanguageResultExecution timeMemory
1015602UnforgettableplDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms432 KiB
#include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pair<int,int>> arr; for(int i=0;i<w.size();i++)arr.emplace_back(w[i],i); sort(arr.begin(),arr.end()); bool flag = false; redo: vector<int> ans; int sum = 0; for(auto[a,b]:arr){ sum+=a; ans.emplace_back(b); if(l<=sum and sum<=u)return ans; } if(flag)return {}; flag = true; reverse(arr.begin(),arr.end()); goto redo; }

Compilation message (stderr)

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