# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
653695 | ammar2000 | Detecting Molecules (IOI16_molecules) | C++17 | 2 ms | 596 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define coy cout<<"YES\n"
#define con cout<<"NO\n"
#define co1 cout<<"-1\n"
#define sc(x) scanf("%lld",&x)
#define all(x) x.begin(),x.end()
#define fast ios::sync_qith_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
ll n,L,r,q[111];
bool dp[111][1111],vis[111][1111];
vector <int > v;
bool solve(int in,int we)
{
if (L<=we&&we<=r)
return 1;
if (in==n||we>r)
return 0;
if (vis[in][we])
return (dp[in][we]|dp[in][we+q[in]]);
/*v.pb(in);
v.pb(q[in]);*/
vis[in][we]=1;
dp[in][we]=solve(in+1,we);
dp[in][we+q[in]]=solve(in+1,we+q[in]);
return (dp[in][we]|dp[in][we+q[in]]);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |