Submission #1141034

#TimeUsernameProblemLanguageResultExecution timeMemory
1141034SG2AlokDetecting Molecules (IOI16_molecules)C++20
100 / 100
36 ms4132 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<int> ans; vector<pair<int, int>> nw; for(int i = 0; i < w.size(); i++){ nw.push_back({w[i], i}); } sort(nw.begin(), nw.end()); long long sum = 0; for(int i = 0, j = 0; j < nw.size(); j++){ sum += nw[j].first; while(sum > u){ sum -= nw[i++].first; } if(sum >= l && sum <= u){ for(int k = i; k <= j; k++){ ans.push_back(nw[k].second); } break; } } return ans; }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...