# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170025 | 2019-12-23T17:36:52 Z | whttt | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 376 KB |
#include <iostream> #include <vector> #include <algorithm> #define ll long long using namespace std; vector<ll> find_subset(int l, int u, vector<int> w){ ll sum = 0; vector<ll> returnThis; vector<pair<ll, ll>> sol; for(ll i = 0;i < w.size();i++){ sol.push_back({w[i],i}); } sort(sol.begin(), sol.end()); for(ll i = 0;i < sol.size();i++){ sum += sol[i].first; //cout << sum << endl; if(sum <= u && sum >= l){ for(ll j = 0;j <= i;j++){ returnThis.push_back(sol[j].second); } return returnThis; } else if(sum > l){ sum -= sol[i].first; //cout << "prvych " << i << " nestaci" << endl; for(ll j = i;j < sol.size();j++){ sum += sol[j].first-sol[j-i].first; //cout << sol[j].first << " priratane a " << sol[j-i].first << " odratane" << endl; if(sum <= u && sum >= l){ for(ll k = j-i+1;k <= i;k++){ returnThis.push_back(sol[k].second); } return returnThis; } if(j == sol.size()-1){ return {}; } } } } return {}; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 252 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 376 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | item #0 is taken twice |
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 | 252 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 376 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 | 252 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 376 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 | 252 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 376 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 | 252 KB | OK (n = 1, answer = NO) |
3 | Incorrect | 2 ms | 376 KB | Integer 2 violates the range [0, 1] |
4 | Halted | 0 ms | 0 KB | - |