# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
755167 |
2023-06-09T13:17:51 Z |
vjudge1 |
Bank (IZhO14_bank) |
C++17 |
|
1000 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
long long a[100001],b[100001];
int hv[100001];
int danhdau[100];
int n,m;
int kq=0;
void kt()
{
long long tong=0;
int i2=1;
for (int i=1;i<=m;i++)
{
tong=tong+b[hv[i]];
if (i2==n+1)
{
kq=1;
return;
}
if (tong>a[i2]) return;
if (tong==a[i2])
{
tong=0;
a[i2]++;
}
}
if (i2==n+1) kq=1;
return;
}
void kk (int i)
{
if (i==m+1)
{
kt();
return;
}
// int mid=(l+r)>>1;
for (int i2=1;i2<=m;i2++)
{
if (!danhdau[i2])
{
hv[i]=i2;
danhdau[i2]=1;
kk(i+1);
danhdau[i2]=0;
}
}
}
signed main ()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin >> n >> m;
for (int i=1;i<=n;i++)
{
cin >> a[i];
}
for (int i=1;i<=m;i++) cin >> b[i];
kk(1);
if (kq) cout << "YES" << '\n';
else cout << "NO" << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
216 ms |
316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |