# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124050 | 2019-07-02T12:21:50 Z | Nodir_Bobiev | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 380 KB |
# include <iostream> # include <vector> # include <algorithm> using namespace std; vector< int > find_subset( int l, int u, vector < int > w ) { vector < pair < int, int > > vc; int n = w.size(); for( size_t i = 0; i < n; i ++ )vc.push_back( make_pair( w[i], i) ); sort( vc.begin(), vc.end() ); long long sm = vc[0].first; vector < int > ans={ vc[0].second }; for( int i = 1; i <n; i ++ ){ if( sm + vc[i].first >= u ) break; sm += vc[i].first; ans.push_back( vc[i].second ); } for( int i = ans.size(); i < n; i ++ ){ if( sm >= l ) break; sm += vc[i].first - vc[ ans[i%ans.size()] ].first; ans[i%ans.size()] = vc[i].second; } if( sm < l || u < sm ) ans.clear(); return ans; } /* int main() { vector < int > ret = find_subset( 14, 15, {5,5,6,6} ); for( auto c: ret) { cout << c << ' '; } return 0; } */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 376 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 12, answer = YES) |
2 | Correct | 2 ms | 256 KB | OK (n = 12, answer = YES) |
3 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
4 | Correct | 2 ms | 256 KB | OK (n = 12, answer = NO) |
5 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 376 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 376 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 376 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | OK (n = 1, answer = NO) |
2 | Correct | 2 ms | 380 KB | OK (n = 1, answer = NO) |
3 | Correct | 2 ms | 376 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 2 ms | 256 KB | Contestant can not find answer, jury can |
5 | Halted | 0 ms | 0 KB | - |