# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082083 | 2024-08-30T16:54:59 Z | logangd | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 348 KB |
#include "molecules.h" #include<algorithm> using namespace std; vector<int> find_subset(int l, int u, vector<int> w) { vector<int>r; vector<pair<int,int>>v; for(int i=0;i<w.size();i++)v.push_back({w[i],i+1}); sort(v.begin(),v.end()); int i,j,s=0; for(i=0;i<v.size()&&s+v[i].first<=u;i++)s+=v[i].first; if(i==v.size()){ if(l<=s&&s<=u){ for(int k=0;k<i;k++)r.push_back(v[k].second); } return r; } for(i--,j=v.size()-1;0<=i&&s+v[j].first-v[i].first<=u;j--,i--) s+=v[j].first-v[i].first; if(l<=s&&s<=u){ for(int k=0;k<=i;k++)r.push_back(v[k].second); for(int k=j+1;k<v.size();k++)r.push_back(v[k].second); } return r; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Integer 12 violates the range [0, 11] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 348 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 0 ms | 348 KB | Integer 1 violates the range [0, 0] |
4 | Halted | 0 ms | 0 KB | - |