# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
82868 | 2018-11-02T09:04:39 Z | SecretAgent007 | Detecting Molecules (IOI16_molecules) | C++17 | 2 ms | 408 KB |
#include "molecules.h" #include <bits/stdc++.h> using namespace std; vector<int> find_subset(int l, int r, vector<int> w){ int n = w.size(); vector< pair<int, int> > toS(0); for(int i = 0; i < w.size(); i++){ toS.push_back(make_pair(w[i],i)); } sort(toS.begin(), toS.end()); int le = 0; int ri = 0; long long sum = 0; while(1){ while(ri < n && sum < l){ sum+=toS[ri++].first; } while(le < n && sum > r){ sum-=toS[le++].first; } if(sum >= l && sum <= r){ vector<int> ans(0); for(int i = le; i <= ri; i++){ ans.push_back(toS[i].second); } return ans; } if(le >= n || ri >= n) break; } vector<int> ans(0); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 372 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 372 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 408 KB | sum of weights should be in [302..304] but it is 353 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 372 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 372 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 372 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 372 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 372 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 372 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 372 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 372 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |