Submission #1123924

#TimeUsernameProblemLanguageResultExecution timeMemory
1123924njoopDetecting Molecules (IOI16_molecules)C++17
69 / 100
39 ms4028 KiB
#include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int> ans; vector<pair<int, int>> v; for(int i=0; i<w.size(); i++) { v.push_back({w[i], i}); } sort(v.begin(), v.end()); int sum = 0, p1=0, p2=0; sum += v[p2].first; while(p2 < v.size()) { if(sum < l) { p2++; sum += v[p2].first; } else if(sum > u) { sum -= v[p1].first; p1++; } else { for(int i=p1; i<=p2; i++) { ans.push_back(v[i].second); } return ans; } } 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...