# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
156518 | 2019-10-06T09:56:01 Z | a_player | Detecting Molecules (IOI16_molecules) | C++14 | 21 ms | 16252 KB |
#include <bits/stdc++.h> #define f first #define s second #define mp make_pair #define pb push_back using namespace std; //typedef long long ll; pair<int,int> dp[1001][1001]; int v[1001]; int N,uu,ll; bool ric(int n,int val){ if(val>=uu&&val<=ll)return 1; if(n==N)return 0; if(val>ll)return 0; if(dp[n][val].f!=-1)return dp[n][val].f; if(ric(n+1,val)){ dp[n][val].f=1; dp[n][val].s=0; return 1; } else if(ric(n+1,val+v[n])){ dp[n][val].f=1; dp[n][val].s=1; return 1; } else { dp[n][val].f=0; dp[n][val].s=-1; return 0; } return 0; } vector<int> find_subset(int l,int u,vector<int> w){ uu=l; ll=u; N=w.size(); for(int i=0;i<1001;i++) for(int j=0;j<1001;j++)dp[i][j]=mp(-1,-1); for(int i=0;i<w.size();i++)v[i]=w[i]; ric(0,0); vector<int> sol; if(dp[0][0].f==0)return sol; int val=0; int n=0; while(val<u){ if(dp[n][val].s==1){ sol.push_back(n); val+=v[n]; n++; }else n++; } return sol; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | OK (n = 1, answer = NO) |
2 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = NO) |
3 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = YES) |
4 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
5 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
6 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
7 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
8 | Correct | 8 ms | 8184 KB | OK (n = 3, answer = YES) |
9 | Runtime error | 19 ms | 16252 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 8184 KB | OK (n = 12, answer = YES) |
2 | Correct | 9 ms | 8184 KB | OK (n = 12, answer = YES) |
3 | Correct | 9 ms | 8184 KB | OK (n = 12, answer = NO) |
4 | Correct | 9 ms | 8184 KB | OK (n = 12, answer = NO) |
5 | Correct | 9 ms | 8184 KB | OK (n = 12, answer = YES) |
6 | Runtime error | 21 ms | 16248 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | OK (n = 1, answer = NO) |
2 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = NO) |
3 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = YES) |
4 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
5 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
6 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
7 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
8 | Correct | 8 ms | 8184 KB | OK (n = 3, answer = YES) |
9 | Runtime error | 19 ms | 16252 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | OK (n = 1, answer = NO) |
2 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = NO) |
3 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = YES) |
4 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
5 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
6 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
7 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
8 | Correct | 8 ms | 8184 KB | OK (n = 3, answer = YES) |
9 | Runtime error | 19 ms | 16252 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | OK (n = 1, answer = NO) |
2 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = NO) |
3 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = YES) |
4 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
5 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
6 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
7 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
8 | Correct | 8 ms | 8184 KB | OK (n = 3, answer = YES) |
9 | Runtime error | 19 ms | 16252 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 8184 KB | OK (n = 1, answer = NO) |
2 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = NO) |
3 | Correct | 8 ms | 8184 KB | OK (n = 1, answer = YES) |
4 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
5 | Correct | 9 ms | 8184 KB | OK (n = 2, answer = YES) |
6 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
7 | Correct | 9 ms | 8184 KB | OK (n = 3, answer = YES) |
8 | Correct | 8 ms | 8184 KB | OK (n = 3, answer = YES) |
9 | Runtime error | 19 ms | 16252 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Halted | 0 ms | 0 KB | - |