# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
320979 | 2020-11-10T11:59:52 Z | neki | Detecting Molecules (IOI16_molecules) | C++14 | 1 ms | 364 KB |
#include "molecules.h" #include <bits/stdc++.h> #define loop(i, a, b) for(long long i=a;i<b;i++) #define pool(i, a, b) for(long long i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll long long #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 1010 #define pa pair<ll, ll> #define ld long double vc<int> find_subset(int l, int u, vc<int> w){ vc<pa> ar; loop(i, 0, w.size()){ ll v=w[i]; if(v<l)ar.ps(make_pair(v, i)); else if(v<=u) return vc<int> {i}; } if(ar.size()==0) return vc<int> {}; sort(all(ar)); ll n=ar.size(); vc<ll> sum(n+1, 0); loop(i, 0, n) sum[i+1]=sum[i]+ar[i].fi; loop(i, 1, n+1) if(sum[i]-sum[0]<=u and l<=sum[n]-sum[n-i]){ loop(j, 0, n-i+1) if(l<=sum[j+i]-sum[j] and sum[j+i]-sum[j]<=u){ vc<int> ans; loop(z, j+1, j+1+i) ans.ps(ar[z].se); sort(all(ans)); return ans; } } return vc<int> {}; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 364 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 364 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 364 KB | Integer 33 violates the range [0, 1] |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 12, answer = YES) |
2 | Correct | 0 ms | 364 KB | OK (n = 12, answer = YES) |
3 | Correct | 0 ms | 364 KB | OK (n = 12, answer = NO) |
4 | Correct | 1 ms | 364 KB | OK (n = 12, answer = NO) |
5 | Incorrect | 0 ms | 364 KB | sum of weights should be in [290..300] but it is 301 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 364 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 364 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 364 KB | Integer 33 violates the range [0, 1] |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 364 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 364 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 364 KB | Integer 33 violates the range [0, 1] |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 364 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 364 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 364 KB | Integer 33 violates the range [0, 1] |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | OK (n = 1, answer = NO) |
2 | Correct | 0 ms | 364 KB | OK (n = 1, answer = NO) |
3 | Correct | 1 ms | 364 KB | OK (n = 1, answer = YES) |
4 | Incorrect | 0 ms | 364 KB | Integer 33 violates the range [0, 1] |
5 | Halted | 0 ms | 0 KB | - |