# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
269168 | 2020-08-17T05:33:10 Z | Bill_00 | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 384 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; pair<int,int>p[200001]; std::vector<int> find_subset(int l, int u, std::vector<int> w){ int n=w.size(); for(int i=0;i<w.size();i++){ p[i]=make_pair(w[i],i); } sort(p,p+w.size()); vector<int>res; int sum=0,up=-1; for(int i=0;i<w.size();i++){ sum+=p[i].first; if(sum<=u && sum>=l){ for(int j=0;j<=i;j++){ res.push_back(p[i].second); } sort(res.begin(),res.end()); return res; } if(sum>=l){ up=i-1; sum-=p[i].first; break; } } if(up==-1){ return res; } for(int i=up;i>=0;i--){ sum-=p[i].first; sum+=p[i+n-up-1].first; if(sum>=l && sum<=u){ for(int j=0;j<=i-1;j++){ res.push_back(p[j].second); } for(int j=i+n-up-1;j<n;j++){ res.push_back(p[j].second); } sort(res.begin(),res.end()); return res; } } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 12, answer = YES) |
2 | Correct | 0 ms | 256 KB | OK (n = 12, answer = YES) |
3 | Correct | 1 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 1 ms | 256 KB | OK (n = 12, answer = NO) |
5 | Incorrect | 0 ms | 256 KB | item #5 is taken twice |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 256 KB | OK (n = 1, answer = NO) |
3 | Correct | 0 ms | 256 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 384 KB | item #1 is taken twice |
5 | Halted | 0 ms | 0 KB | - |